Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
A gvisor developer reported that .rela.dyn cannot be discarded. I find that supporting .rela.dyn does not even need extra code, so let's do it. We can support .relr.dyn as well, but it may need more work, so I don't include it in this patch.
// SyntheticSections.cpp addSize(config->useAndroidRelrTags ? DT_ANDROID_RELRSZ : DT_RELRSZ, part.relrDyn->getParent()); // If .relr.dyn is allowed to be discarded, part.relrDyn->getParent() will be null and part.relrDyn->getParent()->size will dereference a null pointer.
Note, there is a difference lld and GNU ld. To suppress .rela.dyn with GNU ld, /DISCARD/ : { *(.rela.data) } should be used instead. I feel that the lld way is more consistent. Sections such as .dynsym, .dynstr and .dynamic are synthesized sections, and they are discarded with an input section description *(.dynsym). It is inconsistent for *(.rela.dyn) not to discard .rela.dyn in GNU ld. It may be unimplemented, though.