OSDN Git Service

A patch from our Blackfin repository, originally from Jie Zhang. This fixes
authorBernd Schmidt <bernds_cb1@t-online.de>
Thu, 17 Jan 2008 19:11:18 +0000 (19:11 -0000)
committerBernd Schmidt <bernds_cb1@t-online.de>
Thu, 17 Jan 2008 19:11:18 +0000 (19:11 -0000)
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.

29 files changed:
Rules.mak
libc/Makefile.in
libc/sysdeps/linux/alpha/bits/uClibc_arch_features.h
libc/sysdeps/linux/arm/bits/uClibc_arch_features.h
libc/sysdeps/linux/avr32/bits/uClibc_arch_features.h
libc/sysdeps/linux/bfin/bits/uClibc_arch_features.h
libc/sysdeps/linux/common/bits/uClibc_arch_features.h
libc/sysdeps/linux/cris/bits/uClibc_arch_features.h
libc/sysdeps/linux/e1/bits/uClibc_arch_features.h
libc/sysdeps/linux/frv/bits/uClibc_arch_features.h
libc/sysdeps/linux/h8300/bits/uClibc_arch_features.h
libc/sysdeps/linux/hppa/bits/uClibc_arch_features.h
libc/sysdeps/linux/i386/bits/uClibc_arch_features.h
libc/sysdeps/linux/i960/README
libc/sysdeps/linux/i960/bits/uClibc_arch_features.h
libc/sysdeps/linux/ia64/bits/uClibc_arch_features.h
libc/sysdeps/linux/m68k/bits/uClibc_arch_features.h
libc/sysdeps/linux/microblaze/bits/uClibc_arch_features.h
libc/sysdeps/linux/mips/bits/uClibc_arch_features.h
libc/sysdeps/linux/nios/bits/uClibc_arch_features.h
libc/sysdeps/linux/nios2/bits/uClibc_arch_features.h
libc/sysdeps/linux/powerpc/bits/uClibc_arch_features.h
libc/sysdeps/linux/sh/bits/uClibc_arch_features.h
libc/sysdeps/linux/sh64/bits/uClibc_arch_features.h
libc/sysdeps/linux/sparc/bits/uClibc_arch_features.h
libc/sysdeps/linux/v850/bits/uClibc_arch_features.h
libc/sysdeps/linux/vax/bits/uClibc_arch_features.h
libc/sysdeps/linux/x86_64/bits/uClibc_arch_features.h
libc/sysdeps/linux/xtensa/bits/uClibc_arch_features.h

index bda4e18..11c94fb 100644 (file)
--- a/Rules.mak
+++ b/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)
index 6468ab7..e88a6e7 100644 (file)
@@ -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)
 
index 8ecd182..e62375c 100644 (file)
@@ -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__
 
index bb63a2e..85c9adb 100644 (file)
@@ -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__
 
index 993fbf8..679be30 100644 (file)
@@ -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__
 
index eb62276..39e71c9 100644 (file)
@@ -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__
 
index a671b42..66186ed 100644 (file)
@@ -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__
 
index 98c1d0d..bdd3387 100644 (file)
@@ -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__
 
index 6bf166f..f4adaf5 100644 (file)
@@ -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__
 
index 6bf166f..f4adaf5 100644 (file)
@@ -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__
 
index 701790f..b0d032d 100644 (file)
@@ -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__
 
index aade008..2c04f1b 100644 (file)
@@ -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__
 
index fdc6232..f4730d9 100644 (file)
@@ -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__
 
index 8c81f8a..7516735 100644 (file)
@@ -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
index 317bc0d..cd6bcd9 100644 (file)
@@ -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__
 
index da3347b..953279e 100644 (file)
@@ -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__
 
index f04a06d..b5ef48f 100644 (file)
@@ -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__
 
index 172f6c1..f4adaf5 100644 (file)
@@ -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__
 
index eb926fc..42a7c45 100644 (file)
@@ -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__
 
index 6bf166f..f4adaf5 100644 (file)
@@ -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__
 
index 6bf166f..f4adaf5 100644 (file)
@@ -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__
 
index 53adc5c..a3f11df 100644 (file)
@@ -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__
 
index 9cf3d0d..411e811 100644 (file)
@@ -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__
 
index 8d2fca2..1e8aa59 100644 (file)
@@ -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__
 
index 62d13ff..41d3e7c 100644 (file)
@@ -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__
 
index 172f6c1..f4adaf5 100644 (file)
@@ -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__
 
index 9b8cd59..eda49b8 100644 (file)
@@ -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__
 
index b71d7ab..e3e2c83 100644 (file)
@@ -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__
 
index d01e77f..142aacd 100644 (file)
@@ -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__