[llvm-branch-commits] [lld] Discard SHT_LLVM_LTO sections in relocatable links (PR #92825)
Fangrui Song via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 20 22:13:06 PDT 2024
================
@@ -832,6 +832,15 @@ void ObjFile<ELFT>::initializeSections(bool ignoreComdats,
this->sections[i] =
createInputSection(i, sec, check(obj.getSectionName(sec, shstrtab)));
break;
+ case SHT_LLVM_LTO:
+ // When doing a relocatable link with FatLTO objects, if we're not using
+ // the bitcode, discard it, since it will be concatenated together when
+ // handling orphan sections, and which will be an invalid bitcode object.
+ if (config->relocatable && !config->fatLTOObjects) {
+ sections[i] = &InputSection::discarded;
+ break;
+ }
+ LLVM_FALLTHROUGH;
----------------
MaskRay wrote:
`[[fallthrough]]` since C++17
https://github.com/llvm/llvm-project/pull/92825
More information about the llvm-branch-commits
mailing list