This is an archive of the discontinued LLVM Phabricator instance.

[asan] LIT: Add lld testing config.
AbandonedPublic

Authored by lebedev.ri on Dec 13 2017, 1:51 AM.

Details

Summary

A follow-up for D40768/D39508, with address sanitizer changes.

There is a problem:

$ ninja check-asan check-asan-dynamic
[34/37] Running the AddressSanitizer tests with dynamic runtime
FAIL: AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/asan_prelink_test.cc (242 of 1042)
******************** TEST 'AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/asan_prelink_test.cc' FAILED ********************
Script:
--
/build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan -c /build/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp.o
/build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan -DBUILD_SO=1 -fPIC -shared /build/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp.so -Wl,-Ttext-segment=0x3600000000 ||    /build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan -DBUILD_SO=1 -fPIC -shared /build/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp.so -Wl,-Ttext=0x3600000000
/build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp.o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp.so -Wl,-R. -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp
env ASAN_OPTIONS=verbosity=1  /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/asan_prelink_test.cc.tmp 2>&1 | FileCheck /build/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc
--
Exit Code: 1

Command Output (stderr):
--
clang-6.0: warning: argument unused during compilation: '-fuse-ld=lld' [-Wunused-command-line-argument]
/build/compiler-rt/test/asan/TestCases/Linux/asan_prelink_test.cc:29:11: error: expected string not found in input
// CHECK: SO mapped at 3600000000
          ^
<stdin>:6:49: note: scanning from here
|| `[0x003000000000, 0x004fffffffff]` || MidMem ||
                                                ^
<stdin>:28:82: note: possible intended match here
==9921==ERROR: AddressSanitizer: SEGV on unknown address 0x000000002056 (pc 0x000000002056 bp 0x000000000001 sp 0x7fff3f230a88 T0)
                                                                                 ^

--
                                                                                                                                                                                                                                                                               
********************                                                                                                                                                                                                                                                           
FAIL: AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/globals-gc-sections-lld.cc (255 of 1042)
******************** TEST 'AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/globals-gc-sections-lld.cc' FAILED ********************
Script:
--
/build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan /build/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cc -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/globals-gc-sections-lld.cc.tmp -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=0
/build/llvm-build-Clang-release/./bin/clang  --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only  -m64 -fuse-ld=lld  -shared-libasan /build/compiler-rt/test/asan/TestCases/Linux/globals-gc-sections-lld.cc -o /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig/TestCases/Linux/Output/globals-gc-sections-lld.cc.tmp -Wl,--gc-sections -fuse-ld=lld -ffunction-sections -fdata-sections -mllvm -asan-globals=1
--
Exit Code: 1

Command Output (stderr):
--
/build/llvm-build-Clang-release/./bin/ld.lld: error: undefined symbol: undefined()
>>> referenced by globals-gc-sections-lld.cc
>>>               /tmp/lit_tmp_M8f31s/globals-gc-sections-lld-83f60d.o:(unused)
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)

--

********************
Testing Time: 55.96s
********************
Failing Tests (2):
    AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/asan_prelink_test.cc
    AddressSanitizer-lld-x86_64-linux-dynamic :: TestCases/Linux/globals-gc-sections-lld.cc

  Expected Passes    : 766
  Expected Failures  : 2
  Unsupported Tests  : 272
  Unexpected Failures: 2
[35/37] Generating default/Asan-x86_64-inline-Test
FAILED: projects/compiler-rt/test/asan/CMakeFiles/check-asan-dynamic 
cd /build/llvm-build-Clang-release/projects/compiler-rt/test/asan && /usr/bin/python2.7 /build/llvm-build-Clang-release/./bin/llvm-lit -sv /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/X86_64LinuxConfig /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/LLDX86_64LinuxConfig /build/llvm-build-Clang-release/projects/compiler-rt/test/asan/Unit/dynamic
ninja: build stopped: subcommand failed.

Diff Detail

Event Timeline

lebedev.ri created this revision.Dec 13 2017, 1:51 AM
Herald added subscribers: Restricted Project, mgorny, kubamracek. · View Herald TranscriptDec 13 2017, 1:51 AM
vitalybuka added inline comments.Dec 14 2017, 10:03 AM
test/asan/lit.site.cfg.in
12

Why just asan? can we go for entire compiler-rt?

lebedev.ri added inline comments.Dec 14 2017, 10:08 AM
test/asan/lit.site.cfg.in
12

I'm not sure what you mean. This is per-sanitizer-config option.
I.e. there is a clang lit config, and a clang lit config with LLD. (and later, with LTO)
I'm not sure how to do that for the entire compiler-rt.

vitalybuka added inline comments.Dec 14 2017, 10:32 AM
test/asan/lit.site.cfg.in
12

I think we should put it into compiler-rt/test/lit.common.cfg and try to support the option by all sanitizes

lebedev.ri added inline comments.Dec 14 2017, 11:01 AM
test/asan/lit.site.cfg.in
12

That is great to know, but can you explain in a few more words, please? :)
For the reference, i'm modelling this after CFI - it has several lit configs, with lld&thinlto, just lld, just thinlto, etc.

vitalybuka added inline comments.Dec 14 2017, 11:17 AM
test/asan/CMakeLists.txt
124

so if complier rt has LLD we are going to run 2x+ as much tests?
cfi has small set of tests, but for entire compiler-rt could be noticeable.
@eugenis, any concerns?

125

if future you are going to add add_asan_testsuite(${arch} True True) call here, right?

test/asan/lit.site.cfg.in
12

please ignore my comment. I've checked patches from description. msan is already done this way

lebedev.ri added inline comments.Dec 14 2017, 11:39 AM
test/asan/CMakeLists.txt
124

so if complier rt has LLD we are going to run 2x+ as much tests?

I believe so. It has already caught one lld problem (see msan differential), and this diff shows something too.

cfi has small set of tests, but for entire compiler-rt could be noticeable.

Yes, see next comment.

125

Now this is an awesome question. No, i'm serious.
I don't know what will be the best course of action yet.
I do understand that simply mimicking cfi, and having all the combinations will just not work.
I think having something like this in the end may be the best compromise:

add_asan_testsuite(${arch} False False)
add_asan_testsuite(${arch} ${COMPILER_RT_HAS_LLD} True)

i.e. just two combinations - old plain simple; and lld if it is there + lto (thinlto if it is there)

test/asan/lit.site.cfg.in
12

msan is already done this way

And ubsan

vitalybuka accepted this revision.Dec 14 2017, 11:45 AM
This revision is now accepted and ready to land.Dec 14 2017, 11:45 AM
lebedev.ri abandoned this revision.Jun 21 2019, 8:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 21 2019, 8:49 AM