Closed lancethepants closed 2 years ago
Note: I think this works as intended, since there is no need to make -static --dynamic-linker non-orthogonal. GNU ld does have the behavior, because it uses complex conditions to decide whether PT_INTERP is created, but there is no need for behavior match in practice. Consider adding -Wl,--no-dynamic-linker
explicitly.
Closing this as working-as-intended as per @MaskRay's comment.
For my project I have several arguments in LDFLAGS including
Wl,--dyanmic-linker
because the root filesystem for this project lives in a non-standard directory.https://github.com/lancethepants/tomatoware/blob/master/scripts/environment.sh#L11
On occasion I will also append
-static
to LDFLAGS when I want a particular binary to be built statically. Under bfd and gold this is no problem. They build the static binary and I guess just discards theWl,--dyanmic-linker
portion. With mold I will get a Segmentation fault.readelf shows there is no dynamic section.
file shows that it is a static binary, but also shows the interpreter which is odd. bfd & gold do not show the interpreter portion.
lld exhibits the same behavior as mold. Will probably repot this to them as well.
I know they are conflicting arguments, but I think bfd and gold are correct to create a static binary and discard the dynamic linker bit.