libafl_cc: -fsanitize=fuzzer is an alias to --libafl (#518)
* libafl_cc: -fsanitize=fuzzer is an alias to --libafl * no link runtime
This commit is contained in:
parent
465275aecb
commit
0062bab412
@ -220,5 +220,9 @@ pub const CLANGXX_PATH: &str = \"clang++\";
|
||||
);
|
||||
}
|
||||
|
||||
cc::Build::new()
|
||||
.file(src_dir.join("no-link-rt.c"))
|
||||
.compile("no-link-rt");
|
||||
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
}
|
||||
|
@ -119,14 +119,26 @@ impl CompilerWrapper for ClangWrapper {
|
||||
linking = false;
|
||||
}
|
||||
|
||||
let mut suppress_linking = 0;
|
||||
for arg in &args[1..] {
|
||||
match arg.as_ref() {
|
||||
"--libafl-no-link" => {
|
||||
linking = false;
|
||||
suppress_linking += 1;
|
||||
self.has_libafl_arg = true;
|
||||
continue;
|
||||
}
|
||||
"--libafl" => {
|
||||
suppress_linking += 1337;
|
||||
self.has_libafl_arg = true;
|
||||
continue;
|
||||
}
|
||||
"-fsanitize=fuzzer-no-link" => {
|
||||
suppress_linking += 1;
|
||||
self.has_libafl_arg = true;
|
||||
continue;
|
||||
}
|
||||
"-fsanitize=fuzzer" => {
|
||||
suppress_linking += 1337;
|
||||
self.has_libafl_arg = true;
|
||||
continue;
|
||||
}
|
||||
@ -140,6 +152,17 @@ impl CompilerWrapper for ClangWrapper {
|
||||
};
|
||||
new_args.push(arg.as_ref().to_string());
|
||||
}
|
||||
if linking && suppress_linking > 0 && suppress_linking < 1337 {
|
||||
linking = false;
|
||||
new_args.push(
|
||||
PathBuf::from(env!("OUT_DIR"))
|
||||
.join(format!("{}no-link-rt.{}", LIB_PREFIX, LIB_EXT))
|
||||
.into_os_string()
|
||||
.into_string()
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
self.linking = linking;
|
||||
|
||||
if self.optimize {
|
||||
|
36
libafl_cc/src/no-link-rt.c
Normal file
36
libafl_cc/src/no-link-rt.c
Normal file
@ -0,0 +1,36 @@
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t* __afl_area_ptr;
|
||||
uint8_t* __afl_acc_memop_ptr;
|
||||
|
||||
void __libafl_targets_cmplog_instructions(uintptr_t k, uint8_t shape, uint64_t arg1, uint64_t arg2) {
|
||||
(void)k;
|
||||
(void)shape;
|
||||
(void)arg1;
|
||||
(void)arg2;
|
||||
}
|
||||
|
||||
void __cmplog_rtn_hook(uint8_t *ptr1, uint8_t *ptr2) {
|
||||
(void)ptr1;
|
||||
(void)ptr2;
|
||||
}
|
||||
|
||||
void __cmplog_rtn_gcc_stdstring_cstring(uint8_t *stdstring, uint8_t *cstring) {
|
||||
(void)stdstring;
|
||||
(void)cstring;
|
||||
}
|
||||
|
||||
void __cmplog_rtn_gcc_stdstring_stdstring(uint8_t *stdstring1, uint8_t *stdstring2) {
|
||||
(void)stdstring1;
|
||||
(void)stdstring2;
|
||||
}
|
||||
|
||||
void __cmplog_rtn_llvm_stdstring_cstring(uint8_t *stdstring, uint8_t *cstring) {
|
||||
(void)stdstring;
|
||||
(void)cstring;
|
||||
}
|
||||
|
||||
void __cmplog_rtn_llvm_stdstring_stdstring(uint8_t *stdstring1, uint8_t *stdstring2) {
|
||||
(void)stdstring1;
|
||||
(void)stdstring2;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user