Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly disable stack execution on linux and bsd #30859

Merged
merged 2 commits into from
Jan 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/librustc_back/target/dragonfly_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub fn opts() -> TargetOptions {
// libraries which follow this flag. Thus, use it before
// specifying libraries to link to.
"-Wl,--as-needed".to_string(),

// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/freebsd_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ pub fn opts() -> TargetOptions {
dynamic_linking: true,
executables: true,
has_rpath: true,
pre_link_args: vec![
// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
],
archive_format: "gnu".to_string(),
exe_allocation_crate: super::maybe_jemalloc(),

Expand Down
3 changes: 3 additions & 0 deletions src/librustc_back/target/linux_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ pub fn opts() -> TargetOptions {
// following libraries so we're sure to pass it as one of the first
// arguments.
"-Wl,--as-needed".to_string(),

// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
],
position_independent_executables: true,
archive_format: "gnu".to_string(),
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_back/target/netbsd_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub fn opts() -> TargetOptions {
// libraries which follow this flag. Thus, use it before
// specifying libraries to link to.
"-Wl,--as-needed".to_string(),

// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
Expand Down
3 changes: 3 additions & 0 deletions src/librustc_back/target/openbsd_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub fn opts() -> TargetOptions {
// libraries which follow this flag. Thus, use it before
// specifying libraries to link to.
"-Wl,--as-needed".to_string(),

// Always enable NX protection when it is available
"-Wl,-z,noexecstack".to_string(),
),
position_independent_executables: true,
archive_format: "gnu".to_string(),
Expand Down