diff options
-rw-r--r-- | lld/lib/ReaderWriter/ELF/DefaultLayout.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lld/lib/ReaderWriter/ELF/DefaultLayout.h b/lld/lib/ReaderWriter/ELF/DefaultLayout.h index 13d2f5c1946..e457821320d 100644 --- a/lld/lib/ReaderWriter/ELF/DefaultLayout.h +++ b/lld/lib/ReaderWriter/ELF/DefaultLayout.h @@ -435,11 +435,12 @@ DefaultLayout<ELFT>::getOutputSectionName(StringRef archivePath, StringRef memberPath, StringRef inputSectionName) const { StringRef outputSectionName; - if (_linkerScriptSema.hasLayoutCommands() && - !(outputSectionName = _linkerScriptSema.getOutputSection( - {archivePath, memberPath, inputSectionName})).empty()) - return outputSectionName; - + if (_linkerScriptSema.hasLayoutCommands()) { + script::Sema::SectionKey key = {archivePath, memberPath, inputSectionName}; + outputSectionName = _linkerScriptSema.getOutputSection(key); + if (!outputSectionName.empty()) + return outputSectionName; + } return llvm::StringSwitch<StringRef>(inputSectionName) .StartsWith(".text", ".text") .StartsWith(".ctors", ".ctors") |