File tree 4 files changed +14
-4
lines changed
librustc_codegen_ssa/back
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>>(
769
769
}
770
770
771
771
fn 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 {
773
785
return ;
774
786
}
787
+
775
788
let sanitizer = sess. opts . debugging_opts . sanitizer ;
776
789
if sanitizer. contains ( SanitizerSet :: ADDRESS ) {
777
790
link_sanitizer_runtime ( sess, linker, "asan" ) ;
Original file line number Diff line number Diff line change 1
1
# needs-sanitizer-support
2
2
# needs-sanitizer-address
3
- # only-linux
4
3
5
4
-include ../tools.mk
6
5
Original file line number Diff line number Diff line change 1
1
# needs-sanitizer-support
2
2
# needs-sanitizer-address
3
- # only-linux
4
3
5
4
-include ../tools.mk
6
5
Original file line number Diff line number Diff line change 1
1
# needs-sanitizer-support
2
2
# needs-sanitizer-address
3
- # only-linux
4
3
5
4
-include ../tools.mk
6
5
You can’t perform that action at this time.
0 commit comments