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