Commit 7caaeabb17758295edff9703c18a840073c5b8f4
Committed by
David S. Miller
1 parent
357d596bd5
Exists in
master
and in
7 other branches
[SPARC]: Fix dot-symbol exporting for good.
From: Al Viro <viro@ZenIV.linux.org.uk> Instead of playing all of these hand-coded assembler aliasing games, just translate symbol names in the name space ".sym" to "_Sym" at module load time. Signed-off-by: David S. Miller <davem@davemloft.net>
Showing 9 changed files with 36 additions and 22 deletions Side-by-side Diff
arch/sparc/kernel/module.c
... | ... | @@ -10,6 +10,7 @@ |
10 | 10 | #include <linux/vmalloc.h> |
11 | 11 | #include <linux/fs.h> |
12 | 12 | #include <linux/string.h> |
13 | +#include <linux/ctype.h> | |
13 | 14 | |
14 | 15 | void *module_alloc(unsigned long size) |
15 | 16 | { |
... | ... | @@ -37,7 +38,7 @@ |
37 | 38 | } |
38 | 39 | |
39 | 40 | /* Make generic code ignore STT_REGISTER dummy undefined symbols, |
40 | - * and replace references to .func with func as in ppc64's dedotify. | |
41 | + * and replace references to .func with _Func | |
41 | 42 | */ |
42 | 43 | int module_frob_arch_sections(Elf_Ehdr *hdr, |
43 | 44 | Elf_Shdr *sechdrs, |
... | ... | @@ -64,8 +65,10 @@ |
64 | 65 | sym[i].st_shndx = SHN_ABS; |
65 | 66 | else { |
66 | 67 | char *name = strtab + sym[i].st_name; |
67 | - if (name[0] == '.') | |
68 | - memmove(name, name+1, strlen(name)); | |
68 | + if (name[0] == '.') { | |
69 | + name[0] = '_'; | |
70 | + name[1] = toupper(name[1]); | |
71 | + } | |
69 | 72 | } |
70 | 73 | } |
71 | 74 | } |
arch/sparc/kernel/sparc_ksyms.c
... | ... | @@ -97,20 +97,13 @@ |
97 | 97 | /* Alias functions whose names begin with "." and export the aliases. |
98 | 98 | * The module references will be fixed up by module_frob_arch_sections. |
99 | 99 | */ |
100 | -#define DOT_ALIAS2(__ret, __x, __arg1, __arg2) \ | |
101 | - extern __ret __x(__arg1, __arg2); \ | |
102 | - asm(".weak " #__x);\ | |
103 | - asm(#__x "=." #__x); | |
100 | +extern int _Div(int, int); | |
101 | +extern int _Mul(int, int); | |
102 | +extern int _Rem(int, int); | |
103 | +extern unsigned _Udiv(unsigned, unsigned); | |
104 | +extern unsigned _Umul(unsigned, unsigned); | |
105 | +extern unsigned _Urem(unsigned, unsigned); | |
104 | 106 | |
105 | -DOT_ALIAS2(int, div, int, int) | |
106 | -DOT_ALIAS2(int, mul, int, int) | |
107 | -DOT_ALIAS2(int, rem, int, int) | |
108 | -DOT_ALIAS2(unsigned, udiv, unsigned, unsigned) | |
109 | -DOT_ALIAS2(unsigned, umul, unsigned, unsigned) | |
110 | -DOT_ALIAS2(unsigned, urem, unsigned, unsigned) | |
111 | - | |
112 | -#undef DOT_ALIAS2 | |
113 | - | |
114 | 107 | /* used by various drivers */ |
115 | 108 | EXPORT_SYMBOL(sparc_cpu_model); |
116 | 109 | EXPORT_SYMBOL(kernel_thread); |
... | ... | @@ -320,12 +313,12 @@ |
320 | 313 | EXPORT_SYMBOL(__muldi3); |
321 | 314 | EXPORT_SYMBOL(__divdi3); |
322 | 315 | |
323 | -EXPORT_SYMBOL(rem); | |
324 | -EXPORT_SYMBOL(urem); | |
325 | -EXPORT_SYMBOL(mul); | |
326 | -EXPORT_SYMBOL(umul); | |
327 | -EXPORT_SYMBOL(div); | |
328 | -EXPORT_SYMBOL(udiv); | |
316 | +EXPORT_SYMBOL(_Rem); | |
317 | +EXPORT_SYMBOL(_Urem); | |
318 | +EXPORT_SYMBOL(_Mul); | |
319 | +EXPORT_SYMBOL(_Umul); | |
320 | +EXPORT_SYMBOL(_Div); | |
321 | +EXPORT_SYMBOL(_Udiv); | |
329 | 322 | |
330 | 323 | #ifdef CONFIG_DEBUG_BUGVERBOSE |
331 | 324 | EXPORT_SYMBOL(do_BUG); |
arch/sparc/lib/mul.S
arch/sparc/lib/rem.S
arch/sparc/lib/sdiv.S
arch/sparc/lib/udiv.S
arch/sparc/lib/umul.S
arch/sparc/lib/urem.S
scripts/mod/modpost.c
... | ... | @@ -370,6 +370,12 @@ |
370 | 370 | /* Ignore register directives. */ |
371 | 371 | if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) |
372 | 372 | break; |
373 | + if (symname[0] == '.') { | |
374 | + char *munged = strdup(symname); | |
375 | + munged[0] = '_'; | |
376 | + munged[1] = toupper(munged[1]); | |
377 | + symname = munged; | |
378 | + } | |
373 | 379 | } |
374 | 380 | #endif |
375 | 381 |