From 53c6feb2b2621bdfe3415dd6f664283917817491 Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Tue, 18 Sep 2018 07:04:15 +0000 Subject: [PATCH] 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 --- libgcc/ChangeLog | 8 ++++++++ libgcc/Makefile.in | 1 + libgcc/config/t-slibgcc-sld | 11 +++++++++++ libgcc/configure | 21 +++++++++++++++++++++ libgcc/configure.ac | 15 +++++++++++++++ 5 files changed, 56 insertions(+) diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 8a350e14e0c..3a7602ff24c 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,11 @@ +2018-09-18 Rainer Orth + + * 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 PR target/86951 diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in index 0c5b264f717..0766de58500 100644 --- a/libgcc/Makefile.in +++ b/libgcc/Makefile.in @@ -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@ diff --git a/libgcc/config/t-slibgcc-sld b/libgcc/config/t-slibgcc-sld index 0b9539114e4..03c6a659551 100644 --- a/libgcc/config/t-slibgcc-sld +++ b/libgcc/config/t-slibgcc-sld @@ -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 diff --git a/libgcc/configure b/libgcc/configure index 090e5484131..f0b6116e192 100644 --- a/libgcc/configure +++ b/libgcc/configure @@ -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. diff --git a/libgcc/configure.ac b/libgcc/configure.ac index 9d0bbcaba86..5fcbac686f2 100644 --- a/libgcc/configure.ac +++ b/libgcc/configure.ac @@ -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. -- 2.30.2