Skip to contentSkip to conversation

Make the segment base match pinned section address

PATCH Superseded Khem Raj 1 participant 1 message Sep 4, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 Make the segment base match pinned section address

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

---
 kexec_test/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kexec_test/Makefile +1 -1
index fec6210..f9fa92c 100644
@@ -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)