[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
Sat Dec 30 00:51:03 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);
----------------
grimar wrote:
> 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.
I committed NFC change removing checking for null:
https://reviews.llvm.org/rL321581

Also can confirm we silently ignore scripts like:
```
/DISCARD/ : { *(.rela.plt)
/DISCARD/ : { *(.rela.dyn)
```

Patch for that is D41640


https://reviews.llvm.org/D41592





More information about the llvm-commits mailing list