[libcxx-commits] [PATCH] D111290: [libunwind] Fix test execution.

Daniel Kiss via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 7 08:44:39 PDT 2021


danielkiss added inline comments.


================
Comment at: libunwind/test/libunwind/test/config.py:70
+        if sanitizers is not None:
+            super().configure_link_flags_cxx_library()
 
----------------
arichardson wrote:
> 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.
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.



================
Comment at: libunwind/test/lit.site.cfg.in:6
 import os
 import site
 
----------------



================
Comment at: libunwind/test/signal_frame.pass.cpp:12
+// cfi_signal_frame is only supported on DWARF based systems.
+// REQUIRES: linux
 
----------------
arichardson wrote:
> Shouldn't this also work on other ELF+DWARF platforms, e.g. FreeBSD?
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.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D111290/new/

https://reviews.llvm.org/D111290



More information about the libcxx-commits mailing list