File tree Expand file tree Collapse file tree 4 files changed +14
-4
lines changed
librustc_codegen_ssa/back Expand file tree Collapse file tree 4 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -769,9 +769,22 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>(
769769}
770770
771771fn link_sanitizers ( sess : & Session , crate_type : CrateType , linker : & mut dyn Linker ) {
772- if crate_type != CrateType :: Executable {
772+ // On macOS the runtimes are distributed as dylibs which should be linked to
773+ // both executables and dynamic shared objects. Everywhere else the runtimes
774+ // are currently distributed as static liraries which should be linked to
775+ // executables only.
776+ let needs_runtime = match crate_type {
777+ CrateType :: Executable => true ,
778+ CrateType :: Dylib | CrateType :: Cdylib | CrateType :: ProcMacro => {
779+ sess. target . target . options . is_like_osx
780+ }
781+ CrateType :: Rlib | CrateType :: Staticlib => false ,
782+ } ;
783+
784+ if !needs_runtime {
773785 return ;
774786 }
787+
775788 let sanitizer = sess. opts . debugging_opts . sanitizer ;
776789 if sanitizer. contains ( SanitizerSet :: ADDRESS ) {
777790 link_sanitizer_runtime ( sess, linker, "asan" ) ;
Original file line number Diff line number Diff line change 11# needs-sanitizer-support
22# needs-sanitizer-address
3- # only-linux
43
54-include ../tools.mk
65
Original file line number Diff line number Diff line change 11# needs-sanitizer-support
22# needs-sanitizer-address
3- # only-linux
43
54-include ../tools.mk
65
Original file line number Diff line number Diff line change 11# needs-sanitizer-support
22# needs-sanitizer-address
3- # only-linux
43
54-include ../tools.mk
65
You can’t perform that action at this time.
0 commit comments