Merge pull request #1713 from kenohassler/wafl-mode

llvm-lto: allow skipping initialisation
This commit is contained in:
van Hauser
2023-04-25 08:21:42 +02:00
committed by GitHub
3 changed files with 8 additions and 3 deletions

View File

@ -156,7 +156,7 @@ Available options:
- LTO - LTO instrumentation - LTO - LTO instrumentation
- NATIVE - clang's original pcguard based instrumentation - NATIVE - clang's original pcguard based instrumentation
- NGRAM-x - deeper previous location coverage (from NGRAM-2 up to NGRAM-16) - NGRAM-x - deeper previous location coverage (from NGRAM-2 up to NGRAM-16)
- PCGUARD - our own pcgard based instrumentation (default) - PCGUARD - our own pcguard based instrumentation (default)
#### CMPLOG #### CMPLOG
@ -240,7 +240,9 @@ combined.
the default `0x10000`. A value of 0 or empty sets the map address to be the default `0x10000`. A value of 0 or empty sets the map address to be
dynamic (the original AFL way, which is slower). dynamic (the original AFL way, which is slower).
- `AFL_LLVM_MAP_DYNAMIC` sets the shared memory address to be dynamic. - `AFL_LLVM_MAP_DYNAMIC` sets the shared memory address to be dynamic.
- `AFL_LLVM_LTO_SKIPINIT` skips adding initialization code. Some global vars
(e.g. the highest location ID) are not injected. Needed to instrument with
[WAFL](https://github.com/fgsect/WAFL.git).
For more information, see For more information, see
[instrumentation/README.lto.md](../instrumentation/README.lto.md). [instrumentation/README.lto.md](../instrumentation/README.lto.md).

View File

@ -1005,7 +1005,8 @@ bool ModuleSanitizerCoverageLTO::instrumentModule(
// afl++ START // afl++ START
if (dFile.is_open()) dFile.close(); if (dFile.is_open()) dFile.close();
if (!getenv("AFL_LLVM_LTO_DONTWRITEID") || dictionary.size() || map_addr) { if (!getenv("AFL_LLVM_LTO_SKIPINIT") &&
(!getenv("AFL_LLVM_LTO_DONTWRITEID") || dictionary.size() || map_addr)) {
// yes we could create our own function, insert it into ctors ... // yes we could create our own function, insert it into ctors ...
// but this would be a pain in the butt ... so we use afl-llvm-rt-lto.o // but this would be a pain in the butt ... so we use afl-llvm-rt-lto.o

View File

@ -2099,6 +2099,8 @@ int main(int argc, char **argv, char **envp) {
"bb\n" "bb\n"
" AFL_REAL_LD: use this lld linker instead of the compiled in " " AFL_REAL_LD: use this lld linker instead of the compiled in "
"path\n" "path\n"
" AFL_LLVM_LTO_SKIPINIT: don't inject initialization code "
"(used in WAFL mode)\n"
"If anything fails - be sure to read README.lto.md!\n"); "If anything fails - be sure to read README.lto.md!\n");
#endif #endif