[llvm-branch-commits] [compiler-rt] 1408087 - [test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize-address-globals-dead-stripping

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Dec 6 11:16:02 PST 2020


Author: Fangrui Song
Date: 2020-12-06T11:11:15-08:00
New Revision: 140808768d3e5c0f4e52dd42094650f5d282e34a

URL: https://github.com/llvm/llvm-project/commit/140808768d3e5c0f4e52dd42094650f5d282e34a
DIFF: https://github.com/llvm/llvm-project/commit/140808768d3e5c0f4e52dd42094650f5d282e34a.diff

LOG: [test] Fix asan/TestCases/Linux/globals-gc-sections-lld.cpp with -fsanitize-address-globals-dead-stripping

r302591 dropped -fsanitize-address-globals-dead-stripping for ELF platforms
(to work around a gold<2.27 bug: https://sourceware.org/bugzilla/show_bug.cgi?id=19002)

Upgrade REQUIRES: from lto (COMPILER_RT_TEST_USE_LLD (set by Android, but rarely used elsewhere)) to lto-available.

Added: 
    

Modified: 
    compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
index f6edc7032018..24dd1ae5b208 100644
--- a/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
+++ b/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cpp
@@ -1,10 +1,11 @@
-// 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
+/// Without instrumenting globals, --gc-sections drops the undefined symbol.
+// RUN: %clangxx_asan %s -o /dev/null -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=0
+/// With -fsanitize-address-globals-dead-stripping and -fdata-sections, a garbage
+/// collectable custom metadata section is used for instrumented globals.
+// RUN: %clangxx_asan %s -o /dev/null -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -fsanitize-address-globals-dead-stripping
 
-// https://code.google.com/p/address-sanitizer/issues/detail?id=260
-// REQUIRES: lld
-// FIXME: This may pass on Android, with non-emulated-tls.
-// XFAIL: android
+// https://github.com/google/sanitizers/issues/260
+// REQUIRES: lld-available
 int undefined();
 
 // On i386 clang adds --export-dynamic when linking with ASan, which adds all


        


More information about the llvm-branch-commits mailing list