-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #48388 - kyrias:relro-level-cg, r=alexcrichton
Add relro-level tests The `relro-level` debugging flag was added in #43170 which was merged in July 2017. This PR moves this flag to be a proper codegen flag.
- Loading branch information
Showing
6 changed files
with
62 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
-include ../tools.mk | ||
|
||
# This tests the different -Zrelro-level values, and makes sure that they they work properly. | ||
|
||
all: | ||
ifeq ($(UNAME),Linux) | ||
# 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 | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
println!("Hello, world!"); | ||
} |