summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2011-06-11 00:45:12 -0700
committerRoland McGrath <roland@hack.frob.com>2011-07-14 20:50:17 -0700
commit5c55070081c27168d27145afdf6a92cd56c9abb3 (patch)
tree07be43c6115f3d97746612a57c8fda82031d45a5
parenta6928d5102a89f152fe9d17abb26346dc8cefc9c (diff)
Use linker --print-output-format option if available.
-rw-r--r--ChangeLog9
-rw-r--r--Makerules4
-rw-r--r--config.make.in1
-rwxr-xr-xconfigure19
-rw-r--r--configure.in11
5 files changed, 44 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 7198da7d94..61524ed68c 100644
--- 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
diff --git a/Makerules b/Makerules
index d70a196ded..a8b575c019 100644
--- 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
diff --git a/config.make.in b/config.make.in
index b73b21e09b..407ebc1b68 100644
--- a/config.make.in
+++ b/config.make.in
@@ -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@
diff --git a/configure b/configure
index 2568345f48..55a4b300b3 100755
--- 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 :
diff --git a/configure.in b/configure.in
index 55e56498c1..a28cd7069e 100644
--- a/configure.in
+++ b/configure.in
@@ -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;