|
1 | 1 | # ignore-cross-compile
|
2 | 2 | include ../tools.mk
|
3 | 3 |
|
| 4 | +export HERE := $(shell pwd) |
| 5 | + |
4 | 6 | all: off packed unpacked
|
5 | 7 |
|
6 | 8 | ifeq ($(UNAME),Darwin)
|
|
11 | 13 | [ ! -d $(TMPDIR)/foo.dSYM ]
|
12 | 14 |
|
13 | 15 | # Packed by default, but only if debuginfo is requested
|
14 |
| -packed: |
15 |
| - rm -rf $(TMPDIR)/*.dSYM |
16 |
| - $(RUSTC) foo.rs |
17 |
| - [ ! -d $(TMPDIR)/foo.dSYM ] |
18 |
| - rm -rf $(TMPDIR)/*.dSYM |
19 |
| - $(RUSTC) foo.rs -g |
| 16 | +packed: packed-remapped-scope packed-remapped-wrong-scope |
| 17 | + |
| 18 | +# - Debuginfo in binary file |
| 19 | +# - file paths from `SO` (source files) and `OSO` (object files) should be remapped |
| 20 | +packed-remapped-scope: |
| 21 | + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ |
| 22 | + --remap-path-prefix $(TMPDIR)=/a \ |
| 23 | + --remap-path-prefix $(HERE)=/b \ |
| 24 | + -Z remap-path-scope=object foo.rs -g |
| 25 | + ls $(TMPDIR)/*.o && exit 1 || exit 0 |
20 | 26 | [ -d $(TMPDIR)/foo.dSYM ]
|
21 |
| - rm -rf $(TMPDIR)/*.dSYM |
22 |
| - $(RUSTC) foo.rs -g -C split-debuginfo=packed |
| 27 | + dsymutil -s $(TMPDIR)/foo | grep 'N_SO' | grep $(HERE) || exit 1 # expected behavior is (! grep ...) |
| 28 | + # As of 2023-12, `OSO` should be the only thing that cannot be trimmed. See rust-lang/rust#116948 |
| 29 | + dsymutil -s $(TMPDIR)/foo | grep 'N_OSO' | grep $(TMPDIR) || exit 1 # expected behavior is (! grep ...) |
| 30 | + rm -rf $(TMPDIR)/foo.dSYM |
| 31 | + rm $(TMPDIR)/$(call BIN,foo) |
| 32 | + |
| 33 | +# - Debuginfo in binary file |
| 34 | +# - file paths from `N_SO` (source files) and `N_OSO` (object files) shouldn't be remapped |
| 35 | +packed-remapped-wrong-scope: |
| 36 | + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=packed -C debuginfo=2 \ |
| 37 | + --remap-path-prefix $(TMPDIR)=/a \ |
| 38 | + --remap-path-prefix $(HERE)=/b \ |
| 39 | + -Z remap-path-scope=macro foo.rs -g |
| 40 | + ls $(TMPDIR)/*.o && exit 1 || exit 0 |
23 | 41 | [ -d $(TMPDIR)/foo.dSYM ]
|
24 |
| - rm -rf $(TMPDIR)/*.dSYM |
| 42 | + dsymutil -s $(TMPDIR)/foo | grep 'N_SO' | grep $(HERE) || exit 1 |
| 43 | + dsymutil -s $(TMPDIR)/foo | grep 'N_OSO' | grep $(TMPDIR) || exit 1 |
| 44 | + rm -rf $(TMPDIR)/foo.dSYM |
| 45 | + rm $(TMPDIR)/$(call BIN,foo) |
25 | 46 |
|
26 | 47 | # Object files are preserved with unpacked and `dsymutil` isn't run
|
27 |
| -unpacked: |
28 |
| - $(RUSTC) foo.rs -g -C split-debuginfo=unpacked |
| 48 | +unpacked: unpacked-remapped-scope #unpacked-remapped-wrong-scope |
| 49 | + |
| 50 | +# - Debuginfo in object files |
| 51 | +# - file paths from `N_SO` (source files) and `N_OSO` (object files) should be remapped |
| 52 | +unpacked-remapped-scope: |
| 53 | + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ |
| 54 | + --remap-path-prefix $(TMPDIR)=/a \ |
| 55 | + --remap-path-prefix $(HERE)=/b \ |
| 56 | + -Z remap-path-scope=object foo.rs -g |
29 | 57 | ls $(TMPDIR)/*.o
|
30 | 58 | [ ! -d $(TMPDIR)/foo.dSYM ]
|
| 59 | + dsymutil -s $(TMPDIR)/foo | grep 'N_SO' | (grep $(HERE)) || exit 1 # expected behavior is (! grep ...) |
| 60 | + # As of 2023-12, `OSO` should be the only thing that cannot be trimmed. See rust-lang/rust#116948 |
| 61 | + dsymutil -s $(TMPDIR)/foo | grep 'N_OSO' | (grep $(TMPDIR)) || exit 1 # expected behavior is (! grep ...) |
| 62 | + rm $(TMPDIR)/*.o |
| 63 | + rm $(TMPDIR)/$(call BIN,foo) |
| 64 | + |
| 65 | +# - Debuginfo in object files |
| 66 | +# - file paths from `N_SO` (source files) and `N_OSO` (object files) shouldn't be remapped |
| 67 | +unpacked-remapped-wrong-scope: |
| 68 | + $(RUSTC) $(UNSTABLEOPTS) -C split-debuginfo=unpacked -C debuginfo=2 \ |
| 69 | + --remap-path-prefix $(TMPDIR)=/a \ |
| 70 | + --remap-path-prefix $(HERE)=/b \ |
| 71 | + -Z remap-path-scope=macro foo.rs -g |
| 72 | + ls $(TMPDIR)/*.o |
| 73 | + [ ! -d $(TMPDIR)/foo.dSYM ] |
| 74 | + dsymutil -s $(TMPDIR)/foo | grep 'N_SO' | (grep $(HERE)) || exit 1 |
| 75 | + dsymutil -s $(TMPDIR)/foo | grep 'N_OSO' | (grep $(TMPDIR)) || exit 1 |
| 76 | + rm $(TMPDIR)/*.o |
| 77 | + rm $(TMPDIR)/$(call BIN,foo) |
| 78 | + |
31 | 79 | else
|
32 | 80 | ifdef IS_WINDOWS
|
33 | 81 | # Windows only supports packed debuginfo - nothing to test.
|
|
0 commit comments