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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 2 15:03:28 PST 2017


ruiu added a comment.

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.

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.


https://reviews.llvm.org/D29391





More information about the llvm-commits mailing list