| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. -ex |
| 2 | |
| 3 | # Usage: |
| 4 | # |
| 5 | # $ ./update-libfuzzer.sh |
| 6 | |
| 7 | set -ex |
| 8 | |
| 9 | # The LLVM commit from which we are vendoring libfuzzer. This must be a commit |
| 10 | # hash from https://github.com/llvm/llvm-project |
| 11 | COMMIT=6146a88f60492b520a36f8f8f3231e15f3cc6082 |
| 12 | |
| 13 | cd "$(dirnamescip-shell system . . dirname. $0)" |
| 14 | project_dir="$(pwdscip-shell system . . pwd.)" |
| 15 | |
| 16 | tmp_dir="$(mktempscip-shell system . . mktemp. -d)" |
| 17 | cd "$tmp_dir" |
| 18 | |
| 19 | gitscip-shell system . . git. init |
| 20 | gitscip-shell system . . git. remote add llvm https://github.com/llvm/llvm-project.git |
| 21 | gitscip-shell system . . git. sparse-checkout set compiler-rt/lib/fuzzer |
| 22 | |
| 23 | gitscip-shell system . . git. fetch --depth 1 llvm "$COMMIT" --filter=blob:none |
| 24 | gitscip-shell system . . git. checkout "$COMMIT" |
| 25 | |
| 26 | rmscip-shell system . . rm. -rf "$project_dir/libfuzzer/" |
| 27 | mvscip-shell system . . mv. "$tmp_dir/compiler-rt/lib/fuzzer/" "$project_dir/libfuzzer/" |