Use linker --print-output-format option if available.
authorRoland McGrath <roland@hack.frob.com>
Sat, 11 Jun 2011 07:45:12 +0000 (00:45 -0700)
committerRoland McGrath <roland@hack.frob.com>
Fri, 15 Jul 2011 03:50:17 +0000 (20:50 -0700)
ChangeLog
Makerules
config.make.in
configure
configure.in

index 7198da7d94e6c983711e5271e9703e87d8be1294..61524ed68ca3384d9c043a17a873a7646204fbcc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-07-02  Roland McGrath  <roland@hack.frob.com>
+
+       * config.make.in (output-format): New variable.
+       * configure.in: Check for ld --print-output-format support.
+       * configure: Regenerated.
+       * Makerules ($(common-objpfx)format.lds)
+       [$(output-format) != unknown]: Just use $(output-format),
+       instead of the linker-script munging.
+
 2011-07-14  Roland McGrath  <roland@hack.frob.com>
 
        * Makefile ($(common-objpfx)linkobj/libc.so): Use $(shlib-lds) instead
index d70a196dedfbbb96b9b46bb802ffd17fb2f51879..a8b575c019c1c4673375631ae40f595b2cbf928a 100644 (file)
--- a/Makerules
+++ b/Makerules
@@ -990,11 +990,15 @@ install: $(inst_slibdir)/libc.so$(libc.so-version)
 $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
                            $(common-objpfx)config.make \
                            $(common-objpfx)config.h $(..)Makerules
+ifneq (unknown,$(output-format))
+       echo > $@.new 'OUTPUT_FORMAT($(output-format))'
+else
        $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
                  -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
        | sed -n -f $< > $@.new
        test -s $@.new
        rm -f $@.so
+endif
        mv -f $@.new $@
 common-generated += format.lds
 
index b73b21e09bdd2e040c1922bd6e23d6a74cf33843..407ebc1b68ae0d1c9a7e31c9c354c3eeb26bb004 100644 (file)
@@ -70,6 +70,7 @@ fno-unit-at-a-time = @fno_unit_at_a_time@
 bind-now = @bindnow@
 have-hash-style = @libc_cv_hashstyle@
 use-default-link = @use_default_link@
+output-format = @libc_cv_output_format@
 
 static-libgcc = @libc_cv_gcc_static_libgcc@
 
index 2568345f48de69a1e05c89f620c1a8190316a91c..55a4b300b3003feb74504a0f6c492ad8a13f79c4 100755 (executable)
--- a/configure
+++ b/configure
@@ -647,6 +647,7 @@ libc_cv_have_initfini
 gnu89_inline
 libc_cv_ssp
 fno_unit_at_a_time
+libc_cv_output_format
 libc_cv_hashstyle
 libc_cv_fpie
 libc_cv_z_execstack
@@ -6703,6 +6704,24 @@ $as_echo "$libc_cv_hashstyle" >&6; }
 
 fi
 
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking linker output format" >&5
+$as_echo_n "checking linker output format... " >&6; }
+if ${libc_cv_output_format+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if libc_cv_output_format=`
+${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&5`
+then
+  :
+else
+  libc_cv_output_format=
+fi
+test -n "$libc_cv_output_format" || libc_cv_output_format=unknown
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_output_format" >&5
+$as_echo "$libc_cv_output_format" >&6; }
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fno-toplevel-reorder -fno-section-anchors" >&5
 $as_echo_n "checking for -fno-toplevel-reorder -fno-section-anchors... " >&6; }
 if ${libc_cv_fno_toplevel_reorder+:} false; then :
index 55e56498c13e143bf7343ab535eb7864b3aa6dee..a28cd7069ebc486c8417c9e0aa2c762a3445537c 100644 (file)
@@ -1803,6 +1803,17 @@ EOF
   AC_SUBST(libc_cv_hashstyle)
 fi
 
+AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
+if libc_cv_output_format=`
+${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
+then
+  :
+else
+  libc_cv_output_format=
+fi
+test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
+AC_SUBST(libc_cv_output_format)
+
 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
 cat > conftest.c <<EOF
 int foo;