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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Alexandre Oliva-2
-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  <[hidden email]>

        * 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}
Reply | Threaded
Open this post in threaded view
|

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

Daniel Jacobowitz-2
On Mon, Jan 30, 2006 at 01:19:05AM -0200, Alexandre Oliva wrote:
> -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.

While this patch probably should be applied, since
-fno-toplevel-reorder is the semantics we actually want,
the fact that -fno-unit-at-a-time didn't work was a bug;
I reported it to Ian yesterday afternoon, and he checked in a fix for
GCC HEAD shortly afterwards.

--
Daniel Jacobowitz
CodeSourcery
Reply | Threaded
Open this post in threaded view
|

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

Alexandre Oliva-2
On Jan 30, 2006, Daniel Jacobowitz <[hidden email]> wrote:

> the fact that -fno-unit-at-a-time didn't work was a bug;
> I reported it to Ian yesterday afternoon, and he checked in a fix for
> GCC HEAD shortly afterwards.

Indeed.  I even thanked him in private for the fix, just to be
surprised a few hours later, after the toolchain rebuild completed and
the glibc build started, to find out that the problem still occurred.
So I wrote this patch, tested it and the build succeeded.  Oddly, now
that I revert the patch and try again, it works.  I guess I'll have to
blame this one on ccache :-(

--
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}