[TTC-11] Embed UBSan into ASan runtime
Change the way we use ASan and UBSan together. Instead of keeping two
separate runtimes (libasan.so and libubsan.so), embed UBSan into ASan.
UBSan initialization code (e.g. flag parsing) is directly called
from ASan initialization, so we are able to enforce correct
initialization order.
This mirrors the approach we already use for ASan+LSan. This change
doesn't modify the way we use standalone UBSan.
gcc/
* config/gnu-user.h: append -lstdc++ if we link against ASan
runtime.
* gcc.c: Do not link against libubsan.so if
-fsanitize=address,undefined is used.
gcc/testsuite/
* c-c++-common/asan/asan_and_ubsan-1.c: New test.
libsanitizer/
* Makefile.am: Build UBSan strictly before ASan.
* Makefile.in: Regenerate.
* asan/Makefile.am: Embed UBSan into ASan runtime.
* asan/Makefile.in: Regenerate.
* configure.ac: Configure UBSan strictly before ASan.
* configure: Regenerate.
ubsan/ubsan_diag.cc (__sanitizer_print_stack_trace): Move to ...
ubsan/ubsan_diag_standalone.cc: ... here.
* ubsan/Makefile.am: Create a "plugin" library to be embedded
into ASan runtime.
* ubsan/Makefile.in: Regenerate.
Change-Id: Ia848a93929effb4b0ec057243c7343c1bd94fbfb
Signed-off-by: Maxim Ostapenko <m.ostapenko@samsung.com>
14 files changed: