[PATCH] D29391: [ELF] - Postpone the evaluation of DefinedSynthetic value

Rafael Avila de Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 11:12:21 PST 2017


Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:

> This linker script defines symbol A. All output sections are orphan sections and laid out using the default layout rules. IIUC, what you said is symbol A should be defined relative to an orphan section that happens to become the first section of the output. I wonder why. I think symbol A should be defined relative to the image base instead of relative to some section. In other words, symbol A shouldn't belong to any section.

So, ELF has no "image base" value.  There is ABS, UNDEF or regular
section. If it is convenient we can internally represent something as
being image base, but for output we have to use a dummy section
number. It is really not important what number we use. IMHO it is a pity
that executable and shared libraries have a section table and that
symbols refer to them.


> In general, any symbol that is not inside an output section description should be defined relative to the image base. I.e.
>
>   SECTIONS { A = . }
>
> is defined relative to the image base, while
>
>   SECTIONS { .foo : { A = . } }
>
> is defined relative to section .foo.

One way that might isolate the problem is to treat

SECTIONS { A = . }

as

SECTIONS { .aether : { A = . } }

Cheers,
Rafael


More information about the llvm-commits mailing list