From: Michael Tremer Date: Sun, 12 Aug 2012 16:27:07 +0000 (-0400) Subject: glibc: Make package compile in stage2. X-Git-Tag: v2.13-beta1~275 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2435f0cb43f157dd2607e8f21515d91870ea2ec1;p=ipfire-2.x.git glibc: Make package compile in stage2. --- diff --git a/lfs/glibc b/lfs/glibc index 30ec88486b..682508df06 100644 --- a/lfs/glibc +++ b/lfs/glibc @@ -37,6 +37,7 @@ DIR_APP = $(DIR_SRC)/$(THISAPP) ifeq "$(ROOT)" "" TARGET = $(DIR_INFO)/$(THISAPP) EXTRA_CONFIG = \ + --build=$(BUILDTARGET) \ --prefix=/usr \ --libexecdir=/usr/lib/glibc EXTRA_MAKE = @@ -56,7 +57,8 @@ else endif # Enable some extra optimization for the glibc code. -export CFLAGS := -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC +export CFLAGS := -O3 -DNDEBUG -fasynchronous-unwind-tables -fPIC -DPIC \ + -DNO_CTORS_DTORS_SECTIONS ifeq "$(MACHINE)" "i586" CFLAGS += -march=i586 -mtune=generic -mno-tls-direct-seg-refs @@ -125,7 +127,12 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @rm -rf $(DIR_APP) $(DIR_SRC)/glibc-build && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE) @mkdir $(DIR_SRC)/glibc-build - # Apply all patches. +ifeq "$(MACHINE_TYPE)" "arm" + cd $(DIR_APP) && tar jxf $(DIR_DL)/glibc-ports-$(PORTS_VER).tar.bz2 + cd $(DIR_APP) && mv -v glibc-ports-$(PORTS_VER) ports +endif + +# Apply all patches. cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-aliasing.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-fedora.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-getlogin-r.patch @@ -227,18 +234,16 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc/glibc-rh837026.patch cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-resolv-stack_chk_fail.patch + # http://sourceware.org/bugzilla/show_bug.cgi?id=12354 + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-cfi-entry-not-closed.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/glibc-remove-ctors-dtors-output-sections.patch # Fixes: # Makefile:235: *** mixed implicit and normal rules. Stop. cd $(DIR_APP) && sed -i 's/ot \$$/ot:\n\ttouch $$@\n$$/' manual/Makefile # Fix an issue when building glibc with gcc 4.7. - cd $(DIR_APP) && sed -i "s/ -lgcc_s//" Makeconfig - -ifeq "$(MACHINE_TYPE)" "arm" - cd $(DIR_APP) && tar jxf $(DIR_DL)/glibc-ports-$(PORTS_VER).tar.bz2 - cd $(DIR_APP) && mv -v glibc-ports-$(PORTS_VER) ports -endif + #cd $(DIR_APP) && sed -i "s/ -lgcc_s//" Makeconfig ifeq "$(ROOT)" "" ifeq "$(MACHINE_TYPE)" "arm" diff --git a/src/patches/glibc-cfi-entry-not-closed.patch b/src/patches/glibc-cfi-entry-not-closed.patch new file mode 100644 index 0000000000..02cfe8fa67 --- /dev/null +++ b/src/patches/glibc-cfi-entry-not-closed.patch @@ -0,0 +1,23 @@ +--- glibc-2.12.2/ports/sysdeps/unix/sysv/linux/arm/sigrestorer.S 2011-09-08 22:22:41.000000000 +0400 ++++ glibc-2.12.2/ports/sysdeps/unix/sysv/linux/arm/sigrestorer.S 2011-09-08 21:44:49.000000000 +0400 +@@ -18,16 +18,20 @@ + + #include + ++ .text ++ + /* If no SA_RESTORER function was specified by the application we use + one of these. This avoids the need for the kernel to synthesise a return + instruction on the stack, which would involve expensive cache flushes. */ + + ENTRY(__default_sa_restorer) + swi SYS_ify(sigreturn) ++PSEUDO_END (__default_sa_restorer) + + #ifdef __NR_rt_sigreturn + + ENTRY(__default_rt_sa_restorer) + swi SYS_ify(rt_sigreturn) ++PSEUDO_END (__default_rt_sa_restorer) + + #endif diff --git a/src/patches/glibc-remove-ctors-dtors-output-sections.patch b/src/patches/glibc-remove-ctors-dtors-output-sections.patch new file mode 100644 index 0000000000..91155c9afb --- /dev/null +++ b/src/patches/glibc-remove-ctors-dtors-output-sections.patch @@ -0,0 +1,150 @@ +From 4a531bb0b3b582cb693de9f76d2d97d970f9a5d5 Mon Sep 17 00:00:00 2001 +From: H.J. Lu +Date: Fri, 24 Dec 2010 20:14:37 -0500 +Subject: [PATCH] Remove `.ctors' and `.dtors' output sections + +--- + config.h.in | 3 + + configure.in | 2 + + elf/sofini.c | 2 + + elf/soinit.c | 2 + + sysdeps/i386/init-first.c | 2 + + sysdeps/mach/hurd/i386/init-first.c | 2 +- + sysdeps/mach/hurd/powerpc/init-first.c | 2 +- + sysdeps/sh/init-first.c | 2 + + sysdeps/unix/sysv/linux/init-first.c | 2 +- + 9 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/config.h.in b/config.h.in +index 18bf01a..9e797eb 100644 +--- a/config.h.in ++++ b/config.h.in +@@ -201,6 +201,9 @@ + /* Define if multi-arch DSOs should be generated. */ + #undef USE_MULTIARCH + ++/* Define if `.ctors' and `.dtors' sections shouldn't be used. */ ++#undef NO_CTORS_DTORS_SECTIONS ++ + /* + */ + +diff --git a/configure.in b/configure.in +index d8cd5f1..ad25b9b 100644 +--- a/configure.in ++++ b/configure.in +@@ -1497,6 +1497,8 @@ EOF + rm -f conftest*]) + if test $libc_cv_initfini_array != yes; then + AC_MSG_ERROR([Need linker with .init_array/.fini_array support.]) ++ elif AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep SORT_BY_INIT_PRIORITY 1>&AS_MESSAGE_LOG_FD]); then ++ AC_DEFINE(NO_CTORS_DTORS_SECTIONS) + fi + + AC_CACHE_CHECK(for libunwind-support in compiler, +diff --git a/elf/sofini.c b/elf/sofini.c +index 5e06f0c..13e74b7 100644 +--- a/elf/sofini.c ++++ b/elf/sofini.c +@@ -1,12 +1,14 @@ + /* Finalizer module for ELF shared C library. This provides terminating + null pointer words in the `.ctors' and `.dtors' sections. */ + ++#ifndef NO_CTORS_DTORS_SECTIONS + static void (*const __CTOR_END__[1]) (void) + __attribute__ ((used, section (".ctors"))) + = { 0 }; + static void (*const __DTOR_END__[1]) (void) + __attribute__ ((used, section (".dtors"))) + = { 0 }; ++#endif + + /* Terminate the frame unwind info section with a 4byte 0 as a sentinel; + this would be the 'length' field in a real FDE. */ +diff --git a/elf/soinit.c b/elf/soinit.c +index 6fecbb5..1db676a 100644 +--- a/elf/soinit.c ++++ b/elf/soinit.c +@@ -3,6 +3,7 @@ + the `.ctors' and `.dtors' sections so the lists are terminated, and + calling those lists of functions. */ + ++#ifndef NO_CTORS_DTORS_SECTIONS + #include + #include + +@@ -40,3 +41,4 @@ __libc_fini (void) + + void (*_fini_ptr) (void) __attribute__ ((section (".fini_array"))) + = &__libc_fini; ++#endif +diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c +index c6355a8..2af042f 100644 +--- a/sysdeps/i386/init-first.c ++++ b/sysdeps/i386/init-first.c +@@ -59,7 +59,9 @@ _init (int argc, ...) + { + init (&argc); + ++#ifndef NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); ++#endif + } + #endif + +diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c +index f9a7a58..60823bd 100644 +--- a/sysdeps/mach/hurd/i386/init-first.c ++++ b/sysdeps/mach/hurd/i386/init-first.c +@@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, char **envp) + __getopt_clean_environment (envp); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } +diff --git a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c +index 20fa1d4..21b5054 100644 +--- a/sysdeps/mach/hurd/powerpc/init-first.c ++++ b/sysdeps/mach/hurd/powerpc/init-first.c +@@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, char **envp) + __getopt_clean_environment (__environ); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } +diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c +index d816625..1f3a821 100644 +--- a/sysdeps/sh/init-first.c ++++ b/sysdeps/sh/init-first.c +@@ -59,7 +59,9 @@ _init (int argc, ...) + { + init (&argc); + ++#ifndef NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); ++#endif + } + #endif + +diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c +index 7b2333d..a60212f 100644 +--- a/sysdeps/unix/sysv/linux/init-first.c ++++ b/sysdeps/unix/sysv/linux/init-first.c +@@ -93,7 +93,7 @@ _init (int argc, char **argv, char **envp) + __getopt_clean_environment (envp); + #endif + +-#ifdef SHARED ++#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS + __libc_global_ctors (); + #endif + } +-- +1.7.3.4 +