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

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 9 13:50:35 PST 2017


Petr Hosek <phosek at google.com> writes:

> Rafael suggested using any section value other than SHN_ABS and SHN_UNDEF,
> but that means the symbol is going to have a section relative value which
> means the section must have the address 0x0. The only candidate I can think
> of is .shstrtab or creating a new synthetic section. It was my
> understanding that the purpose of SHN_ABS is to express that: symbols that
> are not relative to any other section. Those symbols exists, even in ET_DYN
> objects, e.g. _gp and _gp_disp on MIPS. This is also what Ian described in
> his blog post <http://www.airs.com/blog/archives/42> and it is the behavior
> that ld and gold implements.
>
> I'd really like to come up with an acceptable solution because we cannot
> currently link our C library with LLD as a consequence of this issue.

We could have a special symbol for the start of the object, but as Peter
pointed you you should be able to use

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

Is that not sufficient?

Cheers,
Rafael


More information about the llvm-commits mailing list