This is an archive of the discontinued LLVM Phabricator instance.

[libunwind] Fix test execution.
AbandonedPublic

Authored by danielkiss on Oct 7 2021, 2:40 AM.

Details

Reviewers
ldionne
Group Reviewers
Restricted Project
Summary

Tests and libunwind are not dependent libcxxabi except
in case of a santizer is in use.
Signal frame is only supported on elf/dwarf based systems.
To build 32bit on a 64bit systems gcc\g++-multilib packages are needed.

Diff Detail

Event Timeline

danielkiss created this revision.Oct 7 2021, 2:40 AM
danielkiss requested review of this revision.Oct 7 2021, 2:40 AM
arichardson added inline comments.Oct 7 2021, 3:09 AM
libunwind/test/signal_frame.pass.cpp
11

Shouldn't this also work on other ELF+DWARF platforms, e.g. FreeBSD?

arichardson added inline comments.Oct 7 2021, 3:20 AM
libunwind/test/libunwind/test/config.py
71

Why do we need the C++ library?

I can see the following issue:

$ nm -D -u /usr/lib/gcc/x86_64-linux-gnu/7/libasan.so
                 U _Unwind_Backtrace
                 U _Unwind_GetIP
readelf --dynamic /usr/lib/gcc/x86_64-linux-gnu/7/libasan.so

Dynamic section at offset 0x151550 contains 31 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x000000000000000e (SONAME)             Library soname: [libasan.so.4]

And on Ubuntu clang's libclang-rt even links against libstdc++...

$ readelf --dynamic /usr/lib/clang/10/lib/linux/libclang_rt.asan-x86_64.so
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x000000000000000e (SONAME)             Library soname: [libclang_rt.asan-x86_64.so]

Is that the problem?
I don't think we should be linking against the C++ library since that might pull in another unwind library.

danielkiss added inline comments.Oct 7 2021, 8:44 AM
libunwind/test/libunwind/test/config.py
71

in case of the asan build the static library is used ... --whole-archive /usr/lib/llvm-13/lib/clang/13.0.0/lib/linux/libclang_rt.asan_cxx-x86_64.a ...
It depends on typeinfo for std::type_info,typeinfo for __cxxabiv1::__class_type_info, __dynamic_cast... and so on.
just adding libcxxabi.a seems enough.

libunwind/test/lit.site.cfg.in
8
libunwind/test/signal_frame.pass.cpp
11

Correct it should work on FreeBSD too but right now the libuninwd's tests are broken there because the test always links to libgcc_s so the test won't call libunwind actually.
I will look at this later.

danielkiss edited the summary of this revision. (Show Details)

check-unwind tested on freebsd14/aarch64 too.

danielkiss marked 2 inline comments as done.Oct 7 2021, 12:24 PM
danielkiss updated this revision to Diff 378196.Oct 8 2021, 6:27 AM

Fix gcc build.

danielkiss updated this revision to Diff 378264.Oct 8 2021, 9:05 AM

generic-32bit config won't be green until the docker image is rebuilt.

danielkiss added inline comments.Oct 8 2021, 11:43 AM
libunwind/test/signal_frame.pass.cpp
12

// REQUIRES: linux || freebsd

danielkiss abandoned this revision.Dec 1 2021, 3:42 AM

fixed in other changes.