fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.1 KiB30 linesraw
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'"