On Mon, Jul 19, 2021 at 1:53 PM Wende Tan <
twd...@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 <
twd...@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)
issues with regards to LTO. Can you please file a bug against LLVM