On Mon, Mar 10, 2025 at 11:33 AM Fangrui Song <i...@maskray.me> wrote:
> >> (lld has a quite simple model where undefined non-weak and undefined > >> weak symbols are handled in a unified way. > >> A symbol is preemptible if: > >> > >> * -shared or at least one input file is DSO, and > >> * the symbol is undefined or exported (to .dynsym due to > >> --export-dynamic/--dynamic-list/referenced by DSO/etc), and > >> * other conditions that the symbol is preemptible > >> > >> Then, a preemptible symbol might need a PLT and associated JUMP_SLOT > >> relocation.) > > Thanks for the example! I see that the branch target is now more > meaningful after the patch. > Thanks for the detailed description of lld's behavior for reference. The behavior described above from you is the main purpose of this patch, so that when "at least one input file is DSO but --no-pie", undefined weak and non-weak symbols for call will also be preemptible and go to plt. Palmer and I were having a hard time figuring out how to describe this problem in short... Thanks for helping us out :-) Nelson