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

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 03:02:37 PST 2017


grimar added a comment.

In https://reviews.llvm.org/D29391#665264, @ruiu wrote:

> What I do not understand is why symbols outside an output section description should belong to an output section. Let's use this extremely simple linker script as an example.
>
>   SECTIONS { A = . }
>   
>
> 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 it means you assume it should be absolute, ri

> 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.

I think Rafael wrote about the same situation in https://reviews.llvm.org/D28857 thread (18 jan):
"That is a bug in bfd. Its handling of what is absolute is broken. On ELF
absolute really means absolute, like a size. Anything that is a position
in the file is not absolute."

and

"The difference is that the '.' makes it a position in the file, and
therefore not absolute."

And patch where it was implemented was: https://reviews.llvm.org/D26161


https://reviews.llvm.org/D29391





More information about the llvm-commits mailing list