2019-04-18 08:49:41 -05:00
|
|
|
# needs-sanitizer-support
|
|
|
|
|
2017-06-16 22:42:56 -05:00
|
|
|
-include ../tools.mk
|
|
|
|
|
|
|
|
# This test builds a staticlib, then an executable that links to it.
|
2019-04-18 08:21:05 -05:00
|
|
|
# The staticlib and executable both are compiled with address sanitizer,
|
2017-06-16 22:42:56 -05:00
|
|
|
# and we assert that a fault in the staticlib is correctly detected.
|
|
|
|
|
|
|
|
ifeq ($(TARGET),x86_64-unknown-linux-gnu)
|
|
|
|
EXTRA_RUSTFLAG=
|
|
|
|
endif
|
|
|
|
|
|
|
|
all:
|
|
|
|
$(RUSTC) -g -Z sanitizer=address --crate-type staticlib --target $(TARGET) library.rs
|
|
|
|
$(CC) program.c $(call STATICLIB,library) $(call OUT_EXE,program) $(EXTRACFLAGS) $(EXTRACXXFLAGS)
|
2017-11-23 09:19:50 -06:00
|
|
|
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
|
2017-06-16 22:42:56 -05:00
|
|
|
|