diff --git a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index c7570ba76e1..6944f71105b 100644 --- a/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -588,6 +588,10 @@ bool TargetLoweringObjectFileMachO::isSectionAtomizableBySymbols( SMO.getSectionName() == "__cfstring") return false; + // no_dead_strip sections are not atomized in practice. + if (SMO.hasAttribute(MachO::S_ATTR_NO_DEAD_STRIP)) + return false; + switch (SMO.getType()) { default: return true; diff --git a/test/CodeGen/X86/osx-private-labels.ll b/test/CodeGen/X86/osx-private-labels.ll index 349ce7d0cc5..7e176442d29 100644 --- a/test/CodeGen/X86/osx-private-labels.ll +++ b/test/CodeGen/X86/osx-private-labels.ll @@ -69,3 +69,8 @@ ; CHECK: .section __DATA,__foobar,interposing ; CHECK-NEXT: .align 3 ; CHECK-NEXT: L_private12: + +@private13 = private global i32 42, section "__DATA, __objc_classlist, regular, no_dead_strip" +; CHECK: .section __DATA,__objc_classlist,regular,no_dead_strip +; CHECK-NEXT: .align 2 +; CHECK-NEXT: L_private13: