riscv: Build with -mno-relax when lld is used
Checks
Context |
Check |
Description |
dj/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
dj/TryBot-32bit |
success
|
Build for i686
|
Commit Message
It allows build both glibc and tests with lld (Since lld does not
support R_RISCV_ALIGN linker relaxation).
Checked with a build for riscv32-linux-gnu-rv32imafdc-ilp32d and
riscv64-linux-gnu-rv64imafdc-lp64d.
---
sysdeps/riscv/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
Comments
On Tue, Nov 2, 2021 at 11:19 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> It allows build both glibc and tests with lld (Since lld does not
> support R_RISCV_ALIGN linker relaxation).
>
> Checked with a build for riscv32-linux-gnu-rv32imafdc-ilp32d and
> riscv64-linux-gnu-rv64imafdc-lp64d.
> ---
> sysdeps/riscv/Makefile | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
> index 20a9968106..53e2b86b2a 100644
> --- a/sysdeps/riscv/Makefile
> +++ b/sysdeps/riscv/Makefile
> @@ -5,3 +5,10 @@ endif
> # RISC-V's assembler also needs to know about PIC as it changes the definition
> # of some assembler macros.
> ASFLAGS-.os += $(pic-ccflag)
> +
> +# lld does not implement R_RISCV_ALIGN relaxation optimization.
> +ifeq (yes,$(with-lld))
> +ASFLAGS-.os += -Wa,-mno-relax
> +ASFLAGS-.o += -Wa,-mno-relax
> +sysdep-CFLAGS += -mno-relax
> +endif
> --
> 2.32.0
>
We should check feature support in linker, not linker.
On 02/11/2021 15:59, H.J. Lu wrote:
> On Tue, Nov 2, 2021 at 11:19 AM Adhemerval Zanella via Libc-alpha
> <libc-alpha@sourceware.org> wrote:
>>
>> It allows build both glibc and tests with lld (Since lld does not
>> support R_RISCV_ALIGN linker relaxation).
>>
>> Checked with a build for riscv32-linux-gnu-rv32imafdc-ilp32d and
>> riscv64-linux-gnu-rv64imafdc-lp64d.
>> ---
>> sysdeps/riscv/Makefile | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/sysdeps/riscv/Makefile b/sysdeps/riscv/Makefile
>> index 20a9968106..53e2b86b2a 100644
>> --- a/sysdeps/riscv/Makefile
>> +++ b/sysdeps/riscv/Makefile
>> @@ -5,3 +5,10 @@ endif
>> # RISC-V's assembler also needs to know about PIC as it changes the definition
>> # of some assembler macros.
>> ASFLAGS-.os += $(pic-ccflag)
>> +
>> +# lld does not implement R_RISCV_ALIGN relaxation optimization.
>> +ifeq (yes,$(with-lld))
>> +ASFLAGS-.os += -Wa,-mno-relax
>> +ASFLAGS-.o += -Wa,-mno-relax
>> +sysdep-CFLAGS += -mno-relax
>> +endif
>> --
>> 2.32.0
>>
>
> We should check feature support in linker, not linker.
>
Fair enough, I will update the patch.
@@ -5,3 +5,10 @@ endif
# RISC-V's assembler also needs to know about PIC as it changes the definition
# of some assembler macros.
ASFLAGS-.os += $(pic-ccflag)
+
+# lld does not implement R_RISCV_ALIGN relaxation optimization.
+ifeq (yes,$(with-lld))
+ASFLAGS-.os += -Wa,-mno-relax
+ASFLAGS-.o += -Wa,-mno-relax
+sysdep-CFLAGS += -mno-relax
+endif