File tree 3 files changed +14
-3
lines changed
rustc_codegen_llvm/src/debuginfo
tests/run-make/split-debuginfo
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -846,14 +846,16 @@ pub fn build_compile_unit_di_node<'ll, 'tcx>(
846
846
name_in_debuginfo. push ( "@" ) ;
847
847
name_in_debuginfo. push ( codegen_unit_name) ;
848
848
849
- debug ! ( "build_compile_unit_di_node: {:?}" , name_in_debuginfo) ;
850
849
let rustc_producer = format ! ( "rustc version {}" , tcx. sess. cfg_version) ;
851
850
// FIXME(#41252) Remove "clang LLVM" if we can get GDB and LLVM to play nice.
852
851
let producer = format ! ( "clang LLVM ({rustc_producer})" ) ;
853
852
854
853
use rustc_session:: RemapFileNameExt ;
855
854
let name_in_debuginfo = name_in_debuginfo. to_string_lossy ( ) ;
856
855
let work_dir = tcx. sess . opts . working_dir . for_codegen ( tcx. sess ) . to_string_lossy ( ) ;
856
+ debug ! ( ?work_dir, "build_compile_unit_di_node" ) ;
857
+ debug ! ( ?name_in_debuginfo, "build_compile_unit_di_node" ) ;
858
+
857
859
let flags = "\0 " ;
858
860
let output_filenames = tcx. output_filenames ( ( ) ) ;
859
861
let split_name = if tcx. sess . target_can_use_split_dwarf ( ) {
Original file line number Diff line number Diff line change @@ -1255,6 +1255,15 @@ impl Session {
1255
1255
prefer_remapped |= has_split_debuginfo;
1256
1256
}
1257
1257
1258
+ if self . target . is_like_osx && remap_path_scopes. contains ( RemapPathScopeComponents :: OBJECT ) {
1259
+ // HACK: Even when when debuginfo is splitted,
1260
+ // `SO` debug symbols are still embedded in executables on macOS.
1261
+ // Therefore, we trim them when the scope of `object` is present,
1262
+ // as it is expected no path embedded in final executables
1263
+ // when `object` scope applied.
1264
+ prefer_remapped |= true ;
1265
+ }
1266
+
1258
1267
prefer_remapped
1259
1268
}
1260
1269
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ packed-remapped-scope:
24
24
-Z remap-path-scope=object foo.rs -g
25
25
ls $(TMPDIR ) /* .o && exit 1 || exit 0
26
26
[ -d $( TMPDIR) /foo.dSYM ]
27
- dsymutil -s $(TMPDIR ) /foo | grep ' N_SO' | grep $(HERE ) || exit 1 # expected behavior is (! grep ...)
27
+ dsymutil -s $(TMPDIR ) /foo | grep ' N_SO' | ( ! grep $( HERE) ) || exit 1
28
28
# As of 2023-12, `OSO` should be the only thing that cannot be trimmed. See rust-lang/rust#116948
29
29
dsymutil -s $(TMPDIR ) /foo | grep ' N_OSO' | grep $(TMPDIR ) || exit 1 # expected behavior is (! grep ...)
30
30
rm -rf $(TMPDIR ) /foo.dSYM
@@ -56,7 +56,7 @@ unpacked-remapped-scope:
56
56
-Z remap-path-scope=object foo.rs -g
57
57
ls $(TMPDIR ) /* .o
58
58
[ ! -d $( TMPDIR) /foo.dSYM ]
59
- dsymutil -s $(TMPDIR ) /foo | grep ' N_SO' | (grep $( HERE) ) || exit 1 # expected behavior is (! grep ...)
59
+ dsymutil -s $(TMPDIR ) /foo | grep ' N_SO' | (! grep $( HERE) ) || exit 1
60
60
# As of 2023-12, `OSO` should be the only thing that cannot be trimmed. See rust-lang/rust#116948
61
61
dsymutil -s $(TMPDIR ) /foo | grep ' N_OSO' | (grep $( TMPDIR) ) || exit 1 # expected behavior is (! grep ...)
62
62
rm $(TMPDIR ) /* .o
You can’t perform that action at this time.
0 commit comments