From: Nathan Chancellor <nathan@kernel.org>
To: Khem Raj <raj.khem@gmail.com>,
linux-riscv@lists.infradead.org,
clang-built-linux@googlegroups.com
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: Re: [PATCH] riscv: Use -mno-relax when using lld linker
Date: Fri, 14 May 2021 14:14:37 -0700 [thread overview]
Message-ID: <bd8ae62f-1ead-2d82-5fdb-87308accc023@kernel.org> (raw)
In-Reply-To: <20210514205643.383422-1-raj.khem@gmail.com>
Hi Khem,
On 5/14/2021 1:56 PM, Khem Raj wrote:
> lld does not implement the RISCV relaxation optimizations like GNU ld
> therefore disable it when building with LLVM=1, Also pass it to
> assembler when using external GNU assembler ( LLVM_IAS != 1 ), this
> ensures that relevant assembler option is also enabled along. if these
> options are not used then we see following relocations in objects
>
> 0000000000000000 R_RISCV_ALIGN *ABS*+0x0000000000000002
>
> These are then rejected by lld
> ld.lld: error: capability.c:(.fixup+0x0): relocation R_RISCV_ALIGN requires unimplemented linker relaxation; recompile with -mno-relax but the .o is already compiled with -mno-relax
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> Cc: Paul Walmsley <paul.walmsley@sifive.com>
> Cc: Palmer Dabbelt <palmer@dabbelt.com>
> Cc: Albert Ou <aou@eecs.berkeley.edu>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Nick Desaulniers <ndesaulniers@google.com>
Thank you for the patch! I can build a ARCH=riscv defconfig kernel with
LLVM=1 now. LLVM_IAS=1 still needs work but we have outstanding issues
for that:
https://github.com/ClangBuiltLinux/linux/issues/1023
https://github.com/ClangBuiltLinux/linux/issues/1143
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
One comment below though.
> ---
> arch/riscv/Makefile | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
> index 3eb9590a0775..519f133e0d53 100644
> --- a/arch/riscv/Makefile
> +++ b/arch/riscv/Makefile
> @@ -38,6 +38,15 @@ else
> KBUILD_LDFLAGS += -melf32lriscv
> endif
>
> +ifeq ($(LLVM),1)
ifeq ($(CONFIG_LD_IS_LLD),y)
is a better choice so that LD=riscv64-linux-gnu-ld LLVM=1 can still work.
> + KBUILD_CFLAGS += -mno-relax
> + KBUILD_AFLAGS += -mno-relax
> +ifneq ($(LLVM_IAS),1)
> + KBUILD_CFLAGS += -Wa,-mno-relax
> + KBUILD_AFLAGS += -Wa,-mno-relax
> +endif
> +endif
> +
> # ISA string setting
> riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
> riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
>
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-05-14 21:14 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 20:56 [PATCH] riscv: Use -mno-relax when using lld linker Khem Raj
2021-05-14 21:14 ` Nathan Chancellor [this message]
2021-05-14 21:14 ` Fāng-ruì Sòng
2021-05-29 18:40 ` Palmer Dabbelt
2021-05-29 18:42 ` Palmer Dabbelt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bd8ae62f-1ead-2d82-5fdb-87308accc023@kernel.org \
--to=nathan@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=clang-built-linux@googlegroups.com \
--cc=linux-riscv@lists.infradead.org \
--cc=ndesaulniers@google.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=raj.khem@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox