Blame SOURCES/glibc-gcc47-ctordtor.patch

4999bf
diff -Nrup a/config.h.in b/config.h.in
4999bf
--- a/config.h.in	2012-06-07 10:17:05.004639296 -0600
4999bf
+++ b/config.h.in	2012-06-07 10:17:45.289449200 -0600
4999bf
@@ -204,6 +204,9 @@
4999bf
 /* Define if Systemtap <sys/sdt.h> probes should be defined.  */
4999bf
 #undef USE_STAP_PROBE
4999bf
 
4999bf
+/* Define if `.ctors' and `.dtors' sections shouldn't be used.  */
4999bf
+#undef	NO_CTORS_DTORS_SECTIONS
4999bf
+
4999bf
 /*
4999bf
  */
4999bf
 
4999bf
diff -Nrup a/configure b/configure
4999bf
--- a/configure	2012-06-07 10:17:05.427637302 -0600
4999bf
+++ b/configure	2012-06-07 10:18:20.452282885 -0600
4999bf
@@ -577,7 +577,7 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr
4999bf
 exec 7<&0 </dev/null 6>&1
4999bf
 
4999bf
 # Name of the host.
4999bf
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
4999bf
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
4999bf
 # so uname gets run too.
4999bf
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
4999bf
 
4999bf
@@ -1307,8 +1307,8 @@ target=$target_alias
4999bf
 if test "x$host_alias" != x; then
4999bf
   if test "x$build_alias" = x; then
4999bf
     cross_compiling=maybe
4999bf
-    $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
4999bf
-    If a cross compiler is detected then cross compile mode will be used." >&2
4999bf
+    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
4999bf
+    If a cross compiler is detected then cross compile mode will be used" >&2
4999bf
   elif test "x$build_alias" != "x$host_alias"; then
4999bf
     cross_compiling=yes
4999bf
   fi
4999bf
@@ -1412,7 +1412,7 @@ Configuration:
4999bf
       --help=short        display options specific to this package
4999bf
       --help=recursive    display the short help of all the included packages
4999bf
   -V, --version           display version information and exit
