public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] riscv: Build with -mno-relax when lld is used
@ 2021-11-02 18:18 Adhemerval Zanella
  2021-11-02 18:59 ` H.J. Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2021-11-02 18:18 UTC (permalink / raw)
  To: libc-alpha, Fangrui Song

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Build with -mno-relax when lld is used
  2021-11-02 18:18 [PATCH] riscv: Build with -mno-relax when lld is used Adhemerval Zanella
@ 2021-11-02 18:59 ` H.J. Lu
  2021-11-02 19:06   ` Adhemerval Zanella
  0 siblings, 1 reply; 3+ messages in thread
From: H.J. Lu @ 2021-11-02 18:59 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library, Fangrui Song

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.

-- 
H.J.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] riscv: Build with -mno-relax when lld is used
  2021-11-02 18:59 ` H.J. Lu
@ 2021-11-02 19:06   ` Adhemerval Zanella
  0 siblings, 0 replies; 3+ messages in thread
From: Adhemerval Zanella @ 2021-11-02 19:06 UTC (permalink / raw)
  To: H.J. Lu; +Cc: GNU C Library, Fangrui Song



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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-02 19:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 18:18 [PATCH] riscv: Build with -mno-relax when lld is used Adhemerval Zanella
2021-11-02 18:59 ` H.J. Lu
2021-11-02 19:06   ` Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).