]> git.proxmox.com Git - rustc.git/blob - src/test/run-make/sanitizer-staticlib-link/Makefile
New upstream version 1.20.0+dfsg1
[rustc.git] / src / test / run-make / sanitizer-staticlib-link / Makefile
1 -include ../tools.mk
2
3 # This test builds a staticlib, then an executable that links to it.
4 # The staticlib and executable both are compiled with address sanitizer,
5 # and we assert that a fault in the staticlib is correctly detected.
6
7 ifeq ($(TARGET),x86_64-unknown-linux-gnu)
8 ASAN_SUPPORT=$(SANITIZER_SUPPORT)
9 EXTRA_RUSTFLAG=
10 endif
11
12 all:
13 ifeq ($(ASAN_SUPPORT),1)
14 $(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
15 $(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
16 LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | grep -q stack-buffer-overflow
17 endif
18