4999bf
-  -q, --quiet, --silent   do not print \`checking...' messages
4999bf
+  -q, --quiet, --silent   do not print \`checking ...' messages
4999bf
       --cache-file=FILE   cache test results in FILE [disabled]
4999bf
   -C, --config-cache      alias for \`--cache-file=config.cache'
4999bf
   -n, --no-create         do not create output files
4999bf
@@ -1725,11 +1725,9 @@ trap 'exit_status=$?
4999bf
   {
4999bf
     echo
4999bf
 
4999bf
-    cat <<\_ASBOX
4999bf
-## ---------------- ##
4999bf
+    $as_echo "## ---------------- ##
4999bf
 ## Cache variables. ##
4999bf
-## ---------------- ##
4999bf
-_ASBOX
4999bf
+## ---------------- ##"
4999bf
     echo
4999bf
     # The following way of writing the cache mishandles newlines in values,
4999bf
 (
4999bf
@@ -1763,11 +1761,9 @@ $as_echo "$as_me: WARNING: cache variabl
4999bf
 )
4999bf
     echo
4999bf
 
4999bf
-    cat <<\_ASBOX
4999bf
-## ----------------- ##
4999bf
+    $as_echo "## ----------------- ##
4999bf
 ## Output variables. ##
4999bf
-## ----------------- ##
4999bf
-_ASBOX
4999bf
+## ----------------- ##"
4999bf
     echo
4999bf
     for ac_var in $ac_subst_vars
4999bf
     do
4999bf
@@ -1780,11 +1776,9 @@ _ASBOX
4999bf
     echo
4999bf
 
4999bf
     if test -n "$ac_subst_files"; then
4999bf
-      cat <<\_ASBOX
4999bf
-## ------------------- ##
4999bf
+      $as_echo "## ------------------- ##
4999bf
 ## File substitutions. ##
4999bf
-## ------------------- ##
4999bf
-_ASBOX
4999bf
+## ------------------- ##"
4999bf
       echo
4999bf
       for ac_var in $ac_subst_files
4999bf
       do
4999bf
@@ -1798,11 +1792,9 @@ _ASBOX
4999bf
     fi
4999bf
 
4999bf
     if test -s confdefs.h; then
4999bf
-      cat <<\_ASBOX
4999bf
-## ----------- ##
4999bf
+      $as_echo "## ----------- ##
4999bf
 ## confdefs.h. ##
4999bf
-## ----------- ##
4999bf
-_ASBOX
4999bf
+## ----------- ##"
4999bf
       echo
4999bf
       cat confdefs.h
4999bf
       echo
4999bf
@@ -1855,7 +1847,12 @@ _ACEOF
4999bf
 ac_site_file1=NONE
4999bf
 ac_site_file2=NONE
4999bf
 if test -n "$CONFIG_SITE"; then
4999bf
-  ac_site_file1=$CONFIG_SITE
4999bf
+  # We do not want a PATH search for config.site.
4999bf
+  case $CONFIG_SITE in #((
4999bf
+    -*)  ac_site_file1=./$CONFIG_SITE;;
4999bf
+    */*) ac_site_file1=$CONFIG_SITE;;
4999bf
+    *)   ac_site_file1=./$CONFIG_SITE;;
4999bf
+  esac
4999bf
 elif test "x$prefix" != xNONE; then
4999bf
   ac_site_file1=$prefix/share/config.site
4999bf
   ac_site_file2=$prefix/etc/config.site
4999bf
@@ -1870,7 +1867,11 @@ do
4999bf
     { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
4999bf
 $as_echo "$as_me: loading site script $ac_site_file" >&6;}
4999bf
     sed 's/^/| /' "$ac_site_file" >&5
4999bf
-    . "$ac_site_file"
4999bf
+    . "$ac_site_file" \
4999bf
+      || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
4999bf
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
4999bf
+as_fn_error $? "failed to load site script $ac_site_file
4999bf
+See \`config.log' for more details" "$LINENO" 5; }
4999bf
   fi
4999bf
 done
4999bf
 
4999bf
@@ -6520,9 +6521,15 @@ fi
4999bf
 { $as_echo "$as_me:$LINENO: result: $libc_cv_initfini_array" >&5
4999bf
 $as_echo "$libc_cv_initfini_array" >&6; }
4999bf
   if test $libc_cv_initfini_array != yes; then
4999bf
-    { { $as_echo "$as_me:$LINENO: error: Need linker with .init_array/.fini_array support." >&5
4999bf
-$as_echo "$as_me: error: Need linker with .init_array/.fini_array support." >&2;}
4999bf
-   { (exit 1); exit 1; }; }
4999bf
+    as_fn_error $? "Need linker with .init_array/.fini_array support." "$LINENO" 5
4999bf
+  elif { ac_try='${CC-cc} -Wl,--verbose 2>&1|grep SORT_BY_INIT_PRIORITY 1>&5'
4999bf
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
4999bf
+  (eval $ac_try) 2>&5
4999bf
+  ac_status=$?
4999bf
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
4999bf
+  test $ac_status = 0; }; }; then
4999bf
+    $as_echo "#define NO_CTORS_DTORS_SECTIONS 1" >>confdefs.h
4999bf
+
4999bf
   fi
4999bf
 
4999bf
   { $as_echo "$as_me:$LINENO: checking for libunwind-support in compiler" >&5
4999bf
@@ -9054,6 +9061,7 @@ DEFS=-DHAVE_CONFIG_H
4999bf
 
4999bf
 ac_libobjs=
4999bf
 ac_ltlibobjs=
4999bf
+U=
4999bf
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
4999bf
   # 1. Remove the extension, and $U if already installed.
4999bf
   ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
4999bf
diff -Nrup a/configure.in b/configure.in
4999bf
--- a/configure.in	2012-06-07 10:17:05.009639273 -0600
4999bf
+++ b/configure.in	2012-06-07 10:17:45.349448917 -0600
4999bf
@@ -1536,6 +1536,8 @@ EOF
4999bf
   rm -f conftest*])
4999bf
   if test $libc_cv_initfini_array != yes; then
4999bf
     AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
4999bf
+  elif AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep SORT_BY_INIT_PRIORITY 1>&AS_MESSAGE_LOG_FD]); then
4999bf
+    AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
4999bf
   fi
4999bf
 
4999bf
   AC_CACHE_CHECK(for libunwind-support in compiler,
4999bf
diff -Nrup a/elf/sofini.c b/elf/sofini.c
4999bf
--- a/elf/sofini.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/elf/sofini.c	2012-06-07 10:17:45.350448913 -0600
4999bf
@@ -1,12 +1,14 @@
4999bf
 /* Finalizer module for ELF shared C library.  This provides terminating
4999bf
    null pointer words in the `.ctors' and `.dtors' sections.  */
