diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2008-12-26 18:36:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-26 18:36:29 -0500 |
commit | c45d1c209f7420a01afd1f82c08af8d681fd56b8 (patch) | |
tree | 91860eb1267a56486714de304edb5eea159944d4 /arch/sparc/kernel | |
parent | e1648a8194117c7afeb432afb0d10896e10cbea4 (diff) |
sparc64: use bit neutral Elf symbols
To prepare for unification use the bit neutral versions of
the Elf types defined by asm/module.h
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel')
-rw-r--r-- | arch/sparc/kernel/module_64.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/arch/sparc/kernel/module_64.c b/arch/sparc/kernel/module_64.c index 158484bf5999..9f7e8d078d58 100644 --- a/arch/sparc/kernel/module_64.c +++ b/arch/sparc/kernel/module_64.c | |||
@@ -63,7 +63,7 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, | |||
63 | struct module *mod) | 63 | struct module *mod) |
64 | { | 64 | { |
65 | unsigned int symidx; | 65 | unsigned int symidx; |
66 | Elf64_Sym *sym; | 66 | Elf_Sym *sym; |
67 | const char *strtab; | 67 | const char *strtab; |
68 | int i; | 68 | int i; |
69 | 69 | ||
@@ -73,18 +73,18 @@ int module_frob_arch_sections(Elf_Ehdr *hdr, | |||
73 | return -ENOEXEC; | 73 | return -ENOEXEC; |
74 | } | 74 | } |
75 | } | 75 | } |
76 | sym = (Elf64_Sym *)sechdrs[symidx].sh_addr; | 76 | sym = (Elf_Sym *)sechdrs[symidx].sh_addr; |
77 | strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; | 77 | strtab = (char *)sechdrs[sechdrs[symidx].sh_link].sh_addr; |
78 | 78 | ||
79 | for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { | 79 | for (i = 1; i < sechdrs[symidx].sh_size / sizeof(Elf_Sym); i++) { |
80 | if (sym[i].st_shndx == SHN_UNDEF && | 80 | if (sym[i].st_shndx == SHN_UNDEF && |
81 | ELF64_ST_TYPE(sym[i].st_info) == STT_REGISTER) | 81 | ELF_ST_TYPE(sym[i].st_info) == STT_REGISTER) |
82 | sym[i].st_shndx = SHN_ABS; | 82 | sym[i].st_shndx = SHN_ABS; |
83 | } | 83 | } |
84 | return 0; | 84 | return 0; |
85 | } | 85 | } |
86 | 86 | ||
87 | int apply_relocate(Elf64_Shdr *sechdrs, | 87 | int apply_relocate(Elf_Shdr *sechdrs, |
88 | const char *strtab, | 88 | const char *strtab, |
89 | unsigned int symindex, | 89 | unsigned int symindex, |
90 | unsigned int relsec, | 90 | unsigned int relsec, |
@@ -95,20 +95,20 @@ int apply_relocate(Elf64_Shdr *sechdrs, | |||
95 | return -ENOEXEC; | 95 | return -ENOEXEC; |
96 | } | 96 | } |
97 | 97 | ||
98 | int apply_relocate_add(Elf64_Shdr *sechdrs, | 98 | int apply_relocate_add(Elf_Shdr *sechdrs, |
99 | const char *strtab, | 99 | const char *strtab, |
100 | unsigned int symindex, | 100 | unsigned int symindex, |
101 | unsigned int relsec, | 101 | unsigned int relsec, |
102 | struct module *me) | 102 | struct module *me) |
103 | { | 103 | { |
104 | unsigned int i; | 104 | unsigned int i; |
105 | Elf64_Rela *rel = (void *)sechdrs[relsec].sh_addr; | 105 | Elf_Rela *rel = (void *)sechdrs[relsec].sh_addr; |
106 | Elf64_Sym *sym; | 106 | Elf_Sym *sym; |
107 | u8 *location; | 107 | u8 *location; |
108 | u32 *loc32; | 108 | u32 *loc32; |
109 | 109 | ||
110 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { | 110 | for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { |
111 | Elf64_Addr v; | 111 | Elf_Addr v; |
112 | 112 | ||
113 | /* This is where to make the change */ | 113 | /* This is where to make the change */ |
114 | location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr | 114 | location = (u8 *)sechdrs[sechdrs[relsec].sh_info].sh_addr |
@@ -119,11 +119,11 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
119 | 119 | ||
120 | /* This is the symbol it is referring to. Note that all | 120 | /* This is the symbol it is referring to. Note that all |
121 | undefined symbols have been resolved. */ | 121 | undefined symbols have been resolved. */ |
122 | sym = (Elf64_Sym *)sechdrs[symindex].sh_addr | 122 | sym = (Elf_Sym *)sechdrs[symindex].sh_addr |
123 | + ELF64_R_SYM(rel[i].r_info); | 123 | + ELF_R_SYM(rel[i].r_info); |
124 | v = sym->st_value + rel[i].r_addend; | 124 | v = sym->st_value + rel[i].r_addend; |
125 | 125 | ||
126 | switch (ELF64_R_TYPE(rel[i].r_info) & 0xff) { | 126 | switch (ELF_R_TYPE(rel[i].r_info) & 0xff) { |
127 | case R_SPARC_64: | 127 | case R_SPARC_64: |
128 | location[0] = v >> 56; | 128 | location[0] = v >> 56; |
129 | location[1] = v >> 48; | 129 | location[1] = v >> 48; |
@@ -143,24 +143,24 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
143 | break; | 143 | break; |
144 | 144 | ||
145 | case R_SPARC_DISP32: | 145 | case R_SPARC_DISP32: |
146 | v -= (Elf64_Addr) location; | 146 | v -= (Elf_Addr) location; |
147 | *loc32 = v; | 147 | *loc32 = v; |
148 | break; | 148 | break; |
149 | 149 | ||
150 | case R_SPARC_WDISP30: | 150 | case R_SPARC_WDISP30: |
151 | v -= (Elf64_Addr) location; | 151 | v -= (Elf_Addr) location; |
152 | *loc32 = (*loc32 & ~0x3fffffff) | | 152 | *loc32 = (*loc32 & ~0x3fffffff) | |
153 | ((v >> 2) & 0x3fffffff); | 153 | ((v >> 2) & 0x3fffffff); |
154 | break; | 154 | break; |
155 | 155 | ||
156 | case R_SPARC_WDISP22: | 156 | case R_SPARC_WDISP22: |
157 | v -= (Elf64_Addr) location; | 157 | v -= (Elf_Addr) location; |
158 | *loc32 = (*loc32 & ~0x3fffff) | | 158 | *loc32 = (*loc32 & ~0x3fffff) | |
159 | ((v >> 2) & 0x3fffff); | 159 | ((v >> 2) & 0x3fffff); |
160 | break; | 160 | break; |
161 | 161 | ||
162 | case R_SPARC_WDISP19: | 162 | case R_SPARC_WDISP19: |
163 | v -= (Elf64_Addr) location; | 163 | v -= (Elf_Addr) location; |
164 | *loc32 = (*loc32 & ~0x7ffff) | | 164 | *loc32 = (*loc32 & ~0x7ffff) | |
165 | ((v >> 2) & 0x7ffff); | 165 | ((v >> 2) & 0x7ffff); |
166 | break; | 166 | break; |
@@ -177,14 +177,14 @@ int apply_relocate_add(Elf64_Shdr *sechdrs, | |||
177 | case R_SPARC_OLO10: | 177 | case R_SPARC_OLO10: |
178 | *loc32 = (*loc32 & ~0x1fff) | | 178 | *loc32 = (*loc32 & ~0x1fff) | |
179 | (((v & 0x3ff) + | 179 | (((v & 0x3ff) + |
180 | (ELF64_R_TYPE(rel[i].r_info) >> 8)) | 180 | (ELF_R_TYPE(rel[i].r_info) >> 8)) |
181 | & 0x1fff); | 181 | & 0x1fff); |
182 | break; | 182 | break; |
183 | 183 | ||
184 | default: | 184 | default: |
185 | printk(KERN_ERR "module %s: Unknown relocation: %x\n", | 185 | printk(KERN_ERR "module %s: Unknown relocation: %x\n", |
186 | me->name, | 186 | me->name, |
187 | (int) (ELF64_R_TYPE(rel[i].r_info) & 0xff)); | 187 | (int) (ELF_R_TYPE(rel[i].r_info) & 0xff)); |
188 | return -ENOEXEC; | 188 | return -ENOEXEC; |
189 | }; | 189 | }; |
190 | } | 190 | } |