Browse Source

A patch from our Blackfin repository, originally from Jie Zhang. This fixes
a problem where the linker was trying to use the wrong symbol name for the
init function.

Define SYMBOL_PREFIX as _ in Rules.mak for h8300, bfin, i960,
microblaze, and v850. Add -D__UCLIBC_UNDERSCORES__ in CFLAGS for targets
which define SYMBOL_PREFIX as _. Remove defines and undefs from
uClibc_arch_features.h of each target.
Add $(SYMBOL_PREFIX) to __uClibc_init when passed by ld option -init.

Bernd Schmidt 17 năm trước cách đây
mục cha
commit
23656d08e2
29 tập tin đã thay đổi với 22 bổ sung81 xóa
  1. 18 0
      Rules.mak
  2. 1 1
      libc/Makefile.in
  3. 0 3
      libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h
  4. 0 3
      libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
  5. 0 3
      libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
  6. 0 3
      libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h
  7. 0 3
      libc/sysdeps/linux/common/bits/uClibc_arch_features.h
  8. 0 3
      libc/sysdeps/linux/cris/bits/uClibc_arch_features.h
  9. 0 3
      libc/sysdeps/linux/e1/bits/uClibc_arch_features.h
  10. 0 3
      libc/sysdeps/linux/frv/bits/uClibc_arch_features.h
  11. 0 3
      libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
  12. 0 3
      libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h
  13. 0 3
      libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
  14. 3 2
      libc/sysdeps/linux/i960/README
  15. 0 3
      libc/sysdeps/linux/i960/bits/uClibc_arch_features.h
  16. 0 3
      libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h
  17. 0 3
      libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
  18. 0 3
      libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
  19. 0 3
      libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
  20. 0 3
      libc/sysdeps/linux/nios/bits/uClibc_arch_features.h
  21. 0 3
      libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h
  22. 0 3
      libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
  23. 0 3
      libc/sysdeps/linux/sh/bits/uClibc_arch_features.h
  24. 0 3
      libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
  25. 0 3
      libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h
  26. 0 3
      libc/sysdeps/linux/v850/bits/uClibc_arch_features.h
  27. 0 3
      libc/sysdeps/linux/vax/bits/uClibc_arch_features.h
  28. 0 3
      libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h
  29. 0 3
      libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h

+ 18 - 0
Rules.mak

@@ -276,6 +276,7 @@ ifeq ($(TARGET_ARCH),sh64)
 endif
 
 ifeq ($(TARGET_ARCH),h8300)
+	SYMBOL_PREFIX=_
 	CPU_LDFLAGS-$(CONFIG_H8300H)+= -Wl,-ms8300h
 	CPU_LDFLAGS-$(CONFIG_H8S)   += -Wl,-ms8300s
 	CPU_CFLAGS-$(CONFIG_H8300H) += -mh -mint32
@@ -310,6 +311,7 @@ ifeq ($(TARGET_ARCH),powerpc)
 endif
 
 ifeq ($(TARGET_ARCH),bfin)
+	SYMBOL_PREFIX=_
 ifeq ($(UCLIBC_FORMAT_FDPIC_ELF),y)
 	CPU_CFLAGS-y:=-mfdpic
 	CPU_LDFLAGS-y += -Wl,-melf32bfinfd
@@ -338,6 +340,18 @@ ifeq ($(strip $(TARGET_ARCH)),avr32)
        CPU_LDFLAGS-$(CONFIG_LINKRELAX) += --relax
 endif
 
+ifeq ($(TARGET_ARCH),i960)
+      SYMBOL_PREFIX=_
+endif
+
+ifeq ($(TARGET_ARCH),microblaze)
+      SYMBOL_PREFIX=_
+endif
+
+ifeq ($(TARGET_ARCH),v850)
+      SYMBOL_PREFIX=_
+endif
+
 # Keep the check_gcc from being needlessly executed
 ifndef PIEFLAG
 ifneq ($(UCLIBC_BUILD_PIE),y)
@@ -533,6 +547,10 @@ ifneq ($(DOASSERTS),y)
 CFLAGS+=-DNDEBUG
 endif
 
+ifeq ($(SYMBOL_PREFIX),_)
+CFLAGS+=-D__UCLIBC_UNDERSCORES__
+endif
+
 # Keep the check_as from being needlessly executed
 ifndef ASFLAGS_NOEXEC
 ifeq ($(UCLIBC_BUILD_NOEXECSTACK),y)

+ 1 - 1
libc/Makefile.in

@@ -15,7 +15,7 @@ ifneq ($(VERSION_SCRIPT),)
 VERSION_SCRIPT := -Wl,--version-script,$(VERSION_SCRIPT)
 endif
 
-LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -Wl,-init,__uClibc_init
+LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init $(SYMBOL_PREFIX)__uClibc_init
 
 LIBS-libc.so := $(interp) $(ldso) $(top_builddir)lib/$(NONSHARED_LIBNAME)
 

+ 0 - 3
libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #define __UCLIBC_SLIGHTLY_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/arm/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #define __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h

@@ -21,9 +21,6 @@
 /* does your target have to worry about older [gs]etrlimit() ? */
 #undef __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/common/bits/uClibc_arch_features.h

@@ -23,9 +23,6 @@
 /* does your target have to worry about older [gs]etrlimit() ? */
 #undef __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/cris/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #define __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/e1/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/frv/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/i386/bits/uClibc_arch_features.h

@@ -21,9 +21,6 @@
 /* this is only an issue on i386 where linux < 2.3.25, so we just assume it works ... */
 #undef __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 3 - 2
libc/sysdeps/linux/i960/README

@@ -16,8 +16,9 @@ prepended underscore
 --------------------
 
 As the i960 compiler prepends an underscore to symbols, it is critical that
-bits/uClibc_arch_features.h defines __UCLIBC_UNDERSCORES__
-to make sure that underscores are applied to symbol names when needed.
+Rules.mak defines SYMBOL_PREFIX as _, such that -D__UCLIBC_UNDERSCORES__
+is added to CFLAGS to make sure that underscores are applied to symbol
+names when needed.
 
 
 __va_copy in va-i960.h

+ 0 - 3
libc/sysdeps/linux/i960/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #define __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h

@@ -24,9 +24,6 @@
 /* does your target have to worry about older [gs]etrlimit() ? */
 #define __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/mips/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #undef __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/nios/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h

@@ -21,9 +21,6 @@
 /* this is only an issue on i386 where linux < 2.3.35, so we just assume it works ... */
 #undef __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/sh/bits/uClibc_arch_features.h

@@ -24,9 +24,6 @@
 /* does your target have to worry about older [gs]etrlimit() ? */
 #define __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/v850/bits/uClibc_arch_features.h

@@ -18,9 +18,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#define __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/vax/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h

@@ -17,9 +17,6 @@
 /* does your target have a broken create_module() ? */
 #undef __UCLIBC_BROKEN_CREATE_MODULE__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__
 

+ 0 - 3
libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h

@@ -20,9 +20,6 @@
 /* does your target have to worry about older [gs]etrlimit() ? */
 #undef __UCLIBC_HANDLE_OLDER_RLIMIT__
 
-/* does your target prefix all symbols with an _ ? */
-#undef __UCLIBC_UNDERSCORES__
-
 /* does your target have an asm .set ? */
 #define __UCLIBC_HAVE_ASM_SET_DIRECTIVE__