Don't emit global symbols into the (__TEXT,__ustring) section on Darwin. This
authorCharles Davis <cdavis@mines.edu>
Fri, 5 Mar 2010 22:28:45 +0000 (22:28 +0000)
committerCharles Davis <cdavis@mines.edu>
Fri, 5 Mar 2010 22:28:45 +0000 (22:28 +0000)
is a workaround for <rdar://problem/7672401/> (which I filed).

This let's us build Wine on Darwin, and it gets the Qt build there a little bit
further (so Doug says).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@97845 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/TargetLoweringObjectFileImpl.cpp
test/CodeGen/X86/global-sections.ll

index 47164f733f14dd77662a00ba8aeaa15a3ea5a492..3b3be5d9b1ad2743a9b03804a04cb3892ee54e33 100644 (file)
@@ -652,7 +652,7 @@ SelectSectionForGlobal(const GlobalValue *GV, SectionKind Kind,
 
   // FIXME: Alignment check should be handled by section classifier.
   if (Kind.isMergeable1ByteCString() ||
-      Kind.isMergeable2ByteCString()) {
+      (Kind.isMergeable2ByteCString() && !GV->hasExternalLinkage())) {
     if (TM.getTargetData()->getPreferredAlignment(
                                               cast<GlobalVariable>(GV)) < 32) {
       if (Kind.isMergeable1ByteCString())
index 1a7b5777ae8ac50cf7cdb1e85ff4602c10af0afa..d79c56bc4637c2c59d68023d3bd2c14f699543f8 100644 (file)
 
 @G8 = constant [4 x i16] [ i16 1, i16 2, i16 3, i16 0 ]
 
-; DARWIN:      .section        __TEXT,__ustring
+; DARWIN:      .section        __TEXT,__const
 ; DARWIN:      .globl _G8
 ; DARWIN: _G8:
 
 
 @G9 = constant [4 x i32] [ i32 1, i32 2, i32 3, i32 0 ]
 
-; DARWIN:      .section        __TEXT,__const
 ; DARWIN:      .globl _G9
 ; DARWIN: _G9: