-
-
Couldn't load subscription status.
- Fork 226
Closed
Description
Hi,
I'm trying to build VLC using asan, and it seems that all C++ modules are failing to link when building with ASAN. As far as I can see, there's no issue with C modules.
I've reproduce the issue with the attached sample program:
test.zip
It works fine when building the program & lib as C, but it fails when building as C++:
root@compile-vlc-llvm-mingw:/tmp/test# make
/bin/bash ./libtool --tag=CXX --mode=compile x86_64-w64-mingw32-g++ -DPACKAGE_NAME=\"test\" -DPACKAGE_TARNAME=\"test\" -DPACKAGE_VERSION=\"0.0.0-dev\" -DPACKAGE_STRING=\"test\ 0.0.0-dev\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"test\" -DVERSION=\"0.0.0-dev\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -fsanitize=address -g -O2 -MT libtest_la-libtest.lo -MD -MP -MF .deps/libtest_la-libtest.Tpo -c -o libtest_la-libtest.lo `test -f 'libtest.cpp' || echo './'`libtest.cpp
libtool: compile: x86_64-w64-mingw32-g++ -DPACKAGE_NAME=\"test\" -DPACKAGE_TARNAME=\"test\" -DPACKAGE_VERSION=\"0.0.0-dev\" "-DPACKAGE_STRING=\"test 0.0.0-dev\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"test\" -DVERSION=\"0.0.0-dev\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -I. -fsanitize=address -g -O2 -MT libtest_la-libtest.lo -MD -MP -MF .deps/libtest_la-libtest.Tpo -c libtest.cpp -DDLL_EXPORT -DPIC -o .libs/libtest_la-libtest.o
mv -f .deps/libtest_la-libtest.Tpo .deps/libtest_la-libtest.Plo
/bin/bash ./libtool --tag=CXX --mode=link x86_64-w64-mingw32-g++ -fsanitize=address -g -O2 -no-undefined -o libtest.la -rpath /usr/local/lib libtest_la-libtest.lo
*** Warning: Trying to link with static lib archive /opt/llvm-mingw/lib/clang/11.0.0/lib/windows/libclang_rt.builtins-x86_64.a.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because the file extensions .a of this argument makes me believe
*** that it is just a static archive that I should not use here.
*** Warning: Trying to link with static lib archive /opt/llvm-mingw/lib/clang/11.0.0/lib/windows/libclang_rt.builtins-x86_64.a.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because the file extensions .a of this argument makes me believe
*** that it is just a static archive that I should not use here.
libtool: link: x86_64-w64-mingw32-g++ -shared -nostdlib /opt/llvm-mingw/x86_64-w64-mingw32/lib/dllcrt2.o /opt/llvm-mingw/x86_64-w64-mingw32/lib/crtbegin.o .libs/libtest_la-libtest.o -L/opt/llvm-mingw/x86_64-w64-mingw32/lib -L/opt/llvm-mingw/lib -L/opt/llvm-mingw/x86_64-w64-mingw32/sys-root/mingw/lib -L/opt/llvm-mingw/lib/clang/11.0.0/lib/windows -lc++ -lmingw32 -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lmoldname -lmingwex -lmsvcrt -lkernel32 /opt/llvm-mingw/x86_64-w64-mingw32/lib/crtend.o -fsanitize=address -g -O2 -o .libs/libtest-0.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker .libs/libtest.dll.a
lld-link: error: undefined symbol: __asan_init
>>> referenced by libtest.cpp:7
>>> .libs/libtest_la-libtest.o:(asan.module_ctor)
lld-link: error: undefined symbol: __asan_version_mismatch_check_v8
>>> referenced by libtest.cpp:7
>>> .libs/libtest_la-libtest.o:(asan.module_ctor)
lld-link: error: undefined symbol: __asan_shadow_memory_dynamic_address
>>> referenced by .libs/libtest_la-libtest.o
lld-link: error: undefined symbol: ___chkstk_ms
>>> referenced by ../crt/pseudo-reloc.c:477
>>> libmingw32.a(lib64_libmingw32_a-pseudo-reloc.o):(_pei386_runtime_relocator)
clang-11: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:438: recipe for target 'libtest.la' failed
make: *** [libtest.la] Error 1
The tests were run on the provided docker image and on the VideoLAN one, using a patched libtool, and resulted with the same errors.
Please let me know if I'm missing something or if you'd like me to try something out!
Thanks
Metadata
Metadata
Assignees
Labels
No labels