This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

use -fno-toplevel-reorder if it's available


-fno-unit-at-a-time is no longer enough to get the gcc trunk to build
working crt files for glibc, since it no longer implies no reordering
is to occur, so we end up with #include "defs.h" at the wrong spot in
initfini.s.  -fno-toplevel-reorder is what gets the behavior we want,
so here's a patch to use it.  I've successfully built glibc for x86-64
and -32 using it.

Index: ChangeLog
2006-01-30  Alexandre Oliva  <aoliva@redhat.com>

	* configure.in (fno_unit_at_a_time): Set to
	-fno-toplevel-reorder if the compiler supports it.
	* configure: Rebuilt.


Index: configure
===================================================================
--- configure.orig	2006-01-20 00:11:53.000000000 -0200
+++ configure	2006-01-29 21:57:21.000000000 -0200
@@ -5824,8 +5824,36 @@ rm -f conftest*
 fi
 echo "$as_me:$LINENO: result: $libc_cv_fno_unit_at_a_time" >&5
 echo "${ECHO_T}$libc_cv_fno_unit_at_a_time" >&6
-if test $libc_cv_fno_unit_at_a_time = yes; then
+echo "$as_me:$LINENO: checking for -fno-toplevel-reorder" >&5
+echo $ECHO_N "checking for -fno-toplevel-reorder... $ECHO_C" >&6
+if test "${libc_cv_fno_toplevel_reorder+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat > conftest.c <<EOF
+int foo;
+EOF
+if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder
+			    conftest.c 1>&5'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }
+then
+  libc_cv_fno_toplevel_reorder=yes
+else
+  libc_cv_fno_toplevel_reorder=no
+fi
+rm -f conftest*
+fi
+echo "$as_me:$LINENO: result: $libc_cv_fno_toplevel_reorder" >&5
+echo "${ECHO_T}$libc_cv_fno_toplevel_reorder" >&6
+if test $libc_cv_fno_toplevel_reorder = yes; then
+  fno_unit_at_a_time=-fno-toplevel-reorder
+elif test $libc_cv_fno_unit_at_a_time = yes; then
   fno_unit_at_a_time=-fno-unit-at-a-time
+else
+  fno_unit_at_a_time=
 fi
 
 
Index: configure.in
===================================================================
--- configure.in.orig	2006-01-13 21:14:37.000000000 -0200
+++ configure.in	2006-01-29 21:56:58.000000000 -0200
@@ -1527,8 +1527,24 @@ else
   libc_cv_fno_unit_at_a_time=no
 fi
 rm -f conftest*])
-if test $libc_cv_fno_unit_at_a_time = yes; then
+AC_CACHE_CHECK(for -fno-toplevel-reorder, libc_cv_fno_toplevel_reorder, [dnl
+cat > conftest.c <<EOF
+int foo;
+EOF
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder
+			    conftest.c 1>&AS_MESSAGE_LOG_FD])
+then
+  libc_cv_fno_toplevel_reorder=yes
+else
+  libc_cv_fno_toplevel_reorder=no
+fi
+rm -f conftest*])
+if test $libc_cv_fno_toplevel_reorder = yes; then
+  fno_unit_at_a_time=-fno-toplevel-reorder
+elif test $libc_cv_fno_unit_at_a_time = yes; then
   fno_unit_at_a_time=-fno-unit-at-a-time
+else
+  fno_unit_at_a_time=
 fi
 AC_SUBST(fno_unit_at_a_time)
 
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]