2019-04-18 15:49:41 +02:00
|
|
|
# needs-sanitizer-support
|
2019-04-24 11:14:24 +02:00
|
|
|
# only-x86_64
|
|
|
|
# only-linux
|
2019-04-18 15:49:41 +02:00
|
|
|
|
2017-06-17 13:42:56 +10:00
|
|
|
-include ../tools.mk
|
|
|
|
|
|
|
|
# This test builds a staticlib, then an executable that links to it.
|
2019-04-18 15:21:05 +02:00
|
|
|
# The staticlib and executable both are compiled with address sanitizer,
|
2017-06-17 13:42:56 +10:00
|
|
|
# and we assert that a fault in the staticlib is correctly detected.
|
|
|
|
|
|
|
|
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 23:19:50 +08:00
|
|
|
LD_LIBRARY_PATH=$(TMPDIR) $(TMPDIR)/program 2>&1 | $(CGREP) stack-buffer-overflow
|
2017-06-17 13:42:56 +10:00
|
|
|
|