RISC-V: Re-enable -msave-restore for shared libraries.
authorJim Wilson <jimw@sifive.com>
Sat, 7 Sep 2019 00:09:21 +0000 (00:09 +0000)
committerJim Wilson <wilson@gcc.gnu.org>
Sat, 7 Sep 2019 00:09:21 +0000 (17:09 -0700)
This re-enables -msave-restore for shared libraries, and uses the
t-slibgcc-libgcc file to get the save-restore routines included directly
in shared libraries so that we don't need to indirect through the PLT
to reach them, which doesn't work.

gcc/
* config/riscv/riscv.c (riscv_option_override): Revert 2019-08-30
change.

libgcc/
* config.host (riscv*-*-linux*): Add t-slibgcc-libgcc to tmake_file.
(riscv*-*-freebsd*): Likewise.

From-SVN: r275478

gcc/ChangeLog
gcc/config/riscv/riscv.c
libgcc/ChangeLog
libgcc/config.host

index 91069bff50a10a2f15ac00d82acfd345687eae20..46c1b50346e5487f7876d5a886e05567e187f053 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-06  Jim Wilson  <jimw@sifive.com>
+
+       * config/riscv/riscv.c (riscv_option_override): Revert 2019-08-30
+       change.
+
 2019-09-06  Segher Boessenkool  <segher@kernel.crashing.org>
 
        * config/rs6000/rs6000.md (unspec): Delete UNSPEC_MV_CR_OV.
index 1e7528f1cb993601a07448ff7fb36434bf61d589..9b16a1eb9c2f5d50b9d5d7ba5c368ad521f3f63e 100644 (file)
@@ -4636,16 +4636,6 @@ riscv_option_override (void)
     error ("%<-mriscv-attribute%> RISC-V ELF attribute requires GNU as 2.32"
           " [%<-mriscv-attribute%>]");
 #endif
-
-  /* The save-restore routines use t0 which is clobbered by the plt header,
-     so we can't use them when building shared libraries.  */
-  if (TARGET_SAVE_RESTORE && flag_pic && TARGET_PLT)
-    {
-      target_flags &= ~MASK_SAVE_RESTORE;
-      if (target_flags_explicit & MASK_SAVE_RESTORE)
-       warning (0, "%<-msave-restore%> disabled; not supported with PLT "
-                "based shared libraries");
-    }
 }
 
 /* Implement TARGET_CONDITIONAL_REGISTER_USAGE.  */
index 1ffb236add270c2341af9331f844d3f8f49b4ff2..df5d99684e6f498e7b9c384f92d7b4722cb6ba3e 100644 (file)
@@ -1,3 +1,8 @@
+2019-09-06  Jim Wilson  <jimw@sifive.com>
+
+       * config.host (riscv*-*-linux*): Add t-slibgcc-libgcc to tmake_file.
+       (riscv*-*-freebsd*): Likewise.
+
 2019-09-03  Ulrich Weigand  <uweigand@de.ibm.com>
 
        * config.host: Remove references to spu.
index a3976702ab5a4317f266f423faa4167ca2b7ba8e..1db52878a5ea8edc2840507f816c16f7fa717b02 100644 (file)
@@ -1201,12 +1201,12 @@ pru-*-*)
        tm_file="$tm_file pru/pru-abi.h"
        ;;
 riscv*-*-linux*)
-       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address}"
+       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
        extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
        md_unwind_header=riscv/linux-unwind.h
        ;;
 riscv*-*-freebsd*)
-       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address}"
+       tmake_file="${tmake_file} riscv/t-softfp${host_address} t-softfp riscv/t-elf riscv/t-elf${host_address} t-slibgcc-libgcc"
        extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
        ;;
 riscv*-*-*)