
For a default visibility external linkage definition, dso_local is set for ELF -fno-pic/-fpie and COFF and Mach-O. Since default clang -cc1 for ELF is similar to -fpic ("PIC Level" is not set), this nuance causes unneeded binary format differences. To make emitted IR similar, ELF -cc1 -fpic will default to -fno-semantic-interposition, which sets dso_local for default visibility external linkage definitions. To make this flip smooth and enable future (dso_local as definition default), this patch replaces (function) `define ` with `define{{.*}} `, (variable/constant/alias) `= ` with `={{.*}} `, or inserts appropriate `{{.*}} `.
26 lines
1012 B
C
26 lines
1012 B
C
// Check the correct function attributes are generated
|
|
// RUN: %clang_cc1 -triple x86_64-linux -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
|
|
// RUN: %clang_cc1 -triple s390x-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
|
|
// RUN: %clang_cc1 -triple powerpc64le-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
|
|
// RUN: %clang_cc1 -triple powerpc64-linux-gnu -O0 -S -emit-llvm -o- %s -fstack-clash-protection | FileCheck %s
|
|
|
|
// CHECK: define{{.*}} void @large_stack() #[[A:.*]] {
|
|
void large_stack() {
|
|
volatile int stack[20000], i;
|
|
for (i = 0; i < sizeof(stack) / sizeof(int); ++i)
|
|
stack[i] = i;
|
|
}
|
|
|
|
// CHECK: define{{.*}} void @vla({{.*}}) #[[A:.*]] {
|
|
void vla(int n) {
|
|
volatile int vla[n];
|
|
__builtin_memset(&vla[0], 0, 1);
|
|
}
|
|
|
|
// CHECK: define{{.*}} void @builtin_alloca({{.*}}) #[[A:.*]] {
|
|
void builtin_alloca(int n) {
|
|
volatile void *mem = __builtin_alloca(n);
|
|
}
|
|
|
|
// CHECK: attributes #[[A]] = {{.*}} "probe-stack"="inline-asm"
|