All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] RISC-V: build: Pass `-mattr` to `lld`
@ 2021-07-19 20:52 Wende Tan
  2021-07-19 21:14 ` Nick Desaulniers
  0 siblings, 1 reply; 8+ messages in thread
From: Wende Tan @ 2021-07-19 20:52 UTC (permalink / raw)
  To: palmer, paul.walmsley, aou, linux-riscv; +Cc: Wende Tan, clang-built-linux

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)
+endif
+
 KBUILD_CFLAGS += -mno-save-restore
 KBUILD_CFLAGS += -DCONFIG_PAGE_OFFSET=$(CONFIG_PAGE_OFFSET)
 
-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2021-08-05 21:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.