[PATCH] D116838: [ELF] -Map --why-extract=: print despite errors
Igor Kudrin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 12 00:49:38 PST 2022
ikudrin added inline comments.
================
Comment at: lld/ELF/LinkerScript.cpp:566-567
error("discarding " + s.name + " section is not allowed");
+ if (&s == mainPart->relrDyn.get())
+ mainPart->relrDyn.reset();
+ }
----------------
MaskRay wrote:
> ikudrin wrote:
> > There is no test that covers this change. And maybe it'll be better to fix the issue directly in `DynamicSection<ELFT>::computeContents()`?
> `discard-section-err.s` covers this. Without the change ``discard-section-err.s` segfaults.
Well, for some reason, it passed on Windows in the Release build.
When you look at the code without the knowledge of all other parts of the linker, it is a bit puzzling that `mainPart->relrDyn` is reset while `in.shStrTab` is not. It either deserves an explanatory comment or `in.shStrTab` should be cleared, too, so that the code looks more consistent. Or maybe both.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D116838/new/
https://reviews.llvm.org/D116838
More information about the llvm-commits
mailing list