[PATCH] D42748: [ELF] Don't create a .dynamic section when linking with -Bstatic
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 21 20:21:31 PDT 2019
MaskRay added a comment.
>From the description
> This also causes a .dynamic section, the _DYNAMIC symtbol and a PT_DYNAMIC header to be added to the output file. This causes problems for example when trying to run such a binary on FreeBSD MIPS.
What I know is just that the presence of `_DYNAMIC` caused a problem but I don't have more information why it caused the problem. Without more information I can only conjecture. My intuition says it is more likely a problem if the dynamic is absent in some scenarios, I don't understand how the presence (though probably unexpected by you) caused a problem.
> Perhaps first you should define what features of static binaries you depend on. In fact PT_INTERP is not absolutely needed to have any of the dynamic feature, in principle rtld.c can be linked from crt1.o. And if we (FreeBSD) decide to support dlopen(3) from static binaries, this is what would happen. We already got a small dynamic linker in crt1.o to support ifunc relocations.
>
> Absence of the DYNAMIC segment is rather good indication that a lot of dynamic features are indeed not used, so &_DYNAMIC == 0 is probably quite good check except that it is broken.
@kib So to answer your question, I need more information.
> And if we (FreeBSD) decide to support dlopen(3) from static binaries
And if you decide to support static pie, you also need `_DYNAMIC`.
Repository:
rLLD LLVM Linker
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D42748/new/
https://reviews.llvm.org/D42748
More information about the llvm-commits
mailing list