[PATCH] D32887: [ELF] Emit __ehdr_start when there is a segment containing program headers
Roland McGrath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 9 15:56:19 PDT 2017
mcgrathr added a comment.
For the record, the intent of __ehdr_start is exactly that it be defined if and only if the ELF file header and program headers are indeed visible via some PT_LOAD segment (i.e. in the PAGE_TRUNCATE(p_vaddr)..PAGE_ROUND(p_vaddr + p_filesz) region) and not be defined otherwise.
I invented the feature in the GNU linkers, and this is the specification I gave it.
Code can use a weak reference to __ehdr_start and check for &__ehdr_start==0 to handle both cases. For that scenario, resolving it to absolute 0 even when there is a strong reference rather than diagnosing the undefined symbol is probably acceptable in practice.
In LLD, the only time it could ever be omitted is when there is a custom linker script being used. So this is unlikely to come up.
Repository:
rL LLVM
https://reviews.llvm.org/D32887
More information about the llvm-commits
mailing list