[cfe-dev] AddressSanitizer

Bryan Chan via cfe-dev cfe-dev at lists.llvm.org
Wed Oct 21 05:49:55 PDT 2020


Thanks Kostya, using Clang to build itself with ASan enabled, and running my
build container in privileged mode, helped solve a lot of the problems. But
I
now encounter a lot of link errors while testing my stage-2 build:

FAIL: libomp :: api/has_openmp.c (52345 of 54886)
******************** TEST 'libomp :: api/has_openmp.c' FAILED
********************
Script:
--
: 'RUN': at line 1';   /home/bryanpkc/llvm-project/build/./bin/clang
-fopenmp -pthread -fno-experimental-isel  -I
/home/bryanpkc/llvm-project/openmp/runtime/test -I
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/src -L
/home/bryanpkc/llvm-project/build/lib  -I /h
ome/bryanpkc/llvm-project/openmp/runtime/test/ompt
/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c -o
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
-lm -latomic &&
/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp
--
Exit Code: 1

Command Output (stdout):
--
$ ":" "RUN: at line 1"
$ "/home/bryanpkc/llvm-project/build/./bin/clang" "-fopenmp" "-pthread"
"-fno-experimental-isel" "-I"
"/home/bryanpkc/llvm-project/openmp/runtime/test" "-I"
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/src" "-L"
"/home/bryanpkc/llvm-project/build/lib" "-I"
"/home/bryanpkc/llvm-project/openmp/runtime/test/ompt"
"/home/bryanpkc/llvm-project/openmp/runtime/test/api/has_openmp.c" "-o"
"/home/bryanpkc/llvm-project/build/projects/openmp/runtime/test/api/Output/has_openmp.c.tmp"
"-lm" "-latomic"
# command stderr:
/usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined
reference to `__asan_load_cxx_array_cookie'
/usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined
reference to `__asan_set_shadow_f8'
/usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined
reference to `__asan_stack_malloc_8'
/usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined
reference to `__asan_stack_malloc_2'
/usr/bin/ld: /home/bryanpkc/llvm-project/build/lib/libomp.so: undefined
reference to `__asan_unregister_globals'

This type of failures are affecting multiple groups of tests:

Builtins-aarch64-linux :: *
LLVM :: tools/gold/X86/*
libomp :: *
libomptarget :: *

Any ideas? Could you point me to the build bot that has a good
Clang/LLVM/OpenMP
configuration with ASan enabled? Unfortunately the documentation at
https://llvm.org/docs/CMake.html is not clear on how to get this working.

--
Bryan


On Tue, Oct 20, 2020 at 12:33 PM Kostya Serebryany <kcc at google.com> wrote:

> Hi Bryan,
>
> Yes, building LLVM with GCC+ASAN is a warranty void zone.
> It can probably be made to work with some effort, but unless someone is
> willing to
> maintain a public bot with this build, it will remain unsupported.
>
> Building LLVM with LLVM+ASAN is fully supported, and the bots are
> maintained.
>
> thanks!
>
> --kcc
>
>
> On Tue, Oct 20, 2020 at 7:39 AM Bryan Chan via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hi lists,
>>
>> I am encountering a large number of check-clang failures after building
>> Clang/LLVM with -DLLVM_USE_SANITIZER=Address. I have reported the issue
>> on Bugzilla (https://bugs.llvm.org/show_bug.cgi?id=47678). I cannot even
>> compile helloworld.c with the resulting clang tool without a lot of false
>> positives from ASan. Is it because I am not supposed to use GCC's
>> AddressSanitizer when building Clang?
>>
>> --
>> Bryan
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201021/ad9e841a/attachment-0001.html>


More information about the cfe-dev mailing list