Don't add llvm pass args when there're no passes & Don't pass -mllvm
arguments when compiling asm files (#1266)
* f * fix * clp
This commit is contained in:
parent
91b10f8c40
commit
b9a540561b
@ -74,6 +74,7 @@ pub struct ClangWrapper {
|
|||||||
|
|
||||||
name: String,
|
name: String,
|
||||||
is_cpp: bool,
|
is_cpp: bool,
|
||||||
|
is_asm: bool,
|
||||||
linking: bool,
|
linking: bool,
|
||||||
shared: bool,
|
shared: bool,
|
||||||
x_set: bool,
|
x_set: bool,
|
||||||
@ -143,6 +144,13 @@ impl CompilerWrapper for ClangWrapper {
|
|||||||
let mut suppress_linking = 0;
|
let mut suppress_linking = 0;
|
||||||
let mut i = 1;
|
let mut i = 1;
|
||||||
while i < args.len() {
|
while i < args.len() {
|
||||||
|
if std::path::Path::new(args[i].as_ref())
|
||||||
|
.extension()
|
||||||
|
.map_or(false, |ext| ext.eq_ignore_ascii_case("s"))
|
||||||
|
{
|
||||||
|
self.is_asm = true;
|
||||||
|
}
|
||||||
|
|
||||||
match args[i].as_ref() {
|
match args[i].as_ref() {
|
||||||
"--libafl-no-link" => {
|
"--libafl-no-link" => {
|
||||||
suppress_linking += 1;
|
suppress_linking += 1;
|
||||||
@ -336,9 +344,11 @@ impl CompilerWrapper for ClangWrapper {
|
|||||||
args.push(pass.path().into_os_string().into_string().unwrap());
|
args.push(pass.path().into_os_string().into_string().unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for passes_arg in &self.passes_args {
|
if !self.is_asm && !self.passes.is_empty() {
|
||||||
args.push("-mllvm".into());
|
for passes_arg in &self.passes_args {
|
||||||
args.push(passes_arg.into());
|
args.push("-mllvm".into());
|
||||||
|
args.push(passes_arg.into());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if self.linking {
|
if self.linking {
|
||||||
if self.x_set {
|
if self.x_set {
|
||||||
@ -399,6 +409,7 @@ impl ClangWrapper {
|
|||||||
wrapped_cxx: CLANGXX_PATH.into(),
|
wrapped_cxx: CLANGXX_PATH.into(),
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
is_cpp: false,
|
is_cpp: false,
|
||||||
|
is_asm: false,
|
||||||
linking: false,
|
linking: false,
|
||||||
shared: false,
|
shared: false,
|
||||||
x_set: false,
|
x_set: false,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user