]> git.lizzy.rs Git - rust.git/commitdiff
Actually pass target LLVM args to LLVM
authorJethro Beekman <jethro@fortanix.com>
Sat, 18 Jan 2020 00:11:52 +0000 (16:11 -0800)
committerJethro Beekman <jethro@fortanix.com>
Sat, 18 Jan 2020 00:11:52 +0000 (16:11 -0800)
src/librustc_codegen_llvm/llvm_util.rs

index 52613fef7e612b0def79aa7d451130e96adbc9c1..4823fe10c463fee932a7b86b3a1acd4b1497f935 100644 (file)
@@ -58,9 +58,10 @@ fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
 
     let cg_opts = sess.opts.cg.llvm_args.iter();
     let tg_opts = sess.target.target.options.llvm_args.iter();
+    let sess_args = cg_opts.chain(tg_opts);
 
     let user_specified_args: FxHashSet<_> =
-        cg_opts.chain(tg_opts).map(|s| llvm_arg_to_arg_name(s)).filter(|s| s.len() > 0).collect();
+        sess_args.clone().map(|s| llvm_arg_to_arg_name(s)).filter(|s| s.len() > 0).collect();
 
     {
         // This adds the given argument to LLVM. Unless `force` is true
@@ -107,7 +108,7 @@ fn llvm_arg_to_arg_name(full_arg: &str) -> &str {
         // during inlining. Unfortunately these may block other optimizations.
         add("-preserve-alignment-assumptions-during-inlining=false", false);
 
-        for arg in &sess.opts.cg.llvm_args {
+        for arg in sess_args {
             add(&(*arg), true);
         }
     }