summaryrefslogtreecommitdiff
path: root/test/InterfaceStubs/externstatic.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/InterfaceStubs/externstatic.c')
-rw-r--r--test/InterfaceStubs/externstatic.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/InterfaceStubs/externstatic.c b/test/InterfaceStubs/externstatic.c
new file mode 100644
index 0000000000..9224581ee0
--- /dev/null
+++ b/test/InterfaceStubs/externstatic.c
@@ -0,0 +1,29 @@
+// 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; }