ET_EXEC uses image base of 0x400000, but the build forces
section VMAs like .text = 0x10000. LLD now errors when any
section address is below the image base unless you explicitly
set the base. (Older LLD tolerated it.)

To fix this, set the image base to match forced section addresses

Fixes
| x86_64-yoe-linux-ld.lld: error: section '.text' address (0x10000) is smaller 
than image base (0x400000); specify --image-base
| x86_64-yoe-linux-ld.lld: error: section '.bss' address (0x12000) is smaller 
than image base (0x400000); specify --image-base

Signed-off-by: Khem Raj <raj.k...@gmail.com>
---
 kexec_test/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kexec_test/Makefile b/kexec_test/Makefile
index fec6210..f9fa92c 100644
--- a/kexec_test/Makefile
+++ b/kexec_test/Makefile
@@ -31,7 +31,7 @@ $(KEXEC_TEST): CPPFLAGS+=-DRELOC=$(RELOC)
 $(KEXEC_TEST): ASFLAGS+=-m32
 #$(KEXEC_TEST): LDFLAGS=-m32 -Wl,-e -Wl,_start -Wl,-Ttext -Wl,$(RELOC) \
 #                     -nostartfiles
-$(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start -Ttext $(RELOC)
+$(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start --image-base=$(RELOC) -Ttext 
$(RELOC)
 
 $(KEXEC_TEST): $(KEXEC_TEST_OBJS)
        mkdir -p $(@D)

Reply via email to