New Pass Manager Arguments (#724)

* new pm arguments

* enable abgeana's code
This commit is contained in:
Dongjia Zhang 2022-08-18 19:26:52 +02:00 committed by GitHub
parent eac7307c5a
commit 93c361bcd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 13 deletions

View File

@ -204,19 +204,7 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
.expect("Could not parse LIBAFL_ACCOUNTING_MAP_SIZE"); .expect("Could not parse LIBAFL_ACCOUNTING_MAP_SIZE");
cxxflags.push(format!("-DLIBAFL_ACCOUNTING_MAP_SIZE={}", acc_map_size)); cxxflags.push(format!("-DLIBAFL_ACCOUNTING_MAP_SIZE={}", acc_map_size));
let llvm_version = match find_llvm_config() let llvm_version = find_llvm_version();
.unwrap()
.split('-')
.collect::<Vec<&str>>()
.get(2)
{
Some(ver) => ver.parse::<usize>().ok(),
None => None,
};
// The approach below causes issues with arguments to optimization passes.
// An example is fuzzers/libfuzzer_libpng_accounting which passes -granularity=FUNC.
// In CI/CD, the new pass manager is not used. For now, maintain the same behavior.
//let llvm_version = find_llvm_version();
if let Some(ver) = llvm_version { if let Some(ver) = llvm_version {
if ver >= 14 { if ver >= 14 {

View File

@ -294,6 +294,14 @@ impl CompilerWrapper for ClangWrapper {
} }
for pass in &self.passes { for pass in &self.passes {
if self.use_new_pm { if self.use_new_pm {
// https://github.com/llvm/llvm-project/issues/56137
// Need this -Xclang -load -Xclang -<pass>.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!( args.push(format!(
"-fpass-plugin={}", "-fpass-plugin={}",
pass.path().into_os_string().into_string().unwrap() pass.path().into_os_string().into_string().unwrap()