https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100593

--- Comment #5 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Hm, I still don't think I'm misunderstanding what you're saying. I'm familiar
with the ELF standard (and FWIW I have read your blog posts on related
matters). I am responding to this sentiment from the opening comment:

> I believe ld -Bsymbolic-functions can materialize most of the savings other
> implementations provide, without introducing complex things to ELF.
> However, since -Bsymbolic-functions doesn't play well with -fno-pic's
> canonical PLT entries, we should fix -fno-pic.

I am saying that fixing -fno-pic is not the only possible way forward. Rather,
a restricted -Bsymbolic-functions that relaxes relocations that are not
address-significant allows to still get some (but not all) of the benefits for
unchanged -fno-pic executables.

> You misunderstand this. Emitting GOT-generating relocation in -fno-pic mode
> is the only way to avoid canonical PLT entry, if the function turns out to
> be defined in a shared object. No -Bsymbolic variant can make this
> compatible.

Well, if you frame the goal as "eliminate canonical PLT entries", then yes, but
that in itself surely is not the end goal? The end goals are reducing startup
time (which my idea helps only partially since it may bind direct calls but not
e.g. vtable definitions) and runtime overheads (where again my proposal is
weaker but not significantly so, assuming address loads are rarely on hot
paths).


To clarify once more. I am not outright rejecting the idea in your opening
comment. I am saying that there potentially is a lighter-weight alternative,
which may be implementable purely in the linker, and still gets most of the
benefit you're promoting (like in your Clang example). Which is nice, because
it can be rolled out sooner, individual libraries/distros/users can opt-in and
experiment as they like, etc.

Reply via email to