Skip to content

Commit

Permalink
ASan: Run with verify_asan_link_order=0.
Browse files Browse the repository at this point in the history
Avoids error message:
  ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.

Affected tests:
  nested_detach
  nested_detach_kill
  nested_detach_kill_stuck
  nested_detach_wait
  • Loading branch information
bernhardu committed Apr 11, 2023
1 parent 002528b commit 4f90a93
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,13 @@ size_t saved_argv0_space() {
using namespace rr;

int main(int argc, char* argv[]) {

#ifdef __SANITIZE_ADDRESS__
if (getenv("ASAN_OPTIONS") == NULL) {
setenv("ASAN_OPTIONS", "verify_asan_link_order=0", 1);
}
#endif

rr::saved_argv0_ = argv[0];
rr::saved_argv0_space_ = argv[argc - 1] + strlen(argv[argc - 1]) + 1 - rr::saved_argv0_;

Expand Down

0 comments on commit 4f90a93

Please sign in to comment.