fork/rust
git clone https://git.julia.blue/fork/rust
5e1a799842b
1.41.0
1# needs-sanitizer-support 2 3-include ../tools.mk 4 5LOG := $(TMPDIR)/log.txt 6 7# NOTE the address sanitizer only supports x86_64 linux and macOS 8 9ifeq ($(TARGET),x86_64-apple-darwin) 10EXTRA_RUSTFLAG=-C rpath 11else 12ifeq ($(TARGET),x86_64-unknown-linux-gnu) 13 14# Apparently there are very specific Linux kernels, notably the one that's 15# currently on Travis CI, which contain a buggy commit that triggers failures in 16# the ASan implementation, detailed at google/sanitizers#837. As noted in 17# google/sanitizers#856 the "fix" is to avoid using PIE binaries, so we pass a 18# different relocation model to avoid generating a PIE binary. Once Travis is no 19# longer running kernel 4.4.0-93 we can remove this and pass an empty set of 20# flags again. 21EXTRA_RUSTFLAG=-C relocation-model=dynamic-no-pic 22endif 23endif 24 25all: 26 $(RUSTC) -g -Z sanitizer=address -Z print-link-args $(EXTRA_RUSTFLAG) overflow.rs | $(CGREP) librustc_asan 27 # Verify that stack buffer overflow is detected: 28 $(TMPDIR)/overflow 2>&1 | $(CGREP) stack-buffer-overflow 29 # Verify that variable name is included in address sanitizer report: 30 $(TMPDIR)/overflow 2>&1 | $(CGREP) "'xs'"