[PATCH] D19040: Remove unnecessary load via GOT when accessing globals with PIE in x86_64

Sriraman Tallam via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 21 11:43:13 PDT 2016


On Thu, Apr 21, 2016 at 11:40 AM, H.J. Lu <hjl.tools at gmail.com> wrote:
> On Thu, Apr 21, 2016 at 11:33 AM, Reid Kleckner <rnk at google.com> wrote:
>
>> Basically, once you know you are looking at a symbol definition that will become part of an executable, the only thing that can replace it is another definition within the executable. The glibc loader does *not* appear to replace weak symbols in an executable with strong symbols from a DSO. I mistakenly thought it would work the same way the linker does, where strong symbols beat weak symbols.
>>
>
> Weak symbol rule only applies at link-time, not at run-time.

Right.  rnk@'s patch suggestion still holds though.  It is enough to
check if this is a definition for the linker when PIE is used. I
checked that rnk@'s suggestion passes all the tests. I will fix this
shortly.

>
>
> --
> H.J.


More information about the llvm-commits mailing list