[PATCH] D26133: [ELF] Allow relative relocations to absolute symbols in PIC

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 13 09:06:00 PST 2016

On Dec 13, 2016 05:42, "Rafael Avila de Espindola" <
rafael.espindola at gmail.com> wrote:

> Hi Rafael,
> I found some discussion on the binutils bug tracker and mailing list
> https://sourceware.org/bugzilla/show_bug.cgi?id=14052
> https://sourceware.org/ml/binutils/2012-05/msg00023.html
> It looks like the conclusion to be drawn is that BFD's behaviour is wrong.

Thank you so much. We should deferentially not copy the bug then.

If we want a way to refer to the image base from linker script I propose
a new magic variable: IMAGE_BASE.

Should this not work for referring to the image base?

ADDR(.interp) - ABSOLUTE(ADDR(.interp))

The advantage is that this avoids creating new syntax so is already
somewhat compatible with existing linkers. The downside is that you need to
specify a section, but in practice you can usually choose one that is known
to exist.

I don't think we currently create a section relative symbol from that, but
that's just a bug we can fix.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161213/36477186/attachment.html>

More information about the llvm-commits mailing list