1
Fork 0

Make the default relro level be doing nothing at all

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
This commit is contained in:
Johannes Löthberg 2018-03-09 14:53:15 +01:00
parent 54b68b6569
commit 1dbce4b0af
3 changed files with 7 additions and 1 deletions

View file

@ -131,6 +131,7 @@ pub enum RelroLevel {
Full,
Partial,
Off,
None,
}
impl RelroLevel {
@ -139,6 +140,7 @@ impl RelroLevel {
RelroLevel::Full => "full",
RelroLevel::Partial => "partial",
RelroLevel::Off => "off",
RelroLevel::None => "none",
}
}
}
@ -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(()),
}
}
@ -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(),
}
}
}

View file

@ -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(),

View file

@ -1017,6 +1017,8 @@ fn link_args(cmd: &mut Linker,
RelroLevel::Off => {
cmd.no_relro();
},
RelroLevel::None => {
},
}
// Pass optimization flags down to the linker.