Skip to content

Commit ebfeeec

Browse files
committed
[libunwind] Fix testing with sanitizers enabled
When testing with sanitizers enabled, we need to link against a plethora of system libraries. Using `-nodefaultlibs` like we used to breaks this, and we would have to add all these system libraries manually, which is not portable and error prone. Instead, stop using `-nodefaultlibs` so that we get the libraries added by default by the compiler. The only caveat with this approach is that we are now relying on the fact that `-L <path-to-local-libunwind>` will cause the just built libunwind to be selected before the system implementation (either of libunwind or libgcc_s.so), which is somewhat fragile. This patch also turns the 32 bit multilib build into a soft failure since we are in the process of removing it anyway, see D114473 for details. This patch is incompatible with the 32 bit multilib build because Ubuntu does not provide a proper libstdc++ for 32 bits, and that is required when running with sanitizers enabled. Differential Revision: https://reviews.llvm.org/D114385
1 parent bc41653 commit ebfeeec

12 files changed

+6
-33
lines changed

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,8 @@ steps:
385385
automatic:
386386
- exit_status: -1 # Agent was lost
387387
limit: 2
388+
soft_fail:
389+
- exit_status: 1
388390
timeout_in_minutes: 120
389391

390392
- label: "Single-threaded"

libunwind/test/configs/llvm-libunwind-shared.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ config.substitutions.append(('%{compile_flags}',
4747
'-nostdinc++ -I {}/include {}'.format('@LIBUNWIND_SOURCE_DIR@', ' '.join(compile_flags))
4848
))
4949
config.substitutions.append(('%{link_flags}',
50-
'-nodefaultlibs -L {0} -Wl,-rpath,{0} -lunwind -ldl -lc {1}'.format('@LIBUNWIND_LIBRARY_DIR@', ' '.join(link_flags))
50+
'-L {0} -Wl,-rpath,{0} -lunwind -ldl {1}'.format('@LIBUNWIND_LIBRARY_DIR@', ' '.join(link_flags))
5151
))
5252
config.substitutions.append(('%{exec}', ''))
5353

libunwind/test/configs/llvm-libunwind-static.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ config.substitutions.append(('%{compile_flags}',
4949
'-nostdinc++ -I {}/include {}'.format('@LIBUNWIND_SOURCE_DIR@', ' '.join(compile_flags))
5050
))
5151
config.substitutions.append(('%{link_flags}',
52-
'-nodefaultlibs {}/libunwind.a -ldl -lc {}'.format('@LIBUNWIND_LIBRARY_DIR@', ' '.join(link_flags))
52+
'{}/libunwind.a -ldl {}'.format('@LIBUNWIND_LIBRARY_DIR@', ' '.join(link_flags))
5353
))
5454
config.substitutions.append(('%{exec}', ''))
5555

libunwind/test/forceunwind.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
// REQUIRES: linux
1111

12-
// TODO: Investigate these failures
13-
// XFAIL: asan, tsan, ubsan
14-
1512
// Basic test for _Unwind_ForcedUnwind.
1613
// See libcxxabi/test/forced_unwind* tests too.
1714

libunwind/test/frameheadercache_test.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// TODO: Investigate these failures
2-
// XFAIL: asan, tsan, ubsan
3-
41
// The other libunwind tests don't test internal interfaces, so the include path
52
// is a little wonky.
63
#include "../src/config.h"

libunwind/test/libunwind_01.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// TODO: Investigate these failures
2-
// XFAIL: asan, tsan, ubsan
3-
41
// TODO: Investigate these failures on x86_64 macOS back deployment
52
// UNSUPPORTED: target=x86_64-apple-darwin{{.+}}
63

libunwind/test/libunwind_02.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// TODO: Investigate these failures
2-
// XFAIL: asan, tsan, ubsan
3-
41
#include <assert.h>
52
#include <stdlib.h>
63
#include <unwind.h>

libunwind/test/remember_state_leak.pass.sh.s

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
# RUN: %{build}
33
# RUN: %{run}
44

5-
// TODO: Investigate these failures
6-
// XFAIL: asan, tsan, ubsan
7-
85
// TODO: Investigate this failure
96
// XFAIL: 32bits-on-64bits
107

libunwind/test/signal_frame.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
// Ensure that functions marked as signal frames are reported as such.
1111

12-
// TODO: Investigate these failures
13-
// XFAIL: asan, tsan, ubsan
14-
1512
// TODO: Investigate this failure on macOS
1613
// XFAIL: target={{.+}}-apple-darwin{{.+}}
1714

libunwind/test/signal_unwind.pass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@
1010
// Ensure that the unwinder can cope with the signal handler.
1111
// REQUIRES: linux && (target={{aarch64-.+}} || target={{x86_64-.+}})
1212

13-
// TODO: Investigate these failures
14-
// XFAIL: asan, tsan, ubsan
15-
1613
#include <assert.h>
1714
#include <dlfcn.h>
1815
#include <signal.h>

0 commit comments

Comments
 (0)