[PATCH] D34355: [LLD][ELF] Define _GLOBAL_OFFSET_TABLE_ to base of .got for ARM

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 10:16:11 PDT 2017


On Mon, Jun 19, 2017 at 9:59 AM, Rafael Avila de Espindola <
rafael.espindola at gmail.com> wrote:

> Peter Smith via Phabricator <reviews at reviews.llvm.org> writes:
>
> > peter.smith created this revision.
> > Herald added subscribers: kristof.beyls, javed.absar, aemerson.
> >
> > On many architectures gcc and clang will recognize _GLOBAL_OFFSET_TABLE_
> - . and produce a relocation that can be processed without needing to know
> the value of _GLOBAL_OFFSET_TABLE_. For ARM gcc produces R_ARM_BASE_PREL
> but clang produces the more general R_ARM_REL32 to _GLOBAL_OFFSET_TABLE_.
> To evaluate this relocation correctly _GLOBAL_OFFSET_TABLE_ must be defined
> to be the base of the GOT (R_ARM_BASE_PREL evaluates to this value).
> >
> > If/when llvm-mc is changed to recognize _GLOBAL_OFFSET_TABLE_ - . this
> change will not be necessary for new objects. However there may still be
> old objects and versions of clang so I think it is worth making the change
> in lld as well as fixing llvm-mc.
>
> I am currently working on fixing the issue in MC.
>
> This is not part of the documented ABI and I don't think we should do it
> unless there is an actual need by an user to keep an old .o file.
>

I'd agree.I'm conservative on implementing bug-compatibility as it allows
buggy programs to produce buggy outputs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170619/98dd8a5d/attachment.html>


More information about the llvm-commits mailing list