Skip to content

Commit

Permalink
Make the default relro level be doing nothing at all
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
  • Loading branch information
kyrias committed Mar 9, 2018
1 parent 54b68b6 commit 1dbce4b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/librustc_back/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ pub enum RelroLevel {
Full,
Partial,
Off,
None,
}

impl RelroLevel {
Expand All @@ -139,6 +140,7 @@ impl RelroLevel {
RelroLevel::Full => "full",
RelroLevel::Partial => "partial",
RelroLevel::Off => "off",
RelroLevel::None => "none",
}
}
}
Expand All @@ -151,6 +153,7 @@ impl FromStr for RelroLevel {
"full" => Ok(RelroLevel::Full),
"partial" => Ok(RelroLevel::Partial),
"off" => Ok(RelroLevel::Off),
"none" => Ok(RelroLevel::None),
_ => Err(()),
}
}
Expand All @@ -162,6 +165,7 @@ impl ToJson for RelroLevel {
RelroLevel::Full => "full".to_json(),
RelroLevel::Partial => "partial".to_json(),
RelroLevel::Off => "off".to_json(),
RelroLevel::None => "None".to_json(),
}
}
}
2 changes: 1 addition & 1 deletion src/librustc_back/target/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ impl Default for TargetOptions {
has_rpath: false,
no_default_libraries: true,
position_independent_executables: false,
relro_level: RelroLevel::Off,
relro_level: RelroLevel::None,
pre_link_objects_exe: Vec::new(),
pre_link_objects_dll: Vec::new(),
post_link_objects: Vec::new(),
Expand Down
2 changes: 2 additions & 0 deletions src/librustc_trans/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,8 @@ fn link_args(cmd: &mut Linker,
RelroLevel::Off => {
cmd.no_relro();
},
RelroLevel::None => {
},
}

// Pass optimization flags down to the linker.
Expand Down

0 comments on commit 1dbce4b

Please sign in to comment.