diff --git a/libafl_cc/src/clang.rs b/libafl_cc/src/clang.rs index d731c1b100..0b609685ea 100644 --- a/libafl_cc/src/clang.rs +++ b/libafl_cc/src/clang.rs @@ -326,38 +326,34 @@ impl CompilerWrapper for ClangWrapper { args.push("-flegacy-pass-manager".into()); } } - - if !self.linking { - for pass in &self.passes { - use_pass = true; - if self.use_new_pm { - // https://github.com/llvm/llvm-project/issues/56137 - // Need this -Xclang -load -Xclang -.so thing even with the new PM - // to pass the arguments to LLVM Passes - args.push("-Xclang".into()); - args.push("-load".into()); - args.push("-Xclang".into()); - args.push(pass.path().into_os_string().into_string().unwrap()); - args.push("-Xclang".into()); - args.push(format!( - "-fpass-plugin={}", - pass.path().into_os_string().into_string().unwrap() - )); - } else { - args.push("-Xclang".into()); - args.push("-load".into()); - args.push("-Xclang".into()); - args.push(pass.path().into_os_string().into_string().unwrap()); - } - } - if !self.is_asm && !self.passes.is_empty() { - for passes_arg in &self.passes_args { - args.push("-mllvm".into()); - args.push(passes_arg.into()); - } + for pass in &self.passes { + use_pass = true; + if self.use_new_pm { + // https://github.com/llvm/llvm-project/issues/56137 + // Need this -Xclang -load -Xclang -.so thing even with the new PM + // to pass the arguments to LLVM Passes + args.push("-Xclang".into()); + args.push("-load".into()); + args.push("-Xclang".into()); + args.push(pass.path().into_os_string().into_string().unwrap()); + args.push("-Xclang".into()); + args.push(format!( + "-fpass-plugin={}", + pass.path().into_os_string().into_string().unwrap() + )); + } else { + args.push("-Xclang".into()); + args.push("-load".into()); + args.push("-Xclang".into()); + args.push(pass.path().into_os_string().into_string().unwrap()); + } + } + if !self.is_asm && !self.passes.is_empty() { + for passes_arg in &self.passes_args { + args.push("-mllvm".into()); + args.push(passes_arg.into()); } } - if self.linking { if self.x_set { args.push("-x".into());