[PATCH] D75149: [ELF] --orphan-handling=: don't warn/error for unused synthesized sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 25 16:03:44 PST 2020
MaskRay added inline comments.
================
Comment at: lld/ELF/LinkerScript.cpp:731
+void LinkerScript::processOrphanHandling() {
+ for (const InputSectionBase *sec : orphanSections) {
----------------
nickdesaulniers wrote:
> Bikeshed: needs a better name. `DiagnoseOrphanHandling` or `EnforceOrphanHandlingPolicy` or such. `process` doesn't make any modifications.
Thanks for the suggestions. I'll go with `diagnoseOrphanHandling`. (I considered `handleOrphanHandling` and thought it is silly.)
================
Comment at: lld/ELF/LinkerScript.cpp:732
+void LinkerScript::processOrphanHandling() {
+ for (const InputSectionBase *sec : orphanSections) {
+ StringRef name = getOutputSectionName(sec);
----------------
nickdesaulniers wrote:
> Consider returning early if the loop invariant `config->orphanHandling != OrphanHandlingPolicy::Error && config->orphanHandling != OrphanHandlingPolicy::Warn`.
I think the current code is more readable. (`config->orphanHandling != OrphanHandlingPolicy::Error && config->orphanHandling != OrphanHandlingPolicy::Warn` adds two extra lines.)
`if ... else if` makes it clear that there is the third choice (no diagnostics).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75149/new/
https://reviews.llvm.org/D75149
More information about the llvm-commits
mailing list