Author: Fangrui Song Date: 2020-12-06T10:31:40-08:00 New Revision: dde44f488c454b71d77ac022642b8711a8c340ca
URL: https://github.com/llvm/llvm-project/commit/dde44f488c454b71d77ac022642b8711a8c340ca DIFF: https://github.com/llvm/llvm-project/commit/dde44f488c454b71d77ac022642b8711a8c340ca.diff LOG: [test] Fix asan/TestCases/Posix/lto-constmerge-odr.cpp when 'binutils_lto' is avaiable If COMPILER_RT_TEST_USE_LLD is not set, config.use_lld will be False. However, if feature 'binutils_lto' is available, lto_supported can still be True, but config.target_cflags will not get -fuse-ld=lld from config.lto_flags As a result, we may use clang -flto with system 'ld' which may not support the bitcode file, e.g. ld: error: /tmp/lto-constmerge-odr-44a1ee.o: Unknown attribute kind (70) (Producer: 'LLVM12.0.0git' Reader: 'LLVM 12.0.0git') // The system ld+LLVMgold.so do not support ATTR_KIND_MUSTPROGRESS (70). Just require lld-available and add -fuse-ld=lld. Added: Modified: compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp Removed: ################################################################################ diff --git a/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp b/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp index 9dc1397f6f0e..1370b5a8b136 100644 --- a/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/lto-constmerge-odr.cpp @@ -1,7 +1,9 @@ -// RUN: %clangxx_asan -O3 -flto %s -o %t +/// Instrumented globals are added to llvm.compiler.used, so LTO will not const +/// merge them (which will cause spurious ODR violation). +// RUN: %clangxx_asan -O3 -fuse-ld=lld -flto %s -o %t // RUN: %run %t 2>&1 -// REQUIRES: lto +// REQUIRES: lld-available, lto int main(int argc, const char * argv[]) { struct { long width, height; } a = {16, 16}; _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits