mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Linker: use -z <params> instead of -z<params>
The GNU linker accepts -z<params>, but this is undocumented, and
not supported by other linkers.
In particular, `zig cc`, when used as the C compiler/linker
(e.g. when using `cargo-zigbuild`), will not accept this
undocumented syntax.
In `linker.rs`, both syntaxes are also used inconsistently.
The Go compiler used to have the same issue, but fixed it:
38607c5538
This commit is contained in:
parent
bda32a4023
commit
8e250c3c64
@ -473,13 +473,13 @@ impl<'a> Linker for GccLinker<'a> {
|
||||
self.cmd.arg(path);
|
||||
}
|
||||
fn full_relro(&mut self) {
|
||||
self.linker_args(&["-zrelro", "-znow"]);
|
||||
self.linker_args(&["-z", "relro", "-z", "now"]);
|
||||
}
|
||||
fn partial_relro(&mut self) {
|
||||
self.linker_arg("-zrelro");
|
||||
self.linker_args(&["-z", "relro"]);
|
||||
}
|
||||
fn no_relro(&mut self) {
|
||||
self.linker_arg("-znorelro");
|
||||
self.linker_args(&["-z", "norelro"]);
|
||||
}
|
||||
|
||||
fn link_rust_dylib(&mut self, lib: &str, _path: &Path) {
|
||||
@ -758,7 +758,7 @@ impl<'a> Linker for GccLinker<'a> {
|
||||
if self.sess.target.is_like_windows {
|
||||
self.linker_arg("--nxcompat");
|
||||
} else if self.is_gnu {
|
||||
self.linker_arg("-znoexecstack");
|
||||
self.linker_args(&["-z", "noexecstack"]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1364,16 +1364,16 @@ impl<'a> Linker for L4Bender<'a> {
|
||||
}
|
||||
|
||||
fn full_relro(&mut self) {
|
||||
self.cmd.arg("-zrelro");
|
||||
self.cmd.arg("-znow");
|
||||
self.cmd.arg("-z").arg("relro");
|
||||
self.cmd.arg("-z").arg("now");
|
||||
}
|
||||
|
||||
fn partial_relro(&mut self) {
|
||||
self.cmd.arg("-zrelro");
|
||||
self.cmd.arg("-z").arg("relro");
|
||||
}
|
||||
|
||||
fn no_relro(&mut self) {
|
||||
self.cmd.arg("-znorelro");
|
||||
self.cmd.arg("-z").arg("norelro");
|
||||
}
|
||||
|
||||
fn cmd(&mut self) -> &mut Command {
|
||||
|
Loading…
Reference in New Issue
Block a user