diff mbox

PATCH: PR bootstrap/50237: [4.7 regression] bootstrap comparison failure for libcpp/lex.o

Message ID 20110910144421.GA22252@intel.com
State New
Headers show

Commit Message

H.J. Lu Sept. 10, 2011, 2:44 p.m. UTC
On Sat, Sep 03, 2011 at 10:15:20AM -0700, H.J. Lu wrote:
> Hi,
> 
> .init_array is enabled only if linker can take input .ctors sections with
> input .init_array sections to generate the single output .init_array
> section in the right order so that GCC is compatible with existing .o
> files.  Not all linkers support it even if they support .init_array
> section.  Since I couldn't find an uniform link-time test for this feature
> which works for all ELF targets, run-time test is used. However, when
> --with-ld= is used to configure GCC, the wrong linker is used for testing.
> This patch checks DEFAULT_LINKER and works for me.  OK for trunk?
> 
> Thanks.
> 
> 

Here is the updated patch to support ld-new as DEFAULT_LINKER.


H.J.
----
2011-09-10  H.J. Lu  <hongjiu.lu@intel.com>

	PR bootstrap/50237
	* acinclude.m4 (gcc_AC_INITFINI_ARRAY): Check DEFAULT_LINKER.
	* configure: Regenerated.
diff mbox

Patch

diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4
index d8defea..854e712 100644
--- a/gcc/acinclude.m4
+++ b/gcc/acinclude.m4
@@ -373,9 +373,18 @@  AC_DEFUN([gcc_AC_INITFINI_ARRAY],
 [AC_ARG_ENABLE(initfini-array,
 	[  --enable-initfini-array	use .init_array/.fini_array sections],
 	[], [
+AC_REQUIRE([gcc_AC_PROG_LN_S])dnl
 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
 		 gcc_cv_initfini_array, [dnl
   if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
+    saved_CC="$CC"
+    tempdir=build.$$
+    if test x"${DEFAULT_LINKER+set}" = x"set"; then
+      rm -rf $tempdir
+      mkdir $tempdir
+      $gcc_cv_prog_LN_S "${DEFAULT_LINKER}" $tempdir/ld
+      CC="$CC -B${tempdir}/"	
+    fi
     AC_RUN_IFELSE([AC_LANG_SOURCE([
 #ifndef __ELF__
 #error Not an ELF OS
@@ -485,10 +494,12 @@  main ()
 ])],
 	     [gcc_cv_initfini_array=yes], [gcc_cv_initfini_array=no],
 	     [gcc_cv_initfini_array=no])
-   else
-     AC_MSG_CHECKING(cross compile... guessing)
-     gcc_cv_initfini_array=no
-   fi])
+    rm -rf $tempdir
+    CC="$saved_CC"
+  else
+    AC_MSG_CHECKING(cross compile... guessing)
+    gcc_cv_initfini_array=no
+  fi])
   enable_initfini_array=$gcc_cv_initfini_array
 ])
 if test $enable_initfini_array = yes; then
diff --git a/gcc/configure b/gcc/configure
index b1dd57b..93d9807 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -10782,6 +10782,14 @@  if test "${gcc_cv_initfini_array+set}" = set; then :
   $as_echo_n "(cached) " >&6
 else
     if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then
+    saved_CC="$CC"
+    tempdir=build.$$
+    if test x"${DEFAULT_LINKER+set}" = x"set"; then
+      rm -rf $tempdir
+      mkdir $tempdir
+      $gcc_cv_prog_LN_S "${DEFAULT_LINKER}" $tempdir/ld
+      CC="$CC -B${tempdir}/"
+    fi
     if test "$cross_compiling" = yes; then :
   gcc_cv_initfini_array=no
 else
@@ -10904,11 +10912,13 @@  rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
   conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
-   else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5
+    rm -rf $tempdir
+    CC="$saved_CC"
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking cross compile... guessing" >&5
 $as_echo_n "checking cross compile... guessing... " >&6; }
-     gcc_cv_initfini_array=no
-   fi
+    gcc_cv_initfini_array=no
+  fi
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gcc_cv_initfini_array" >&5
 $as_echo "$gcc_cv_initfini_array" >&6; }
@@ -17915,7 +17925,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 17918 "configure"
+#line 17928 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -18021,7 +18031,7 @@  else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<_LT_EOF
-#line 18024 "configure"
+#line 18034 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H