Skip to content

Commit dee18dd

Browse files
authored
Merge pull request #3249 from compnerd/gadget-gadget
Target: explicitly handle `.swift1_autolink_entries`
2 parents 3bbb427 + d0f00c4 commit dee18dd

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,8 @@ static MCSection *selectExplicitSectionGlobal(
761761
StringRef Group = "";
762762
bool IsComdat = false;
763763
unsigned Flags = getELFSectionFlags(Kind);
764+
if (SectionName == ".swift1_autolink_entries")
765+
Flags |= ELF::SHF_EXCLUDE;
764766
if (const Comdat *C = getELFComdat(GO)) {
765767
Group = C->getName();
766768
IsComdat = C->getSelectionKind() == Comdat::Any;

llvm/lib/Target/TargetLoweringObjectFile.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ SectionKind TargetLoweringObjectFile::getKindForGlobal(const GlobalObject *GO,
215215
// Global variables require more detailed analysis.
216216
const auto *GVar = cast<GlobalVariable>(GO);
217217

218+
if (GVar->getSection() == ".swift1_autolink_entries")
219+
return SectionKind::getMetadata();
220+
218221
// Handle thread-local data first.
219222
if (GVar->isThreadLocal()) {
220223
if (isSuitableForBSS(GVar) && !TM.Options.NoZerosInBSS) {

0 commit comments

Comments
 (0)