[llvm] r221431 - Allow L symbols in no_dead_strip sections.

Rafael Espindola rafael.espindola at gmail.com
Wed Nov 5 18:42:03 PST 2014


Author: rafael
Date: Wed Nov  5 20:42:03 2014
New Revision: 221431

URL: http://llvm.org/viewvc/llvm-project?rev=221431&view=rev
Log:
Allow L symbols in no_dead_strip sections.

If a section cannot be dead stripped, it is safe to use L symbols, since
the linker will keep all of it in the end.

Modified:
    llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
    llvm/trunk/test/CodeGen/X86/osx-private-labels.ll

Modified: llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp?rev=221431&r1=221430&r2=221431&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetLoweringObjectFileImpl.cpp Wed Nov  5 20:42:03 2014
@@ -588,6 +588,10 @@ bool TargetLoweringObjectFileMachO::isSe
         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;

Modified: llvm/trunk/test/CodeGen/X86/osx-private-labels.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/osx-private-labels.ll?rev=221431&r1=221430&r2=221431&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/osx-private-labels.ll (original)
+++ llvm/trunk/test/CodeGen/X86/osx-private-labels.ll Wed Nov  5 20:42:03 2014
@@ -69,3 +69,8 @@
 ; CHECK: .section	__DATA,__foobar,interposing
 ; CHECK-NEXT: .align	3
 ; CHECK-NEXT: L_private12:
+
+ at 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:





More information about the llvm-commits mailing list