// Symbols in a non-prevailing COMDAT group which should be changed to an
// Undefined.
SmallVector<std::pair<Symbol *, unsigned>, 0> nonPrevailingSyms;
+ // True if SHT_LLVM_SYMPART is used.
+ std::atomic<bool> hasSympart{false};
};
// The only instance of Ctx struct.
{
llvm::TimeTraceScope timeScope("Strip sections");
- llvm::erase_if(inputSections, [](InputSectionBase *s) {
- if (s->type == SHT_LLVM_SYMPART) {
+ if (ctx->hasSympart.load(std::memory_order_relaxed)) {
+ llvm::erase_if(inputSections, [](InputSectionBase *s) {
+ if (s->type != SHT_LLVM_SYMPART)
+ return false;
invokeELFT(readSymbolPartitionSection, s);
return true;
- }
+ });
+ }
+ // We do not want to emit debug sections if --strip-all
+ // or --strip-debug are given.
+ if (config->strip != StripPolicy::None) {
+ llvm::erase_if(inputSections, [](InputSectionBase *s) {
+ if (isDebugSection(*s))
+ return true;
+ if (auto *isec = dyn_cast<InputSection>(s))
+ if (InputSectionBase *rel = isec->getRelocatedSection())
+ if (isDebugSection(*rel))
+ return true;
- // We do not want to emit debug sections if --strip-all
- // or --strip-debug are given.
- if (config->strip == StripPolicy::None)
return false;
-
- if (isDebugSection(*s))
- return true;
- if (auto *isec = dyn_cast<InputSection>(s))
- if (InputSectionBase *rel = isec->getRelocatedSection())
- if (isDebugSection(*rel))
- return true;
-
- return false;
- });
+ });
+ }
}
// Since we now have a complete set of input files, we can create
//===----------------------------------------------------------------------===//
#include "InputFiles.h"
+#include "Config.h"
#include "DWARF.h"
#include "Driver.h"
#include "InputSection.h"
case SHT_RELA:
case SHT_NULL:
break;
+ case SHT_LLVM_SYMPART:
+ ctx->hasSympart.store(true, std::memory_order_relaxed);
+ LLVM_FALLTHROUGH;
default:
this->sections[i] =
createInputSection(i, sec, check(obj.getSectionName(sec, shstrtab)));