[lld] 048b16f - [ELF] Check --orphan-handling=place (default value) early
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sun Nov 29 12:36:35 PST 2020
Author: Fangrui Song
Date: 2020-11-29T12:36:27-08:00
New Revision: 048b16f7fbb745635b48d31ee957bb8865597606
URL: https://github.com/llvm/llvm-project/commit/048b16f7fbb745635b48d31ee957bb8865597606
DIFF: https://github.com/llvm/llvm-project/commit/048b16f7fbb745635b48d31ee957bb8865597606.diff
LOG: [ELF] Check --orphan-handling=place (default value) early
The function took 1% (161MiB clang) to 1.7% (an 4.9GiB executable) time.
Added:
Modified:
lld/ELF/LinkerScript.cpp
Removed:
################################################################################
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index a03e21c55503..5bb977d6882b 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -802,6 +802,8 @@ void LinkerScript::addOrphanSections() {
void LinkerScript::diagnoseOrphanHandling() const {
llvm::TimeTraceScope timeScope("Diagnose orphan sections");
+ if (config->orphanHandling == OrphanHandlingPolicy::Place)
+ return;
for (const InputSectionBase *sec : orphanSections) {
// Input SHT_REL[A] retained by --emit-relocs are ignored by
// computeInputSections(). Don't warn/error.
@@ -812,7 +814,7 @@ void LinkerScript::diagnoseOrphanHandling() const {
StringRef name = getOutputSectionName(sec);
if (config->orphanHandling == OrphanHandlingPolicy::Error)
error(toString(sec) + " is being placed in '" + name + "'");
- else if (config->orphanHandling == OrphanHandlingPolicy::Warn)
+ else
warn(toString(sec) + " is being placed in '" + name + "'");
}
}
More information about the llvm-commits
mailing list