2023-03-30 13:46:31 +00:00
|
|
|
# ignore-cross-compile
|
2022-08-23 00:00:00 +00:00
|
|
|
include ../tools.mk
|
2018-02-22 19:38:35 +00:00
|
|
|
|
2019-01-06 21:27:57 +00:00
|
|
|
# only-linux
|
|
|
|
#
|
2019-01-03 20:27:50 +00:00
|
|
|
# This tests the different -Zrelro-level values, and makes sure that they work properly.
|
2018-02-22 19:38:35 +00:00
|
|
|
|
|
|
|
all:
|
|
|
|
# Ensure that binaries built with the full relro level links them with both
|
|
|
|
# RELRO and BIND_NOW for doing eager symbol resolving.
|
|
|
|
$(RUSTC) -Zrelro-level=full hello.rs
|
|
|
|
readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO
|
|
|
|
readelf -d $(TMPDIR)/hello | grep -q BIND_NOW
|
|
|
|
|
|
|
|
$(RUSTC) -Zrelro-level=partial hello.rs
|
|
|
|
readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO
|
|
|
|
|
|
|
|
# Ensure that we're *not* built with RELRO when setting it to off. We do
|
|
|
|
# not want to check for BIND_NOW however, as the linker might have that
|
|
|
|
# enabled by default.
|
|
|
|
$(RUSTC) -Zrelro-level=off hello.rs
|
|
|
|
! readelf -l $(TMPDIR)/hello | grep -q GNU_RELRO
|