Use v2 map syntax in libgcc-unwind.map if Solaris ld supports it

* configure.ac (solaris_ld_v2_maps): New test.
	* configure: Regenerate.
	* Makefile.in (solaris_ld_v2_maps): New variable.
	* config/t-slibgcc-sld (libgcc-unwind.map): Emit v2 mapfile syntax
	if supported.

From-SVN: r264382
This commit is contained in:
Rainer Orth 2018-09-18 07:04:15 +00:00 committed by Rainer Orth
parent e6bf23cce3
commit 53c6feb2b2
5 changed files with 56 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2018-09-18 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (solaris_ld_v2_maps): New test.
* configure: Regenerate.
* Makefile.in (solaris_ld_v2_maps): New variable.
* config/t-slibgcc-sld (libgcc-unwind.map): Emit v2 mapfile syntax
if supported.
2018-08-23 Richard Earnshaw <rearnsha@arm.com>
PR target/86951

View File

@ -44,6 +44,7 @@ enable_vtable_verify = @enable_vtable_verify@
enable_decimal_float = @enable_decimal_float@
fixed_point = @fixed_point@
with_aix_soname = @with_aix_soname@
solaris_ld_v2_maps = @solaris_ld_v2_maps@
enable_execute_stack = @enable_execute_stack@
unwind_header = @unwind_header@
md_unwind_header = @md_unwind_header@

View File

@ -8,12 +8,23 @@ ifeq ($(enable_shared),yes)
# Linker mapfile to enforce direct binding to libgcc_s unwinder
# (PR target/59788).
# Emit v2 mapfile syntax if possible, otherwise ld -z guidance complains
# every time the mapfile is used.
libgcc-unwind.map: libgcc-std.ver
ifeq ($(solaris_ld_v2_maps),yes)
@(echo '$$mapfile_version 2'; \
echo "SYMBOL_SCOPE {"; \
for f in `grep _Unwind_ $< | sort`; do \
echo " $$f { FLAGS = EXTERN DIRECT };"; \
done; \
echo "};" ) > $@
else
@(echo "{"; \
for f in `grep _Unwind_ $< | sort`; do \
echo " $$f = EXTERN DIRECT;"; \
done; \
echo "};" ) > $@
endif
# Copy libgcc-unwind.map to the place where gcc will look for it at build-time.
install-libgcc-unwind-map-forbuild: libgcc-unwind.map

21
libgcc/configure vendored
View File

@ -570,6 +570,7 @@ sfp_machine_header
set_use_emutls
set_have_cc_tls
vis_hide
solaris_ld_v2_maps
real_host_noncanonical
accel_dir_suffix
force_explicit_eh_registry
@ -5176,6 +5177,26 @@ EOF
;;
esac
# Check if Solaris linker support v2 linker mapfile syntax.
# Link with -nostartfiles -nodefaultlibs since neither are present while
# building libgcc.
case ${host} in
*-*-solaris2*)
solaris_ld_v2_maps=no
echo 'int main(void) {return 0;}' > conftest.c
echo '$mapfile_version 2' > conftest.map
if { ac_try='${CC-cc} -nostartfiles -nodefaultlibs -Wl,-M,conftest.map -o conftest conftest.c 1>&5'
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
(eval $ac_try) 2>&5
ac_status=$?
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }; }; then
solaris_ld_v2_maps=yes
fi
;;
esac
# Check if xtensa target is configured for windowed ABI and thus needs to use
# custom unwind code.
# This is after config.host so we can augment tmake_file.

View File

@ -459,6 +459,21 @@ EOF
;;
esac
# Check if Solaris linker support v2 linker mapfile syntax.
# Link with -nostartfiles -nodefaultlibs since neither are present while
# building libgcc.
case ${host} in
*-*-solaris2*)
solaris_ld_v2_maps=no
echo 'int main(void) {return 0;}' > conftest.c
echo '$mapfile_version 2' > conftest.map
if AC_TRY_COMMAND([${CC-cc} -nostartfiles -nodefaultlibs -Wl,-M,conftest.map -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
solaris_ld_v2_maps=yes
fi
;;
esac
AC_SUBST(solaris_ld_v2_maps)
# Check if xtensa target is configured for windowed ABI and thus needs to use
# custom unwind code.
# This is after config.host so we can augment tmake_file.