[PATCH] D41592: [ELF] - Add missing dynamic tags when producing output with IRelative relocations only.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 29 10:34:28 PST 2017


grimar added inline comments.


================
Comment at: ELF/SyntheticSections.cpp:1090
+  // .rel[a].plt section.
+  if (InX::RelaPlt->getParent()->Live) {
     addInSec(DT_JMPREL, InX::RelaPlt);
----------------
emaste wrote:
> The previous code checked that getParent() was not null; why is it no longer necessary?
I believe it was not necessary.
We always add this section to output for non-scripted case (and then remove as it is empty synthetic in `removeUnusedSyntheticSections`).
For scripted case we disallow discarding rel[a] sections (https://github.com/llvm-mirror/lld/blob/master/ELF/LinkerScript.cpp#L293) and so
I believe always add it as orphan and then, again, remove it in `removeUnusedSyntheticSections`.
So I believe it is always have parent set.

I am not sure we have testcase showing we ignore discarding .rela.plt. I can double check above (just in case) and add this testcase, 
if it is missing, tomorrow.


https://reviews.llvm.org/D41592





More information about the llvm-commits mailing list