mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-29 00:08:59 -04:00

Without them they can be merged with non unnamed_addr constants during LTO. The resulting constant is not unnamed_addr and goes in a different section, which causes ld64 to crash. A testcase that would crash before: * file1.mm: void g(id notification) { [notification valueForKey:@"name"]; } * file2.cpp: extern const char js_name_str[] = "name"; * file3.cpp extern bool JS_GetProperty(const char *name); extern const char js_name_str[]; bool js_ReportUncaughtException() { JS_GetProperty(js_name_str); } run clang file1.mm -o file1.o -c -w -emit-llvm clang file2.cpp -o file2.o -c -w -emit-llvm clang file3.cpp -o file3.o -c -w ld -dylib -o XUL file1.o file2.o file3.o -undefined dynamic_lookup. llvm-svn: 199688
17 lines
634 B
Objective-C
17 lines
634 B
Objective-C
// RUN: %clang_cc1 -emit-llvm -o %t %s
|
|
// RUN: FileCheck --check-prefix=CHECK-NEXT < %t %s
|
|
|
|
// Check that we set alignment 1 on the string.
|
|
//
|
|
// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", section "__TEXT,__cstring,cstring_literals", align 1
|
|
|
|
// RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o %t %s
|
|
// RUN: FileCheck --check-prefix=CHECK-GNU < %t %s
|
|
// CHECK-GNU: NXConstantString
|
|
|
|
// RUN: %clang_cc1 -fobjc-runtime=gcc -fconstant-string-class NSConstantString -emit-llvm -o %t %s
|
|
// RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s
|
|
// CHECK-GNU-WITH-CLASS: NSConstantString
|
|
id a = @"Hello World!";
|
|
|