]> git.lizzy.rs Git - rust.git/blob - src/test/run-make-fulldeps/sanitizer-staticlib-link/Makefile
Rollup merge of #101116 - GuillaumeGomez:rm-attrs-ty-alias, r=notriddle
[rust.git] / src / test / run-make-fulldeps / sanitizer-staticlib-link / Makefile
1 # needs-sanitizer-support
2 # needs-sanitizer-address
3
4 include ../tools.mk
5
6 # This test first builds a staticlib with AddressSanitizer and checks that
7 # linking it to an executable fails due to the missing sanitizer runtime.
8 # It then builds an executable linking to the staticlib and checks that
9 # the fault in the staticlib is detected correctly.
10
11 # Note that checking for the link failure actually checks two things at once:
12 #   1) That the library has the sanitizer intrumentation
13 #   2) and that library does not have the sanitizer runtime
14
15 all:
16         $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
17         ! $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
18         $(RUSTC) -g -Z sanitizer=address --crate-type bin --target $(TARGET) -L . program.rs
19         LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
20