-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for QNX 7.1 with io-sock on x64
- Loading branch information
Showing
7 changed files
with
39 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
compiler/rustc_target/src/spec/targets/x86_64_pc_nto_qnx710_iosock.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use crate::spec::{Cc, LinkerFlavor, Lld, Target, TargetOptions}; | ||
|
||
pub(crate) fn target() -> Target { | ||
let mut target = super::x86_64_pc_nto_qnx710::target(); | ||
target.options.env = "nto71_iosock".into(); | ||
target.options.pre_link_args = TargetOptions::link_args( | ||
LinkerFlavor::Gnu(Cc::Yes, Lld::No), | ||
&["-Vgcc_ntox86_64_cxx", get_iosock_param()], | ||
); | ||
target | ||
} | ||
|
||
// When using `io-sock` on QNX, we must add a search path for the linker so | ||
// that it prefers the io-sock version. | ||
// The path depends on the host, i.e. we cannot hard-code it here, but have | ||
// to determine it when the compiler runs. | ||
// When using the QNX toolchain, the environment variable QNX_TARGET is always set. | ||
// More information: | ||
// https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.io_sock/topic/migrate_app.html | ||
fn get_iosock_param() -> &'static str { | ||
let target_dir = std::env::var("QNX_TARGET").expect("Environment variable QNX_TARGET is set"); | ||
let linker_param = format!("-L{target_dir}/x86_64/io-sock/lib"); | ||
|
||
linker_param.leak() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters