summaryrefslogtreecommitdiff
path: root/toolchain
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2009-06-18 16:47:51 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2009-06-18 16:47:51 +0200
commitf97dbcf294210864262595e1c8d55f5ceecb4d5d (patch)
tree577ad223082dcf884934409ac8a6289e0f1532e8 /toolchain
parent943041c015d5932d9723e58af595dae696eda5e1 (diff)
fix broken uClibc
- after upgrade to gcc 4.4 ld.so in uClibc was broken - add gcc attribute always_inline for ld.so static functions - -Os does not automatically inline the code, use O2 especially for mips and uClibc compile
Diffstat (limited to 'toolchain')
-rw-r--r--toolchain/uClibc/Makefile6
-rw-r--r--toolchain/uClibc/patches/always_inline.patch360
-rw-r--r--toolchain/uClibc/patches/disable-opt-debug-cflags.patch25
-rw-r--r--toolchain/uClibc/patches/null-pointer.patch12
4 files changed, 402 insertions, 1 deletions
diff --git a/toolchain/uClibc/Makefile b/toolchain/uClibc/Makefile
index 23b1afa2f..69b5d343a 100644
--- a/toolchain/uClibc/Makefile
+++ b/toolchain/uClibc/Makefile
@@ -8,6 +8,11 @@ include ../rules.mk
include Makefile.inc
include ${TOPDIR}/mk/buildhlp.mk
+#workaround for mips and gcc 4.4, where -Os does not inline code in ld.so
+ifeq ($(ARCH),mips)
+TARGET_CFLAGS:=$(subst Os,O2,$(TARGET_CFLAGS))
+endif
+
$(WRKBUILD)/.headers:
$(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(WRKBUILD)/Rules.mak
sed -e 's^KERNEL_HEADERS.*$$KERNEL_HEADERS=\"${TOOLCHAIN_SYSROOT}/usr/include\"' \
@@ -64,7 +69,6 @@ $(WRKBUILD)/.installed: $(WRKBUILD)/.install_headers
RUNTIME_PREFIX=/ \
CPU_CFLAGS="$(TARGET_CFLAGS)" \
install_runtime
- echo $(PKG_VERSION) >$(STAGING_DIR)/uclibc_version
rm -rf $(STAGING_DIR)/lib/libc.so
ln -s libc.so.0 $(STAGING_DIR)/lib/libc.so
touch $@
diff --git a/toolchain/uClibc/patches/always_inline.patch b/toolchain/uClibc/patches/always_inline.patch
new file mode 100644
index 000000000..88b5209e9
--- /dev/null
+++ b/toolchain/uClibc/patches/always_inline.patch
@@ -0,0 +1,360 @@
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/arm/dl-sysdep.h 2008-09-25 10:35:20.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/arm/dl-sysdep.h 2009-06-18 16:37:16.000000000 +0200
+@@ -15,7 +15,7 @@
+ GOT_BASE[1] = (unsigned long) MODULE; \
+ }
+
+-static __inline__ unsigned long arm_modulus(unsigned long m, unsigned long p)
++static __always_inline unsigned long arm_modulus(unsigned long m, unsigned long p)
+ {
+ unsigned long i,t,inc;
+ i=p; t=0;
+@@ -72,7 +72,7 @@
+ first element of the GOT. We used to use the PIC register to do this
+ without a constant pool reference, but GCC 4.2 will use a pseudo-register
+ for the PIC base, so it may not be in r10. */
+-static __inline__ Elf32_Addr __attribute__ ((unused))
++static __always_inline Elf32_Addr __attribute__ ((unused))
+ elf_machine_dynamic (void)
+ {
+ Elf32_Addr dynamic;
+@@ -104,7 +104,7 @@
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr __attribute__ ((unused))
++static __always_inline Elf32_Addr __attribute__ ((unused))
+ elf_machine_load_address (void)
+ {
+ extern void __dl_start __asm__ ("_dl_start");
+@@ -128,7 +128,7 @@
+ return pcrel_addr - got_addr;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/bfin/dl-sysdep.h 2008-07-23 13:23:36.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/bfin/dl-sysdep.h 2009-06-18 16:37:37.000000000 +0200
+@@ -213,7 +213,7 @@
+ #endif
+
+ #include <elf.h>
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (DL_LOADADDR_TYPE load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/cris/dl-sysdep.h 2008-07-23 13:19:00.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/cris/dl-sysdep.h 2009-06-18 16:37:42.000000000 +0200
+@@ -39,7 +39,7 @@
+ || ((type) == R_CRIS_GLOB_DAT)) * ELF_RTYPE_CLASS_PLT) \
+ | (((type) == R_CRIS_COPY) * ELF_RTYPE_CLASS_COPY))
+
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_dynamic(void)
+ {
+ /* Don't just set this to an asm variable "r0" since that's not logical
+@@ -61,7 +61,7 @@
+ there's some other symbol we could use, that we don't *have* to force a
+ GOT entry for. */
+
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_load_address(void)
+ {
+ Elf32_Addr gotaddr_diff;
+@@ -95,7 +95,7 @@
+ return gotaddr_diff;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/i386/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/i386/dl-sysdep.h 2009-06-18 16:37:53.000000000 +0200
+@@ -42,8 +42,8 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+-static __inline__ Elf32_Addr elf_machine_dynamic (void) attribute_unused;
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr elf_machine_dynamic (void) attribute_unused;
++static __always_inline Elf32_Addr
+ elf_machine_dynamic (void)
+ {
+ register Elf32_Addr *got __asm__ ("%ebx");
+@@ -52,8 +52,8 @@
+
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr elf_machine_load_address (void) attribute_unused;
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr elf_machine_load_address (void) attribute_unused;
++static __always_inline Elf32_Addr
+ elf_machine_load_address (void)
+ {
+ /* It doesn't matter what variable this is, the reference never makes
+@@ -66,7 +66,7 @@
+ return addr;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/m68k/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/m68k/dl-sysdep.h 2009-06-18 16:37:58.000000000 +0200
+@@ -41,7 +41,7 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_dynamic (void)
+ {
+ register Elf32_Addr *got __asm__ ("%a5");
+@@ -50,7 +50,7 @@
+
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_load_address (void)
+ {
+ Elf32_Addr addr;
+@@ -60,7 +60,7 @@
+ return addr;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/mips/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/mips/dl-sysdep.h 2009-06-18 16:38:03.000000000 +0200
+@@ -163,7 +163,7 @@
+
+ #define OFFSET_GP_GOT 0x7ff0
+
+-static __inline__ ElfW(Addr) *
++static __always_inline ElfW(Addr) *
+ elf_mips_got_from_gpreg (ElfW(Addr) gpreg)
+ {
+ /* FIXME: the offset of gp from GOT may be system-dependent. */
+@@ -173,7 +173,7 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. We assume its $gp points to the primary GOT. */
+-static __inline__ ElfW(Addr)
++static __always_inline ElfW(Addr)
+ elf_machine_dynamic (void)
+ {
+ register ElfW(Addr) gp __asm__ ("$28");
+@@ -192,7 +192,7 @@
+ #endif
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ ElfW(Addr)
++static __always_inline ElfW(Addr)
+ elf_machine_load_address (void)
+ {
+ ElfW(Addr) addr;
+@@ -208,7 +208,7 @@
+ return addr;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (ElfW(Addr) load_off, const ElfW(Addr) rel_addr,
+ ElfW(Word) relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/powerpc/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/powerpc/dl-sysdep.h 2009-06-18 16:38:09.000000000 +0200
+@@ -90,7 +90,7 @@
+ #define ELF_MACHINE_PLTREL_OVERLAP 1
+
+ /* Return the value of the GOT pointer. */
+-static __inline__ Elf32_Addr * __attribute__ ((const))
++static __always_inline Elf32_Addr * __attribute__ ((const))
+ ppc_got (void)
+ {
+ Elf32_Addr *got;
+@@ -109,14 +109,14 @@
+
+ /* Return the link-time address of _DYNAMIC, stored as
+ the first value in the GOT. */
+-static __inline__ Elf32_Addr __attribute__ ((const))
++static __always_inline Elf32_Addr __attribute__ ((const))
+ elf_machine_dynamic (void)
+ {
+ return *ppc_got();
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr __attribute__ ((const))
++static __always_inline Elf32_Addr __attribute__ ((const))
+ elf_machine_load_address (void)
+ {
+ Elf32_Addr *branchaddr;
+@@ -164,7 +164,7 @@
+ return runtime_dynamic - elf_machine_dynamic ();
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sh/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sh/dl-sysdep.h 2009-06-18 16:38:18.000000000 +0200
+@@ -25,7 +25,7 @@
+ struct elf_resolve;
+ extern unsigned long _dl_linux_resolver(struct elf_resolve * tpnt, int reloc_entry);
+
+-static __inline__ unsigned int
++static __always_inline unsigned int
+ _dl_urem(unsigned int n, unsigned int base)
+ {
+ int res;
+@@ -100,7 +100,7 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+-static __inline__ Elf32_Addr __attribute__ ((unused))
++static __always_inline Elf32_Addr __attribute__ ((unused))
+ elf_machine_dynamic (void)
+ {
+ register Elf32_Addr *got;
+@@ -109,7 +109,7 @@
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr __attribute__ ((unused))
++static __always_inline Elf32_Addr __attribute__ ((unused))
+ elf_machine_load_address (void)
+ {
+ Elf32_Addr addr;
+@@ -151,7 +151,7 @@
+ } \
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sh64/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sh64/dl-sysdep.h 2009-06-18 16:38:14.000000000 +0200
+@@ -42,7 +42,7 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+-static __inline__ Elf32_Addr elf_machine_dynamic(void)
++static __always_inline Elf32_Addr elf_machine_dynamic(void)
+ {
+ register Elf32_Addr *got;
+
+@@ -70,7 +70,7 @@
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr elf_machine_load_address(void)
++static __always_inline Elf32_Addr elf_machine_load_address(void)
+ {
+ Elf32_Addr addr;
+
+@@ -123,7 +123,7 @@
+ } \
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative(Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/sparc/dl-sysdep.h 2008-09-15 18:36:11.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/sparc/dl-sysdep.h 2009-06-18 16:38:23.000000000 +0200
+@@ -49,7 +49,7 @@
+
+ #ifndef COMPILE_ASM
+ /* Cheap modulo implementation, taken from arm/ld_sysdep.h. */
+-static __inline__ unsigned long
++static __always_inline unsigned long
+ sparc_mod(unsigned long m, unsigned long p)
+ {
+ unsigned long i, t, inc;
+@@ -127,7 +127,7 @@
+ /* Return the link-time address of _DYNAMIC. Conveniently, this is the
+ first element of the GOT. This must be inlined in a function which
+ uses global data. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_dynamic (void)
+ {
+ register Elf32_Addr *got __asm__ ("%l7");
+@@ -138,7 +138,7 @@
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_load_address (void)
+ {
+ register Elf32_Addr *pc __asm__ ("%o7"), *got __asm__ ("%l7");
+@@ -157,7 +157,7 @@
+ return (Elf32_Addr) got - *got + (pc[2] - pc[3]) * 4 - 4;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
+diff -Nur uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h
+--- uClibc-0.9.30.1.orig/ldso/ldso/xtensa/dl-sysdep.h 2008-07-23 13:19:00.000000000 +0200
++++ uClibc-0.9.30.1/ldso/ldso/xtensa/dl-sysdep.h 2009-06-18 16:38:39.000000000 +0200
+@@ -87,7 +87,7 @@
+ (((type) == R_XTENSA_JMP_SLOT) * ELF_RTYPE_CLASS_PLT)
+
+ /* Return the link-time address of _DYNAMIC. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_dynamic (void)
+ {
+ /* This function is only used while bootstrapping the runtime linker.
+@@ -97,7 +97,7 @@
+ }
+
+ /* Return the run-time load address of the shared object. */
+-static __inline__ Elf32_Addr
++static __always_inline Elf32_Addr
+ elf_machine_load_address (void)
+ {
+ Elf32_Addr addr, tmp;
+@@ -118,7 +118,7 @@
+ return addr - 3;
+ }
+
+-static __inline__ void
++static __always_inline void
+ elf_machine_relative (Elf32_Addr load_off, const Elf32_Addr rel_addr,
+ Elf32_Word relative_count)
+ {
diff --git a/toolchain/uClibc/patches/disable-opt-debug-cflags.patch b/toolchain/uClibc/patches/disable-opt-debug-cflags.patch
new file mode 100644
index 000000000..434f1d793
--- /dev/null
+++ b/toolchain/uClibc/patches/disable-opt-debug-cflags.patch
@@ -0,0 +1,25 @@
+diff -Nur uClibc-0.9.30.1.orig/Rules.mak uClibc-0.9.30.1/Rules.mak
+--- uClibc-0.9.30.1.orig/Rules.mak 2009-03-02 22:10:04.000000000 +0100
++++ uClibc-0.9.30.1/Rules.mak 2009-06-18 16:02:34.000000000 +0200
+@@ -150,9 +150,10 @@
+ # Flags in OPTIMIZATION are used only for non-debug builds
+ OPTIMIZATION:=
+ # Use '-Os' optimization if available, else use -O2, allow Config to override
+-OPTIMIZATION+=$(call check_gcc,-Os,-O2)
++# disable, let OpenADK do the optimization
++#OPTIMIZATION+=$(call check_gcc,-Os,-O2)
+ # Use the gcc 3.4 -funit-at-a-time optimization when available
+-OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
++#OPTIMIZATION+=$(call check_gcc,-funit-at-a-time,)
+
+ GCC_MAJOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 1)
+ #GCC_MINOR_VER?=$(shell $(CC) -dumpversion | cut -d . -f 2)
+@@ -547,7 +548,7 @@
+
+ LDFLAGS:=$(LDFLAGS_NOSTRIP) -Wl,-z,defs
+ ifeq ($(DODEBUG),y)
+-CFLAGS += -O0 -g3
++CFLAGS +=
+ else
+ CFLAGS += $(OPTIMIZATION) $(XARCH_CFLAGS)
+ endif
diff --git a/toolchain/uClibc/patches/null-pointer.patch b/toolchain/uClibc/patches/null-pointer.patch
new file mode 100644
index 000000000..e77cd72b8
--- /dev/null
+++ b/toolchain/uClibc/patches/null-pointer.patch
@@ -0,0 +1,12 @@
+diff -Nur uClibc-0.9.30.1.orig/libc/inet/getaddrinfo.c uClibc-0.9.30.1/libc/inet/getaddrinfo.c
+--- uClibc-0.9.30.1.orig/libc/inet/getaddrinfo.c 2009-02-26 13:49:14.000000000 +0100
++++ uClibc-0.9.30.1/libc/inet/getaddrinfo.c 2009-06-14 17:46:45.000000000 +0200
+@@ -187,6 +187,8 @@
+ }
+
+ for (runp = ifa; runp != NULL; runp = runp->ifa_next) {
++ if (runp->ifa_addr == NULL)
++ continue;
+ #if defined __UCLIBC_HAS_IPV4__
+ if (runp->ifa_addr->sa_family == PF_INET)
+ seen |= SEEN_IPV4;