[svsm-devel] Fwd: Stage1 loader linker issues while building coconut svsm

Carlos López clopez at suse.de
Wed Aug 30 21:01:19 CEST 2023


Hi,

On 30/8/23 20:03, Kalra, Ashish wrote:
> Getting this ld error while linking stage1 loader in coconut svsm:
> 
> # cc -c -o stage1/stage1.o stage1/stage1.S
> 
> # cc -o stage1/stage1 stage1/stage1.o stage1/reset.o -nostdlib 
> -Wl,--build-id=none -Wl,-Tstage1/stage1.lds
> 
> /usr/local/bin/ld: stage1/stage1.o: relocation R_X86_64_32 against 
> `.startup.text' can not be used when making a PIE object; recompile with 
> -fPIE
> /usr/local/bin/ld: failed to set dynamic section sizes: bad value
> 

This is a known issue with ld [0], I think it should work with ld 2.39.

> When i link with -no-pie, ld works fine.
> 
> The stage1 loader code looks to be doing all relative addressing, i 
> don't see any absolute addresses, compiling is not giving any issues 
> anyway.

Perhaps we should add it to stage1 for now. I had to do the same thing
for stage2 and the SVSM kernel in my latest PR [1] for everything to
work.

Best,
Carlos

[0] https://github.com/coconut-svsm/svsm/issues/72
[1] https://github.com/coconut-svsm/svsm/pull/81

-- 
Carlos López
Security Engineer
SUSE Software Solutions


More information about the Svsm-devel mailing list