Using -fsanitize=undefined -fsanitize-undefined-trap-on-error when both
compiling and linking results in libubsan.so in DT_NEEDED of the final
executable.  That's inconvenient since the latter flag ensures that
__builtin_trap is used instead of libubsan routines thus the libubsan
library shouldn't be needed at all.

Jakub suggested adding the Driver property and that seems to work.

Bootstrapped/regtested on x86_64-linux, ok for trunk?

2015-06-19  Marek Polacek  <pola...@redhat.com>

        * common.opt (fsanitize-undefined-trap-on-error): Add Driver.

diff --git gcc/common.opt gcc/common.opt
index 32b416a..dd49ae3 100644
--- gcc/common.opt
+++ gcc/common.opt
@@ -918,7 +918,7 @@ Common Report
 This switch is deprecated; use -fsanitize-recover= instead
 
 fsanitize-undefined-trap-on-error
-Common Report Var(flag_sanitize_undefined_trap_on_error) Init(0)
+Common Driver Report Var(flag_sanitize_undefined_trap_on_error) Init(0)
 Use trap instead of a library function for undefined behavior sanitization
 
 fasynchronous-unwind-tables

        Marek

Reply via email to