Rafael, this change is causing problems. Apple’s linker needs to see labels in the __ustring sections, and with this change, the ustring labels are local to the assembler and never seen at link-time. Please revert this. We can investigate getting the linker to relax that constraint in the future, but it doesn’t work now.
On Jan 20, 2014, at 6:57 PM, Rafael Espindola <[email protected]> wrote: > Author: rafael > Date: Mon Jan 20 20:57:56 2014 > New Revision: 199709 > > URL: http://llvm.org/viewvc/llvm-project?rev=199709&view=rev > Log: > Use private linkage for utf-16 objc strings too. > > Modified: > cfe/trunk/lib/CodeGen/CodeGenModule.cpp > cfe/trunk/test/CodeGen/darwin-string-literals.c > cfe/trunk/test/CodeGen/utf16-cfstrings.c > cfe/trunk/test/CodeGenObjC/2009-08-05-utf16.m > cfe/trunk/test/CodeGenObjC/2010-02-01-utf16-with-null.m > > Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=199709&r1=199708&r2=199709&view=diff > ============================================================================== > --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original) > +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Mon Jan 20 20:57:56 2014 > @@ -2378,18 +2378,11 @@ CodeGenModule::GetAddrOfConstantCFString > C = llvm::ConstantDataArray::getString(VMContext, Entry.getKey()); > } > > - llvm::GlobalValue::LinkageTypes Linkage; > - if (isUTF16) > - // FIXME: why do utf strings get "_" labels instead of "L" labels? > - Linkage = llvm::GlobalValue::InternalLinkage; > - else > - Linkage = llvm::GlobalValue::PrivateLinkage; > - > // Note: -fwritable-strings doesn't make the backing store strings of > // CFStrings writable. (See <rdar://problem/10657500>) > llvm::GlobalVariable *GV = > - new llvm::GlobalVariable(getModule(), C->getType(), /*isConstant=*/true, > - Linkage, C, ".str"); > + new llvm::GlobalVariable(getModule(), C->getType(), > /*isConstant=*/true, > + llvm::GlobalValue::PrivateLinkage, C, ".str"); > GV->setUnnamedAddr(true); > // Don't enforce the target's minimum global alignment, since the only use > // of the string is via this class initializer. > > Modified: cfe/trunk/test/CodeGen/darwin-string-literals.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/darwin-string-literals.c?rev=199709&r1=199708&r2=199709&view=diff > ============================================================================== > --- cfe/trunk/test/CodeGen/darwin-string-literals.c (original) > +++ cfe/trunk/test/CodeGen/darwin-string-literals.c Mon Jan 20 20:57:56 2014 > @@ -2,16 +2,16 @@ > > // CHECK-LSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00" > // CHECK-LSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00" > -// CHECK-LSB: @.str2 = internal unnamed_addr constant [18 x i16] [i16 104, > i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 > 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], > section "__TEXT,__ustring", align 2 > -// CHECK-LSB: @.str4 = internal unnamed_addr constant [6 x i16] [i16 116, > i16 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", > align 2 > +// CHECK-LSB: @.str2 = private unnamed_addr constant [18 x i16] [i16 104, > i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 > 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], > section "__TEXT,__ustring", align 2 > +// CHECK-LSB: @.str4 = private unnamed_addr constant [6 x i16] [i16 116, i16 > 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", align 2 > > > // RUN: %clang_cc1 -triple powerpc-apple-darwin9 -emit-llvm %s -o - | > FileCheck -check-prefix CHECK-MSB %s > > // CHECK-MSB: @.str = private unnamed_addr constant [8 x i8] c"string0\00" > // CHECK-MSB: @.str1 = private unnamed_addr constant [8 x i8] c"string1\00" > -// CHECK-MSB: @.str2 = internal unnamed_addr constant [18 x i16] [i16 104, > i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 > 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], > section "__TEXT,__ustring", align 2 > -// CHECK-MSB: @.str4 = internal unnamed_addr constant [6 x i16] [i16 116, > i16 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", > align 2 > +// CHECK-MSB: @.str2 = private unnamed_addr constant [18 x i16] [i16 104, > i16 101, i16 108, i16 108, i16 111, i16 32, i16 8594, i16 32, i16 9731, i16 > 32, i16 8592, i16 32, i16 119, i16 111, i16 114, i16 108, i16 100, i16 0], > section "__TEXT,__ustring", align 2 > +// CHECK-MSB: @.str4 = private unnamed_addr constant [6 x i16] [i16 116, i16 > 101, i16 115, i16 116, i16 8482, i16 0], section "__TEXT,__ustring", align 2 > > const char *g0 = "string0"; > const void *g1 = __builtin___CFStringMakeConstantString("string1"); > > Modified: cfe/trunk/test/CodeGen/utf16-cfstrings.c > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/utf16-cfstrings.c?rev=199709&r1=199708&r2=199709&view=diff > ============================================================================== > --- cfe/trunk/test/CodeGen/utf16-cfstrings.c (original) > +++ cfe/trunk/test/CodeGen/utf16-cfstrings.c Mon Jan 20 20:57:56 2014 > @@ -1,7 +1,7 @@ > // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck > %s > // <rdar://problem/10655949> > > -// CHECK: @.str = internal unnamed_addr constant [9 x i16] [i16 252, i16 98, > i16 101, i16 114, i16 104, i16 117, i16 110, i16 100, i16 0], section > "__TEXT,__ustring", align 2 > +// CHECK: @.str = private unnamed_addr constant [9 x i16] [i16 252, i16 98, > i16 101, i16 114, i16 104, i16 117, i16 110, i16 100, i16 0], section > "__TEXT,__ustring", align 2 > > #define CFSTR __builtin___CFStringMakeConstantString > > > Modified: cfe/trunk/test/CodeGenObjC/2009-08-05-utf16.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/2009-08-05-utf16.m?rev=199709&r1=199708&r2=199709&view=diff > ============================================================================== > --- cfe/trunk/test/CodeGenObjC/2009-08-05-utf16.m (original) > +++ cfe/trunk/test/CodeGenObjC/2009-08-05-utf16.m Mon Jan 20 20:57:56 2014 > @@ -1,5 +1,5 @@ > // RUN: %clang_cc1 -emit-llvm -w -x objective-c %s -o - | FileCheck %s > // rdar://7095855 rdar://7115749 > > -// CHECK: internal unnamed_addr constant [6 x i16] [i16 105, i16 80, i16 > 111, i16 100, i16 8482, i16 0], section "__TEXT,__ustring", align 2 > +// CHECK: private unnamed_addr constant [6 x i16] [i16 105, i16 80, i16 111, > i16 100, i16 8482, i16 0], section "__TEXT,__ustring", align 2 > void *P = @"iPodâ¢"; > > Modified: cfe/trunk/test/CodeGenObjC/2010-02-01-utf16-with-null.m > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/2010-02-01-utf16-with-null.m?rev=199709&r1=199708&r2=199709&view=diff > ============================================================================== > --- cfe/trunk/test/CodeGenObjC/2010-02-01-utf16-with-null.m (original) > +++ cfe/trunk/test/CodeGenObjC/2010-02-01-utf16-with-null.m Mon Jan 20 > 20:57:56 2014 > @@ -1,7 +1,7 @@ > // RUN: %clang_cc1 -triple i686-apple-darwin -emit-llvm %s -o - | FileCheck %s > // rdar://7589850 > > -// CHECK: @.str = internal unnamed_addr constant [9 x i16] [i16 103, i16 > 111, i16 111, i16 100, i16 0, i16 98, i16 121, i16 101, i16 0], section > "__TEXT,__ustring", align 2 > +// CHECK: @.str = private unnamed_addr constant [9 x i16] [i16 103, i16 111, > i16 111, i16 100, i16 0, i16 98, i16 121, i16 101, i16 0], section > "__TEXT,__ustring", align 2 > // CHECK: @_unnamed_cfstring_ = private constant %struct.NSConstantString { > i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, > i32 0, i32 0), i32 2000, i8* bitcast ([9 x i16]* @.str to i8*), i32 8 }, > section "__DATA,__cfstring" > // CHECK: @P = global i8* bitcast (%struct.NSConstantString* > @_unnamed_cfstring_ to i8*), align 4 > void *P = @"good\0bye"; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
