From 71a4e86718b1aaa2d2adf6c4e5acc26e773bde79 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Sun, 12 Jan 2025 15:06:39 +0800 Subject: [PATCH] risc-v/Toolchain.defs: guard -r in LDELFFLAGS This guards use of `-r` in LDELFFLAGS in risc-v common/Toolchain.defs so that it is only used when BINFMT_ELF_RELOCATABLE is selected. Signed-off-by: Yanfeng Liu --- arch/risc-v/src/common/Toolchain.defs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index 5873608a74..b5f5be1c31 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -433,7 +433,12 @@ LDMODULEFLAGS = -r -T $(call CONVERT_PATH,$(TOPDIR)/libs/libc/modlib/gnu-elf.ld) CELFFLAGS = $(CFLAGS) -fvisibility=hidden CXXELFFLAGS = $(CXXFLAGS) -fvisibility=hidden -LDELFFLAGS = -r -e main +LDELFFLAGS = -e main + +ifeq ($(CONFIG_BINFMT_ELF_RELOCATABLE),y) + LDELFFLAGS += -r +endif + ifeq ($(CONFIG_ARCH_RV32),y) LDELFFLAGS += --oformat elf32-littleriscv else