summaryrefslogtreecommitdiff
path: root/test/InterfaceStubs/externstatic.c
blob: 832b4b3aaf8acac621c0100815a36cb9a20feda5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// REQUIRES: x86-registered-target
// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \
// RUN: -emit-interface-stubs \
// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-EXTERN %s
// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN %s

// RUN: %clang -DSTORAGE="extern" -target x86_64-unknown-linux-gnu -o - \
// RUN: -emit-interface-stubs \
// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-EXTERN2 %s
// RUN: %clang -DSTORAGE="extern" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-EXTERN2 %s

// RUN: %clang -DSTORAGE="static" -target x86_64-unknown-linux-gnu -o - \
// RUN: -emit-interface-stubs \
// RUN: -interface-stub-version=experimental-yaml-elf-v1 -std=c99 -xc %s | \
// RUN: FileCheck -check-prefix=CHECK-STATIC %s
// RUN: %clang -DSTORAGE="static" -target x86_64-linux-gnu -O0 -o - -c -std=c99 \
// RUN: -xc %s | llvm-nm - 2>&1 | FileCheck -check-prefix=CHECK-STATIC %s

// CHECK-EXTERN-NOT: foo
// CHECK-STATIC-NOT: foo
// CHECK-STATIC-NOT: bar

// We want to emit extern function symbols.
// CHECK-EXTERN2: bar
STORAGE int foo;
STORAGE int bar() { return 42; }