This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
compiler/rustc_session/src Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1512,6 +1512,14 @@ fn validate_commandline_args_with_session_available(sess: &Session) {
15121512 if let ( Some ( first) , Some ( second) ) = ( sanitizer_iter. next ( ) , sanitizer_iter. next ( ) ) {
15131513 sess. err ( & format ! ( "`-Zsanitizer={}` is incompatible with `-Zsanitizer={}`" , first, second) ) ;
15141514 }
1515+
1516+ // Cannot enable crt-static with sanitizers on Linux
1517+ if sess. crt_static ( None ) && !sess. opts . debugging_opts . sanitizer . is_empty ( ) {
1518+ sess. err (
1519+ "Sanitizer is incompatible with statically linked libc, \
1520+ disable it using `-C target-feature=-crt-static`",
1521+ ) ;
1522+ }
15151523}
15161524
15171525/// Holds data on the current incremental compilation session, if there is one.
Original file line number Diff line number Diff line change 1+ // compile-flags: -Z sanitizer=address -C target-feature=+crt-static --target x86_64-unknown-linux-gnu
2+
3+ #![ feature( no_core) ]
4+ #![ no_core]
5+ #![ no_main]
Original file line number Diff line number Diff line change 1+ error: Sanitizer is incompatible with statically linked libc, disable it using `-C target-feature=-crt-static`
2+
3+ error: aborting due to previous error
4+
You can’t perform that action at this time.
0 commit comments