]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[SPARC]: Fix dot-symbol exporting for good.
authorAl Viro <viro@ZenIV.linux.org.uk>
Mon, 12 Sep 2005 03:14:07 +0000 (20:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 Sep 2005 03:14:07 +0000 (20:14 -0700)
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>
arch/sparc/kernel/module.c
arch/sparc/kernel/sparc_ksyms.c
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

index 7931d6f92819eb768c78792e336af88219b11892..787d5f1347ec48de6538bc46e44d712acbddab40 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/vmalloc.h>
 #include <linux/fs.h>
 #include <linux/string.h>
+#include <linux/ctype.h>
 
 void *module_alloc(unsigned long size)
 {
@@ -37,7 +38,7 @@ void module_free(struct module *mod, void *module_region)
 }
 
 /* Make generic code ignore STT_REGISTER dummy undefined symbols,
- * and replace references to .func with func as in ppc64's dedotify.
+ * and replace references to .func with _Func
  */
 int module_frob_arch_sections(Elf_Ehdr *hdr,
                              Elf_Shdr *sechdrs,
@@ -64,8 +65,10 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
                                sym[i].st_shndx = SHN_ABS;
                        else {
                                char *name = strtab + sym[i].st_name;
-                               if (name[0] == '.')
-                                       memmove(name, name+1, strlen(name));
+                               if (name[0] == '.') {
+                                       name[0] = '_';
+                                       name[1] = toupper(name[1]);
+                               }
                        }
                }
        }
index f84809333624aae07d323e3b1577bc0ce5ddfb74..1c8fd0fd930590ce218d915cbcc4cf128fc4b66d 100644 (file)
@@ -97,19 +97,12 @@ extern void ___rw_write_enter(void);
 /* Alias functions whose names begin with "." and export the aliases.
  * The module references will be fixed up by module_frob_arch_sections.
  */
-#define DOT_ALIAS2(__ret, __x, __arg1, __arg2) \
-       extern __ret __x(__arg1, __arg2); \
-       asm(".weak " #__x);\
-       asm(#__x "=." #__x);
-
-DOT_ALIAS2(int, div, int, int)
-DOT_ALIAS2(int, mul, int, int)
-DOT_ALIAS2(int, rem, int, int)
-DOT_ALIAS2(unsigned, udiv, unsigned, unsigned)
-DOT_ALIAS2(unsigned, umul, unsigned, unsigned)
-DOT_ALIAS2(unsigned, urem, unsigned, unsigned)
-
-#undef DOT_ALIAS2
+extern int _Div(int, int);
+extern int _Mul(int, int);
+extern int _Rem(int, int);
+extern unsigned _Udiv(unsigned, unsigned);
+extern unsigned _Umul(unsigned, unsigned);
+extern unsigned _Urem(unsigned, unsigned);
 
 /* used by various drivers */
 EXPORT_SYMBOL(sparc_cpu_model);
@@ -320,12 +313,12 @@ EXPORT_SYMBOL(__lshrdi3);
 EXPORT_SYMBOL(__muldi3);
 EXPORT_SYMBOL(__divdi3);
 
-EXPORT_SYMBOL(rem);
-EXPORT_SYMBOL(urem);
-EXPORT_SYMBOL(mul);
-EXPORT_SYMBOL(umul);
-EXPORT_SYMBOL(div);
-EXPORT_SYMBOL(udiv);
+EXPORT_SYMBOL(_Rem);
+EXPORT_SYMBOL(_Urem);
+EXPORT_SYMBOL(_Mul);
+EXPORT_SYMBOL(_Umul);
+EXPORT_SYMBOL(_Div);
+EXPORT_SYMBOL(_Udiv);
 
 #ifdef CONFIG_DEBUG_BUGVERBOSE
 EXPORT_SYMBOL(do_BUG);
index 83dffbc2f62f05e1d7977931a623a2d830a0279b..da693560d8788a4c9169a5b16534c6a8c20640a3 100644 (file)
@@ -16,7 +16,9 @@
  */
 
        .globl .mul
+       .globl _Mul
 .mul:
+_Mul:  /* needed for export */
        mov     %o0, %y         ! multiplier -> Y
        andncc  %o0, 0xfff, %g0 ! test bits 12..31
        be      Lmul_shortway   ! if zero, can do it the short way
index 44508148d055718d3f8c6f56b693ae1c1d10ffd7..bf015a90d07e985535729bd0540b6bf0014d7a7f 100644 (file)
@@ -43,7 +43,9 @@
 
 
        .globl .rem
+       .globl _Rem
 .rem:
+_Rem:  /* needed for export */
        ! compute sign of result; if neither is negative, no problem
        orcc    %o1, %o0, %g0   ! either negative?
        bge     2f                      ! no, go do the divide
index e0ad80b6f63d8053d84df24e75ff7e5b0c95175c..af9451629d0bdda24ca2a41706f244d1c0a14e53 100644 (file)
@@ -43,7 +43,9 @@
 
 
        .globl .div
+       .globl _Div
 .div:
+_Div:  /* needed for export */
        ! compute sign of result; if neither is negative, no problem
        orcc    %o1, %o0, %g0   ! either negative?
        bge     2f                      ! no, go do the divide
index 2abfc6b0f3e91e8cb6244533f87f47afefce0b89..169e01da671574a38d58b98a5f82317a9fee9a56 100644 (file)
@@ -43,7 +43,9 @@
 
 
        .globl .udiv
+       .globl _Udiv
 .udiv:
+_Udiv: /* needed for export */
 
        ! Ready to divide.  Compute size of quotient; scale comparand.
        orcc    %o1, %g0, %o5
index a784720a8a220b4624365673bd810171e087d8ef..f0e5b20a2536fdbaeb88842f83a1d6ed58d90262 100644 (file)
@@ -21,7 +21,9 @@
  */
 
        .globl .umul
+       .globl _Umul
 .umul:
+_Umul: /* needed for export */
        or      %o0, %o1, %o4
        mov     %o0, %y         ! multiplier -> Y
 
index ec7f0c502c569b7024c34b698e1b1205b5df3587..6b92bdc8b04cc12c5ab994aa962aa6e38938e41d 100644 (file)
@@ -41,7 +41,9 @@
  */
 
        .globl .urem
+       .globl _Urem
 .urem:
+_Urem: /* needed for export */
 
        ! Ready to divide.  Compute size of quotient; scale comparand.
        orcc    %o1, %g0, %o5
index 09ffca54b3734136aa46afcfcbaeb279e80960d9..3bed09e625c0b52c8d52f762af6ee6dfd7c86cba 100644 (file)
@@ -370,6 +370,12 @@ handle_modversions(struct module *mod, struct elf_info *info,
                        /* Ignore register directives. */
                        if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER)
                                break;
+                       if (symname[0] == '.') {
+                               char *munged = strdup(symname);
+                               munged[0] = '_';
+                               munged[1] = toupper(munged[1]);
+                               symname = munged;
+                       }
                }
 #endif