Skip to content

Commit bd85a6d

Browse files
author
Jorge Aparicio
committed
target spec: add an asm-args field to pass arguments to the external ..
assembler
1 parent 71c06a5 commit bd85a6d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/librustc_back/target/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,9 @@ pub struct TargetOptions {
267267
/// user-defined libraries.
268268
pub post_link_args: Vec<String>,
269269

270+
/// Extra arguments to pass to the external assembler (when used)
271+
pub asm_args: Vec<String>,
272+
270273
/// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults
271274
/// to "generic".
272275
pub cpu: String,
@@ -394,6 +397,7 @@ impl Default for TargetOptions {
394397
ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(),
395398
pre_link_args: Vec::new(),
396399
post_link_args: Vec::new(),
400+
asm_args: Vec::new(),
397401
cpu: "generic".to_string(),
398402
features: "".to_string(),
399403
dynamic_linking: false,
@@ -561,6 +565,7 @@ impl Target {
561565
key!(late_link_args, list);
562566
key!(post_link_objects, list);
563567
key!(post_link_args, list);
568+
key!(asm_args, list);
564569
key!(cpu);
565570
key!(features);
566571
key!(dynamic_linking, bool);
@@ -723,6 +728,7 @@ impl ToJson for Target {
723728
target_option_val!(late_link_args);
724729
target_option_val!(post_link_objects);
725730
target_option_val!(post_link_args);
731+
target_option_val!(asm_args);
726732
target_option_val!(cpu);
727733
target_option_val!(features);
728734
target_option_val!(dynamic_linking);

src/librustc_trans/back/write.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@ fn run_work_multithreaded(sess: &Session,
10851085
pub fn run_assembler(sess: &Session, outputs: &OutputFilenames) {
10861086
let (pname, mut cmd, _) = get_linker(sess);
10871087

1088+
for arg in &sess.target.target.options.asm_args {
1089+
cmd.arg(arg);
1090+
}
1091+
10881092
cmd.arg("-c").arg("-o").arg(&outputs.path(OutputType::Object))
10891093
.arg(&outputs.temp_path(OutputType::Assembly, None));
10901094
debug!("{:?}", cmd);

0 commit comments

Comments
 (0)