For a definition (of most linkage types), dso_local is set for ELF -fno-pic/-fpie
and COFF, but not for Mach-O. This nuance causes unneeded binary format differences.
This patch replaces (function) `define ` with `define{{.*}} `,
(variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `
if there is an explicit linkage.
* Clang will set dso_local for Mach-O, which is currently implied by TargetMachine.cpp. This will make COFF/Mach-O and executable ELF similar.
* Eventually I hope we can make dso_local the textual LLVM IR default (write explicit "dso_preemptable" when applicable) and -fpic ELF will be similar to everything else. This patch helps move toward that goal.
24 lines
1.2 KiB
C
24 lines
1.2 KiB
C
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
|
|
|
|
void test0() {
|
|
// CHECK-LABEL: define{{.*}} void @test0()
|
|
// CHECK: [[F:%.*]] = alloca float
|
|
// CHECK-NEXT: [[REAL:%.*]] = load volatile float, float* getelementptr inbounds ({ float, float }, { float, float }* @test0_v, i32 0, i32 0), align 4
|
|
// CHECK-NEXT: load volatile float, float* getelementptr inbounds ({{.*}} @test0_v, i32 0, i32 1), align 4
|
|
// CHECK-NEXT: store float [[REAL]], float* [[F]], align 4
|
|
// CHECK-NEXT: ret void
|
|
extern volatile _Complex float test0_v;
|
|
float f = (float) test0_v;
|
|
}
|
|
|
|
void test1() {
|
|
// CHECK-LABEL: define{{.*}} void @test1()
|
|
// CHECK: [[REAL:%.*]] = load volatile float, float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0), align 4
|
|
// CHECK-NEXT: [[IMAG:%.*]] = load volatile float, float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1), align 4
|
|
// CHECK-NEXT: store volatile float [[REAL]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 0), align 4
|
|
// CHECK-NEXT: store volatile float [[IMAG]], float* getelementptr inbounds ({{.*}} @test1_v, i32 0, i32 1), align 4
|
|
// CHECK-NEXT: ret void
|
|
extern volatile _Complex float test1_v;
|
|
test1_v = test1_v;
|
|
}
|