[PATCH users/roland/riscv64-elf-shared] ld: Don't disable -shared / -pie support for riscv*-elf

Liao Shihua shihua@iscas.ac.cn
Mon Aug 19 12:12:20 GMT 2024


Hi, Roland

I saw this question had been discussed in 
https://github.com/riscv-collab/riscv-gnu-toolchain/issues/803 and 
https://github.com/riscvarchive/riscv-binutils-gdb/pull/130

It seems like this is to circumvent a series of LD test suite failures.

After your patch, it would be a lot of LD test suite failures for 
riscv*-elf targets, is that the case?

Best Regards,

Liao Shihua

在 2024/8/16 10:16, Roland McGrath 写道:
> [The following patch is on the branch users/roland/riscv64-elf-shared and it
> should be easier to use that than to paste this patch.]
>
> I use aarch64-elf and x86_64-elf targets in -shared and -pie modes
> now, and
> have need to use riscv64-elf in the same way.  I can't see any good
> rationale for defeaturing any generic target like this, let alone for
> being
> inconsistent across otherwise similar *-elf targets.
>
> Ok for trunk?
>
> Thanks,
> Roland
>
> ----
>
> Author: Roland McGrath<mcgrathr@google.com>
> Date:   Thu Aug 15 19:09:14 2024 -0700
>
>      ld: Don't disable -shared / -pie support for riscv*-elf
>
>      Other *-elf targets support -shared and -pie modes.  There is no
>      reason to presuppose that riscv64-elf is used for "embedded", nor
>      for that matter that "embedded" is mutually exclusive with
>      wanting -shared and -pie functionality available in the linker.
>
> diff --git a/ld/emulparams/elf32lriscv-defs.sh
> b/ld/emulparams/elf32lriscv-defs.sh
> index 016556168c3..5c0dac2af8b 100644
> --- a/ld/emulparams/elf32lriscv-defs.sh
> +++ b/ld/emulparams/elf32lriscv-defs.sh
> @@ -16,15 +16,8 @@ if test `echo "$host" | sed -e s/64//` = `echo
> "$target" | sed -e s/64//`; then
>     esac
>   fi
>
> -# Enable shared library support for everything except an embedded elf
> target.
> -case "$target" in
> -  riscv*-elf)
> -    ;;
> -  *)
> -    GENERATE_SHLIB_SCRIPT=yes
> -    GENERATE_PIE_SCRIPT=yes
> -    ;;
> -esac
> +GENERATE_SHLIB_SCRIPT=yes
> +GENERATE_PIE_SCRIPT=yes
>
>   IREL_IN_PLT=
>   TEXT_START_ADDR=0x10000
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://sourceware.org/pipermail/binutils/attachments/20240819/1a798405/attachment.htm>


More information about the Binutils mailing list