diff mbox series

riscv: Build with -mno-relax when lld is used

Message ID 20211102181846.1305353-1-adhemerval.zanella@linaro.org
State New
Headers show
Series riscv: Build with -mno-relax when lld is used | expand

Commit Message

Adhemerval Zanella Nov. 2, 2021, 6:18 p.m. UTC
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

H.J. Lu Nov. 2, 2021, 6:59 p.m. UTC | #1
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.
Adhemerval Zanella Nov. 2, 2021, 7:06 p.m. UTC | #2
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.
diff mbox series

Patch

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