about summary refs log tree commit diff
path: root/src/librustc_target
diff options
context:
space:
mode:
authorJethro Beekman <jethro@fortanix.com>2020-01-09 16:40:40 +0100
committerJethro Beekman <jethro@fortanix.com>2020-01-10 08:12:55 +0100
commitafced941555ecaa7fff2e11c8396bca58384d760 (patch)
treeb4a3e43460b5a154c3f09e83cd5b796eb62ce942 /src/librustc_target
parentadc65725004c8aac16392fe4052c3e347181157d (diff)
Allow specifying LLVM args in target specifications
Diffstat (limited to 'src/librustc_target')
-rw-r--r--src/librustc_target/spec/mod.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs
index f08634cc770..528ffdf93a0 100644
--- a/src/librustc_target/spec/mod.rs
+++ b/src/librustc_target/spec/mod.rs
@@ -805,6 +805,9 @@ pub struct TargetOptions {
 
     /// Whether or not RelaxElfRelocation flag will be passed to the linker
     pub relax_elf_relocations: bool,
+
+    /// Additional arguments to pass to LLVM, similar to the `-C llvm-args` codegen option.
+    pub llvm_args: Vec<String>,
 }
 
 impl Default for TargetOptions {
@@ -893,6 +896,7 @@ impl Default for TargetOptions {
             target_mcount: "mcount".to_string(),
             llvm_abiname: "".to_string(),
             relax_elf_relocations: false,
+            llvm_args: vec![],
         }
     }
 }
@@ -1206,6 +1210,7 @@ impl Target {
         key!(target_mcount);
         key!(llvm_abiname);
         key!(relax_elf_relocations, bool);
+        key!(llvm_args, list);
 
         if let Some(array) = obj.find("abi-blacklist").and_then(Json::as_array) {
             for name in array.iter().filter_map(|abi| abi.as_string()) {
@@ -1433,6 +1438,7 @@ impl ToJson for Target {
         target_option_val!(target_mcount);
         target_option_val!(llvm_abiname);
         target_option_val!(relax_elf_relocations);
+        target_option_val!(llvm_args);
 
         if default.abi_blacklist != self.options.abi_blacklist {
             d.insert(