This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] x86-64: Resolve R_X86_64_PLT32 referencing a local symbol even if defined in another section


> (begin story
>
> I taught clang to emit a call insn referencing a local symbol if the
> symbol is defined in the same translation unit. This can avoid unneeded
> PLT if the object file is linked with -shared.
>
> .globl foo
> foo:
> .Lfoo$local:
> ...
>   call .Lfoo$local
> end story)

clang traditionally only supported -fno-semantic-interposition. This
local symbol optimization can avoid unneeded PLT costs in a -shared
link, in case someone argues why clang is allowed to break "ELF
semantics".
(-fPIC -fsemantic-interposition will correctly emit call foo)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]