bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/31795] ld.bfd makes ELFs of type ET_EXEC for static PIEs when lo


From: mintsuki at protonmail dot com
Subject: [Bug ld/31795] ld.bfd makes ELFs of type ET_EXEC for static PIEs when load address is non-0
Date: Sun, 26 May 2024 14:07:01 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=31795

--- Comment #21 from mintsuki <mintsuki at protonmail dot com> ---
(In reply to H.J. Lu from comment #20)
> It turns out that static PIE with non-zero load address must have ET_EXEC:
> 
> https://sourceware.org/bugzilla/show_bug.cgi?id=31799
> 
> Otherwise, there is no way for loader to tell if the dynamic section entries
> contain the relocated values for the load address or not.  Since static PIE
> with non-zero load address must have ET_EXEC, PIE with non-zero load address
> also should have ET_EXEC.
> 
> BTW, gold doesn't support static PIE and static PIE with non-zero load
> address
> generated by lld crashes with the fix glibc.

At least in the context of making a kernel, gold does generate a static-pie, at
least as printed out by the file command, and the output of readelf -a looks
similar to ld.bfd's -static -pie generation, even without the -static part.

I assume this is because no other dynamic libraries are linked in when using
-nostdlib and not specifying any dynamic library explicitly.

I do not know what the problem with glibc is, but static-pie kernels loaded by
Limine with a non-0 load address (or shared objects with a non-0 load address
for that matter) work perfectly fine if relocated (at or above whatever
specified non-0 load address).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]