Skip to content

Commit

Permalink
target spec: add an asm-args field to pass arguments to the external ..
Browse files Browse the repository at this point in the history
assembler
  • Loading branch information
Jorge Aparicio committed Dec 19, 2016
1 parent 71c06a5 commit bd85a6d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/librustc_back/target/mod.rs
Expand Up @@ -267,6 +267,9 @@ pub struct TargetOptions {
/// user-defined libraries.
pub post_link_args: Vec<String>,

/// Extra arguments to pass to the external assembler (when used)
pub asm_args: Vec<String>,

/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
/// to "generic".
pub cpu: String,
Expand Down Expand Up @@ -394,6 +397,7 @@ impl Default for TargetOptions {
ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(),
pre_link_args: Vec::new(),
post_link_args: Vec::new(),
asm_args: Vec::new(),
cpu: "generic".to_string(),
features: "".to_string(),
dynamic_linking: false,
Expand Down Expand Up @@ -561,6 +565,7 @@ impl Target {
key!(late_link_args, list);
key!(post_link_objects, list);
key!(post_link_args, list);
key!(asm_args, list);
key!(cpu);
key!(features);
key!(dynamic_linking, bool);
Expand Down Expand Up @@ -723,6 +728,7 @@ impl ToJson for Target {
target_option_val!(late_link_args);
target_option_val!(post_link_objects);
target_option_val!(post_link_args);
target_option_val!(asm_args);
target_option_val!(cpu);
target_option_val!(features);
target_option_val!(dynamic_linking);
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_trans/back/write.rs
Expand Up @@ -1085,6 +1085,10 @@ fn run_work_multithreaded(sess: &Session,
pub fn run_assembler(sess: &Session, outputs: &OutputFilenames) {
let (pname, mut cmd, _) = get_linker(sess);

for arg in &sess.target.target.options.asm_args {
cmd.arg(arg);
}

cmd.arg("-c").arg("-o").arg(&outputs.path(OutputType::Object))
.arg(&outputs.temp_path(OutputType::Assembly, None));
debug!("{:?}", cmd);
Expand Down

0 comments on commit bd85a6d

Please sign in to comment.