]> git.pld-linux.org Git - packages/chrpath.git/blame - chrpath-elf64.patch
This commit was manufactured by cvs2git to create branch 'AC-branch'.
[packages/chrpath.git] / chrpath-elf64.patch
CommitLineData
29e1fbad 1--- chrpath-0.10/chrpath.c.elf64 2002-11-23 22:14:19.000000000 +0100
2+++ chrpath-0.10/chrpath.c 2003-09-04 16:00:00.000000000 +0200
3@@ -62,11 +62,11 @@ int
4 chrpath(const char *filename, const char *newpath, int convert)
5 {
6 int fd;
7- Elf32_Ehdr ehdr;
8+ Elf_Ehdr ehdr;
9 int i;
10- Elf32_Phdr phdr;
11- Elf32_Shdr shdr;
12- Elf32_Dyn *dyns;
13+ Elf_Phdr phdr;
14+ Elf_Shdr shdr;
15+ Elf_Dyn *dyns;
16 int rpathoff;
17 char * strtab;
18 char * rpath;
19--- chrpath-0.10/elf.c.elf64 2002-09-17 09:44:48.000000000 +0200
20+++ chrpath-0.10/elf.c 2003-09-04 16:00:00.000000000 +0200
21@@ -16,14 +16,8 @@
22 #include <fcntl.h>
23 #include "protos.h"
24
25-#ifdef WORDS_BIGENDIAN
26-#define ELFDATA2 ELFDATA2MSB
27-#else
28-#define ELFDATA2 ELFDATA2LSB
29-#endif
30-
31 int
32-elf_open(const char *filename, int flags, Elf32_Ehdr *ehdr)
33+elf_open(const char *filename, int flags, Elf_Ehdr *ehdr)
34 {
35 int fd;
36
37@@ -42,26 +36,26 @@ elf_open(const char *filename, int flags
38 }
39
40 if (0 != memcmp(ehdr->e_ident, ELFMAG, SELFMAG) ||
41- ehdr->e_ident[EI_CLASS] != ELFCLASS32 ||
42+ ehdr->e_ident[EI_CLASS] != ELFCLASS ||
43 ehdr->e_ident[EI_DATA] != ELFDATA2 ||
44 ehdr->e_ident[EI_VERSION] != EV_CURRENT)
45 {
46 fprintf(stderr,
47 #ifdef WORDS_BIGENDIAN
48- "`%s' probably isn't a 32-bit MSB-first ELF file.\n",
49+ "`%s' probably isn't a %d-bit MSB-first ELF file.\n",
50 #else /* not WORD_BIGENDIAN */
51- "`%s' probably isn't a 32-bit LSB-first ELF file.\n",
52+ "`%s' probably isn't a %d-bit LSB-first ELF file.\n",
53 #endif /* not WORD_BIGENDIAN */
54- filename);
55+ filename, __WORDSIZE);
56 close(fd);
57 errno = ENOEXEC; /* Hm, is this the best errno code to use? */
58 return -1;
59 }
60
61- if (ehdr->e_phentsize != sizeof(Elf32_Phdr))
62+ if (ehdr->e_phentsize != sizeof(Elf_Phdr))
63 {
64 fprintf(stderr, "section size was read as %d, not %d!\n",
65- ehdr->e_phentsize, sizeof(Elf32_Phdr));
66+ ehdr->e_phentsize, sizeof(Elf_Phdr));
67 close(fd);
68 return -1;
69 }
70@@ -69,7 +63,7 @@ elf_open(const char *filename, int flags
71 }
72
73 int
74-elf_find_dynamic_section(int fd, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr)
75+elf_find_dynamic_section(int fd, Elf_Ehdr *ehdr, Elf_Phdr *phdr)
76 {
77 int i;
78 if (lseek(fd, ehdr->e_phoff, SEEK_SET) == -1)
79--- chrpath-0.10/protos.h.elf64 2002-09-17 09:29:29.000000000 +0200
80+++ chrpath-0.10/protos.h 2003-09-04 16:00:00.000000000 +0200
81@@ -2,14 +2,38 @@
82 #define PROTOS_H
83
84 #include <elf.h>
85+#include <bits/wordsize.h>
86+
87+#ifdef WORDS_BIGENDIAN
88+#define ELFDATA2 ELFDATA2MSB
89+#else
90+#define ELFDATA2 ELFDATA2LSB
91+#endif
92+#if __WORDSIZE == 64
93+#define Elf_Ehdr Elf64_Ehdr
94+#define ELFCLASS ELFCLASS64
95+#define Elf_Phdr Elf64_Phdr
96+#define Elf_Shdr Elf64_Shdr
97+#define Elf_Dyn Elf64_Dyn
98+#elif __WORDSIZE == 32
99+#define Elf_Ehdr Elf32_Ehdr
100+#define ELFCLASS ELFCLASS32
101+#define Elf_Phdr Elf32_Phdr
102+#define Elf_Shdr Elf32_Shdr
103+#define Elf_Dyn Elf32_Dyn
104+#else
105+#error "Unknown __WORDSIZE!"
106+#endif
107+
108
109 int killrpath(const char *filename);
110 int chrpath(const char *filename, const char *newpath, int convert);
111
112-int elf_open(const char *filename, int flags, Elf32_Ehdr *ehdr);
113+int elf_open(const char *filename, int flags, Elf_Ehdr *ehdr);
114 void elf_close(int fd);
115-int elf_find_dynamic_section(int fd, Elf32_Ehdr *ehdr, Elf32_Phdr *phdr);
116+int elf_find_dynamic_section(int fd, Elf_Ehdr *ehdr, Elf_Phdr *phdr);
117 const char *elf_tagname(int tag);
118 int elf_dynpath_tag(int tag);
119
120+
121 #endif /* PROTOS_H */
122--- chrpath-0.10/killrpath.c.elf64 2002-09-25 10:01:20.000000000 +0200
123+++ chrpath-0.10/killrpath.c 2003-09-04 16:00:00.000000000 +0200
124@@ -32,10 +32,10 @@ int
125 killrpath(const char *filename)
126 {
127 int fd;
128- Elf32_Ehdr ehdr;
129+ Elf_Ehdr ehdr;
130 int i;
131- Elf32_Phdr phdr;
132- Elf32_Dyn *dyns;
133+ Elf_Phdr phdr;
134+ Elf_Dyn *dyns;
135 int dynpos;
136
137 fd = elf_open(filename, O_RDWR, &ehdr);
This page took 0.095365 seconds and 4 git commands to generate.