3 # The following command will:
4 # 1. dump the symbols of a library using `nm`
5 # 2. extract only those lines that we are interested in via `grep`
6 # 3. from those lines, extract just the symbol name via `sed`
7 # (symbol names always start with "_ZN" and end with "E")
8 # 4. sort those symbol names for deterministic comparison
9 # 5. write the result into a file
11 dump-symbols
= nm
"$(TMPDIR)/lib$(1).rlib" \
13 | sed
"s/.*\(_ZN.*E\).*/\1/" \
15 > "$(TMPDIR)/$(1)$(3).nm"
18 # - compiles each of the two crates 2 times and makes sure each time we get
19 # exactly the same symbol names
20 # - makes sure that both crates agree on the same symbol names for monomorphic
24 $(RUSTC
) stable-symbol-names1.rs
25 $(call dump-symbols
,stable_symbol_names1
,generic_|mono_
,_v1
)
26 rm $(TMPDIR
)/libstable_symbol_names1.rlib
27 $(RUSTC
) stable-symbol-names1.rs
28 $(call dump-symbols
,stable_symbol_names1
,generic_|mono_
,_v2
)
29 cmp
"$(TMPDIR)/stable_symbol_names1_v1.nm" "$(TMPDIR)/stable_symbol_names1_v2.nm"
31 $(RUSTC
) stable-symbol-names2.rs
32 $(call dump-symbols
,stable_symbol_names2
,generic_|mono_
,_v1
)
33 rm $(TMPDIR
)/libstable_symbol_names2.rlib
34 $(RUSTC
) stable-symbol-names2.rs
35 $(call dump-symbols
,stable_symbol_names2
,generic_|mono_
,_v2
)
36 cmp
"$(TMPDIR)/stable_symbol_names2_v1.nm" "$(TMPDIR)/stable_symbol_names2_v2.nm"
38 $(call dump-symbols
,stable_symbol_names1
,mono_
,_cross
)
39 $(call dump-symbols
,stable_symbol_names2
,mono_
,_cross
)
40 cmp
"$(TMPDIR)/stable_symbol_names1_cross.nm" "$(TMPDIR)/stable_symbol_names2_cross.nm"