This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +29
-23
lines changed
tests/run-make/relro-levels Expand file tree Collapse file tree 3 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -151,7 +151,6 @@ run-make/raw-dylib-inline-cross-dylib/Makefile
151151run-make/raw-dylib-link-ordinal/Makefile
152152run-make/raw-dylib-stdcall-ordinal/Makefile
153153run-make/redundant-libs/Makefile
154- run-make/relro-levels/Makefile
155154run-make/remap-path-prefix-dwarf/Makefile
156155run-make/remap-path-prefix/Makefile
157156run-make/reproducible-build-2/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ // This tests the different -Crelro-level values, and makes sure that they work properly.
2+
3+ //@ ignore-cross-compile
4+ //@ only-linux
5+
6+ use run_make_support:: llvm_readobj;
7+ use run_make_support:: rustc;
8+
9+ fn compile ( relro_level : & str ) {
10+ rustc ( ) . arg ( format ! ( "-Crelro-level={relro_level}" ) ) . input ( "hello.rs" ) . run ( ) ;
11+ }
12+
13+ fn main ( ) {
14+ // Ensure that binaries built with the full relro level links them with both
15+ // RELRO and BIND_NOW for doing eager symbol resolving.
16+
17+ compile ( "full" ) ;
18+ llvm_readobj ( ) . program_headers ( ) . input ( "hello" ) . run ( ) . assert_stdout_contains ( "GNU_RELRO" ) ;
19+ llvm_readobj ( ) . dynamic_table ( ) . input ( "hello" ) . run ( ) . assert_stdout_contains ( "BIND_NOW" ) ;
20+
21+ compile ( "partial" ) ;
22+ llvm_readobj ( ) . program_headers ( ) . input ( "hello" ) . run ( ) . assert_stdout_contains ( "GNU_RELRO" ) ;
23+
24+ // Ensure that we're *not* built with RELRO when setting it to off. We do
25+ // not want to check for BIND_NOW however, as the linker might have that
26+ // enabled by default.
27+ compile ( "off" ) ;
28+ llvm_readobj ( ) . program_headers ( ) . input ( "hello" ) . run ( ) . assert_stdout_not_contains ( "GNU_RELRO" ) ;
29+ }
You can’t perform that action at this time.
0 commit comments