aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-05 20:10:54 +0200
committervan Hauser <vh@thc.org>2020-05-05 20:10:54 +0200
commit00683d06c2dc4a021929f25c86b8b426542c4e40 (patch)
tree5fd7a27f9e002ce1b158fe663828cfaf56714c1b
parenta38980c80babbb75038766c49774effc0bfa8222 (diff)
downloadafl++-00683d06c2dc4a021929f25c86b8b426542c4e40.tar.gz
fix LTO mode
-rw-r--r--TODO.md3
-rw-r--r--llvm_mode/afl-llvm-lto-instrumentation.so.cc16
-rw-r--r--llvm_mode/afl-llvm-pass.so.cc3
3 files changed, 9 insertions, 13 deletions
diff --git a/TODO.md b/TODO.md
index f326b6c7..dd88dcc2 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,7 +2,8 @@
## Roadmap 2.65+
- - AFL_MAP_SIZE for afl-llvm-pass, qemu_mode and unicorn_mode
+ - InsTrim mode for LTO solution
+ - AFL_MAP_SIZE for qemu_mode and unicorn_mode
- random crc32 HASH_CONST per run? because with 65536 paths we have collisions
- namespace for targets? e.g. network
- libradamsa as a custom module?
diff --git a/llvm_mode/afl-llvm-lto-instrumentation.so.cc b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
index 2811d98e..838e45af 100644
--- a/llvm_mode/afl-llvm-lto-instrumentation.so.cc
+++ b/llvm_mode/afl-llvm-lto-instrumentation.so.cc
@@ -690,8 +690,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
if (map_addr) {
GlobalVariable *AFLMapAddrFixed = new GlobalVariable(
- M, Int64Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_map_addr",
- 0, GlobalVariable::GeneralDynamicTLSModel, 0, false);
+ M, Int64Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_map_addr");
ConstantInt *MapAddr = ConstantInt::get(Int64Ty, map_addr);
StoreInst * StoreMapAddr = IRB.CreateStore(MapAddr, AFLMapAddrFixed);
StoreMapAddr->setMetadata(M.getMDKindID("nosanitize"),
@@ -706,8 +705,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
if (afl_global_id % 8) write_loc = (((afl_global_id + 8) >> 3) << 3);
GlobalVariable *AFLFinalLoc = new GlobalVariable(
- M, Int32Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_final_loc",
- 0, GlobalVariable::GeneralDynamicTLSModel, 0, false);
+ M, Int32Ty, true, GlobalValue::ExternalLinkage, 0, "__afl_final_loc");
ConstantInt *const_loc = ConstantInt::get(Int32Ty, write_loc);
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),
@@ -756,10 +754,9 @@ bool AFLLTOPass::runOnModule(Module &M) {
}
- GlobalVariable *AFLDictionaryLen = new GlobalVariable(
- M, Int32Ty, false, GlobalValue::ExternalLinkage, 0,
- "__afl_dictionary_len", 0, GlobalVariable::GeneralDynamicTLSModel,
- 0, false);
+ GlobalVariable *AFLDictionaryLen =
+ new GlobalVariable(M, Int32Ty, false, GlobalValue::ExternalLinkage,
+ 0, "__afl_dictionary_len");
ConstantInt *const_len = ConstantInt::get(Int32Ty, offset);
StoreInst *StoreDictLen = IRB.CreateStore(const_len, AFLDictionaryLen);
StoreDictLen->setMetadata(M.getMDKindID("nosanitize"),
@@ -770,8 +767,7 @@ bool AFLLTOPass::runOnModule(Module &M) {
M, ArrayTy, true, GlobalValue::ExternalLinkage,
ConstantDataArray::get(C,
*(new ArrayRef<char>((char *)ptr, offset))),
- "__afl_internal_dictionary", 0,
- GlobalVariable::GeneralDynamicTLSModel, 0, false);
+ "__afl_internal_dictionary");
AFLInternalDictionary->setInitializer(ConstantDataArray::get(
C, *(new ArrayRef<char>((char *)ptr, offset))));
AFLInternalDictionary->setConstant(true);
diff --git a/llvm_mode/afl-llvm-pass.so.cc b/llvm_mode/afl-llvm-pass.so.cc
index c0391b04..0d9e0aba 100644
--- a/llvm_mode/afl-llvm-pass.so.cc
+++ b/llvm_mode/afl-llvm-pass.so.cc
@@ -583,8 +583,7 @@ bool AFLCoverage::runOnModule(Module &M) {
GlobalVariable *AFLFinalLoc = new GlobalVariable(
M, Int32Ty, true, GlobalValue::ExternalLinkage, 0,
- "__afl_final_loc", 0, GlobalVariable::GeneralDynamicTLSModel, 0,
- false);
+ "__afl_final_loc");
ConstantInt *const_loc = ConstantInt::get(Int32Ty, map_size);
StoreInst * StoreFinalLoc = IRB.CreateStore(const_loc, AFLFinalLoc);
StoreFinalLoc->setMetadata(M.getMDKindID("nosanitize"),