aboutsummaryrefslogtreecommitdiff
path: root/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-02 18:30:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-02 18:30:55 +0000
commit8d8e909cdc9f4e78e1e1600497d827e1acde6cea (patch)
treec8c6047827589e56f2ed1f77f23b1f7d1a10e793 /test/asan/TestCases/Linux/globals-gc-sections-lld.cc
parent2953104c9a262728031dc518429d15b969dd6028 (diff)
Notes
Diffstat (limited to 'test/asan/TestCases/Linux/globals-gc-sections-lld.cc')
-rw-r--r--test/asan/TestCases/Linux/globals-gc-sections-lld.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/asan/TestCases/Linux/globals-gc-sections-lld.cc b/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
new file mode 100644
index 000000000000..0d8bcdd1cb17
--- /dev/null
+++ b/test/asan/TestCases/Linux/globals-gc-sections-lld.cc
@@ -0,0 +1,15 @@
+// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=0
+// RUN: %clangxx_asan %s -o %t -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=1
+
+// https://code.google.com/p/address-sanitizer/issues/detail?id=260
+// REQUIRES: lld
+
+int undefined();
+
+// On i386 clang adds --export-dynamic when linking with ASan, which adds all
+// non-hidden globals to GC roots.
+__attribute__((visibility("hidden"))) int (*unused)() = undefined;
+
+int main() {
+ return 0;
+}