From: twd2 <twd2.me@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: palmer@dabbelt.com, paul.walmsley@sifive.com,
aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org,
clang-built-linux@googlegroups.com,
Masahiro Yamada <masahiroy@kernel.org>,
Kees Cook <keescook@chromium.org>
Subject: Re: [PATCH 1/3] RISC-V: build: Pass `-mattr` to `lld`
Date: Thu, 22 Jul 2021 16:23:46 +0800 [thread overview]
Message-ID: <8a21bac5-2445-2d4f-3639-8660285a626b@gmail.com> (raw)
In-Reply-To: <CAKwvOdmNji0AbYUiOSfb5cLD+g7YCpXk4oDupa8gTfgzYmxvBg@mail.gmail.com>
Thanks for your advice. After some investigations, I find minimal code
that can reproduce the issue I have had. The bug is filed at
https://bugs.llvm.org/show_bug.cgi?id=51161.
Thanks.
Wende
On 2021/7/20 5:14, Nick Desaulniers wrote:
> On Mon, Jul 19, 2021 at 1:53 PM Wende Tan <twd2.me@gmail.com> wrote:
>> Pass `-mattr` to `lld` so that it can generate proper machine code.
>> By the way, it seems that `-march` does not work well now.
>>
>> Signed-off-by: Wende Tan <twd2.me@gmail.com>
>> ---
>> arch/riscv/Makefile | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
>> index bc74afdbf31e..bbc186a3ab45 100644
>> --- a/arch/riscv/Makefile
>> +++ b/arch/riscv/Makefile
>> @@ -52,9 +52,16 @@ riscv-march-$(CONFIG_ARCH_RV32I) := rv32ima
>> riscv-march-$(CONFIG_ARCH_RV64I) := rv64ima
>> riscv-march-$(CONFIG_FPU) := $(riscv-march-y)fd
>> riscv-march-$(CONFIG_RISCV_ISA_C) := $(riscv-march-y)c
>> +riscv-mattr-y := +m,+a
>> +riscv-mattr-$(CONFIG_FPU) := $(riscv-mattr-y),+f,+d
>> +riscv-mattr-$(CONFIG_RISCV_ISA_C) := $(riscv-mattr-y),+c
>> KBUILD_CFLAGS += -march=$(subst fd,,$(riscv-march-y))
>> KBUILD_AFLAGS += -march=$(riscv-march-y)
>>
>> +ifeq ($(CONFIG_LD_IS_LLD),y)
>> + KBUILD_LDFLAGS += -mllvm -mattr=$(riscv-mattr-y)
> We should prevent the proliferation of the compiler internal `-mllvm`
> flags from Kbuild Makefiles; these are indicative of LLVM IR specific
> issues with regards to LTO. Can you please file a bug against LLVM
> that `-mattr` should be encoded in the IR for LTO's sake?
>
> See also:
> commit 0236526d76b8 ("Makefile: lto: Pass -warn-stack-size only on LLD
> < 13.0.0")
> commit 2398ce80152a ("x86, lto: Pass -stack-alignment only on LLD < 13.0.0")
>
>> +endif
>> +
>> KBUILD_CFLAGS += -mno-save-restore
>> KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
>>
>> --
>
> --
> Thanks,
> ~Nick Desaulniers
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2021-07-22 8:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-19 20:52 [PATCH 1/3] RISC-V: build: Pass `-mattr` to `lld` Wende Tan
2021-07-19 21:14 ` Nick Desaulniers
2021-07-22 8:23 ` twd2 [this message]
2021-07-27 20:22 ` Nick Desaulniers
2021-08-04 20:59 ` Palmer Dabbelt
2021-08-05 20:12 ` twd2
2021-08-05 20:18 ` Fāng-ruì Sòng
2021-08-05 21:05 ` twd2
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=8a21bac5-2445-2d4f-3639-8660285a626b@gmail.com \
--to=twd2.me@gmail.com \
--cc=aou@eecs.berkeley.edu \
--cc=clang-built-linux@googlegroups.com \
--cc=keescook@chromium.org \
--cc=linux-riscv@lists.infradead.org \
--cc=masahiroy@kernel.org \
--cc=ndesaulniers@google.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.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