4999bf
 
4999bf
+#ifndef NO_CTORS_DTORS_SECTIONS
4999bf
 static void (*const __CTOR_END__[1]) (void)
4999bf
      __attribute__ ((used, section (".ctors")))
4999bf
      = { 0 };
4999bf
 static void (*const __DTOR_END__[1]) (void)
4999bf
      __attribute__ ((used, section (".dtors")))
4999bf
      = { 0 };
4999bf
+#endif
4999bf
 
4999bf
 /* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
4999bf
    this would be the 'length' field in a real FDE.  */
4999bf
diff -Nrup a/elf/soinit.c b/elf/soinit.c
4999bf
--- a/elf/soinit.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/elf/soinit.c	2012-06-07 10:17:45.351448908 -0600
4999bf
@@ -3,6 +3,7 @@
4999bf
    the `.ctors' and `.dtors' sections so the lists are terminated, and
4999bf
    calling those lists of functions.  */
4999bf
 
4999bf
+#ifndef NO_CTORS_DTORS_SECTIONS
4999bf
 #include <libc-internal.h>
4999bf
 #include <stdlib.h>
4999bf
 
4999bf
@@ -40,3 +41,4 @@ __libc_fini (void)
4999bf
 
4999bf
 void (*_fini_ptr) (void) __attribute__ ((section (".fini_array")))
4999bf
      = &__libc_fini;
4999bf
+#endif
4999bf
diff -Nrup a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c
4999bf
--- a/sysdeps/i386/init-first.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/sysdeps/i386/init-first.c	2012-06-07 10:17:45.353448898 -0600
4999bf
@@ -59,7 +59,9 @@ _init (int argc, ...)
4999bf
 {
4999bf
   init (&argc);
4999bf
 
4999bf
+#ifndef NO_CTORS_DTORS_SECTIONS
4999bf
   __libc_global_ctors ();
4999bf
+#endif
4999bf
 }
4999bf
 #endif
4999bf
 
4999bf
diff -Nrup a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
4999bf
--- a/sysdeps/mach/hurd/i386/init-first.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/sysdeps/mach/hurd/i386/init-first.c	2012-06-07 10:17:45.354448893 -0600
4999bf
@@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, c
4999bf
   __getopt_clean_environment (envp);
4999bf
 #endif
4999bf
 
4999bf
-#ifdef SHARED
4999bf
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
4999bf
   __libc_global_ctors ();
4999bf
 #endif
4999bf
 }
4999bf
diff -Nrup a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c
4999bf
--- a/sysdeps/mach/hurd/powerpc/init-first.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/sysdeps/mach/hurd/powerpc/init-first.c	2012-06-07 10:17:45.354448893 -0600
4999bf
@@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, c
4999bf
   __getopt_clean_environment (__environ);
4999bf
 #endif
4999bf
 
4999bf
-#ifdef SHARED
4999bf
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
4999bf
   __libc_global_ctors ();
4999bf
 #endif
4999bf
 }
4999bf
diff -Nrup a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c
4999bf
--- a/sysdeps/sh/init-first.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/sysdeps/sh/init-first.c	2012-06-07 10:17:45.355448888 -0600
4999bf
@@ -59,7 +59,9 @@ _init (int argc, ...)
4999bf
 {
4999bf
   init (&argc);
4999bf
 
4999bf
+#ifndef NO_CTORS_DTORS_SECTIONS
4999bf
   __libc_global_ctors ();
4999bf
+#endif
4999bf
 }
4999bf
 #endif
4999bf
 
4999bf
diff -Nrup a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
4999bf
--- a/sysdeps/unix/sysv/linux/init-first.c	2010-05-04 05:27:23.000000000 -0600
4999bf
+++ b/sysdeps/unix/sysv/linux/init-first.c	2012-06-07 10:17:45.356448884 -0600
4999bf
@@ -93,7 +93,7 @@ _init (int argc, char **argv, char **env
4999bf
   __getopt_clean_environment (envp);
4999bf
 #endif
4999bf
 
4999bf
-#ifdef SHARED
4999bf
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
4999bf
   __libc_global_ctors ();
4999bf
 #endif
4999bf
 }