Use linker --print-output-format option if available.

This commit is contained in:
Roland McGrath 2011-06-11 00:45:12 -07:00
parent a6928d5102
commit 5c55070081
5 changed files with 44 additions and 0 deletions

View File

@ -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> 2011-07-14 Roland McGrath <roland@hack.frob.com>
* Makefile ($(common-objpfx)linkobj/libc.so): Use $(shlib-lds) instead * Makefile ($(common-objpfx)linkobj/libc.so): Use $(shlib-lds) instead

View File

@ -990,11 +990,15 @@ install: $(inst_slibdir)/libc.so$(libc.so-version)
$(common-objpfx)format.lds: $(..)scripts/output-format.sed \ $(common-objpfx)format.lds: $(..)scripts/output-format.sed \
$(common-objpfx)config.make \ $(common-objpfx)config.make \
$(common-objpfx)config.h $(..)Makerules $(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) \ $(LINK.o) -shared $(sysdep-LDFLAGS) $(config-LDFLAGS) $(LDFLAGS.so) \
-x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \ -x c /dev/null -o $@.so -Wl,--verbose -v 2>&1 \
| sed -n -f $< > $@.new | sed -n -f $< > $@.new
test -s $@.new test -s $@.new
rm -f $@.so rm -f $@.so
endif
mv -f $@.new $@ mv -f $@.new $@
common-generated += format.lds common-generated += format.lds

View File

@ -70,6 +70,7 @@ fno-unit-at-a-time = @fno_unit_at_a_time@
bind-now = @bindnow@ bind-now = @bindnow@
have-hash-style = @libc_cv_hashstyle@ have-hash-style = @libc_cv_hashstyle@
use-default-link = @use_default_link@ use-default-link = @use_default_link@
output-format = @libc_cv_output_format@
static-libgcc = @libc_cv_gcc_static_libgcc@ static-libgcc = @libc_cv_gcc_static_libgcc@

19
configure vendored
View File

@ -647,6 +647,7 @@ libc_cv_have_initfini
gnu89_inline gnu89_inline
libc_cv_ssp libc_cv_ssp
fno_unit_at_a_time fno_unit_at_a_time
libc_cv_output_format
libc_cv_hashstyle libc_cv_hashstyle
libc_cv_fpie libc_cv_fpie
libc_cv_z_execstack libc_cv_z_execstack
@ -6703,6 +6704,24 @@ $as_echo "$libc_cv_hashstyle" >&6; }
fi 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 "$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; } $as_echo_n "checking for -fno-toplevel-reorder -fno-section-anchors... " >&6; }
if ${libc_cv_fno_toplevel_reorder+:} false; then : if ${libc_cv_fno_toplevel_reorder+:} false; then :

View File

@ -1803,6 +1803,17 @@ EOF
AC_SUBST(libc_cv_hashstyle) AC_SUBST(libc_cv_hashstyle)
fi 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 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
cat > conftest.c <<EOF cat > conftest.c <<EOF
int foo; int foo;