Skip to content

Commit abe1b8e

Browse files
rename sed_cmds to patch-llvm.sh (#745)
Make the name and location of the script that patches LLVM to include our llvm frontend more meaningful. Signed-off-by: David Korczynski <[email protected]> Signed-off-by: David Korczynski <[email protected]>
1 parent 508abcc commit abe1b8e

File tree

6 files changed

+19
-7
lines changed

6 files changed

+19
-7
lines changed

build_all.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ else
5454
git checkout release/14.x
5555

5656
echo "Applying diffs to insert Fuzz Introspector plugin in the LLVM pipeline"
57-
$BASE/sed_cmds.sh
57+
$BASE/frontends/llvm/patch-llvm.sh
5858

5959
# Now copy over the LLVM code we have
6060
# This includes our inspector pass and the files included.

doc/Architecture.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ PassBuilder::buildLTODefaultPipeline(OptimizationLevel Level,
7878
MPM.addPass(FuzzIntrospectorPass());
7979
```
8080
i.e. we only add `MPM.addPass(FuzzIntrospectorPass());` to the LTO pass builder pipeline. All
81-
of the LLVM patches are given in [sed_cmds.sh](/sed_cmds.sh)
81+
of the LLVM patches are given in [patch-llvm.sh](/frontends/llvm/patch-llvm.sh)
8282

8383
### Output of LLVM plugin
8484
The output of the LLVM pass is composed of two files for each fuzzer executable

doc/LocalBuild.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ git clone https://github.com/llvm/llvm-project/
6767
cd llvm-project/
6868

6969
# Patch Clang to run fuzz introspector
70-
../../sed_cmds.sh
70+
../../frontends/llvm/patch-llvm.sh
7171
cp -rf ../../frontends/llvm/include/llvm/Transforms/FuzzIntrospector/ ./llvm/include/llvm/Transforms/FuzzIntrospector
7272
cp -rf ../../frontends/llvm/lib/Transforms/FuzzIntrospector ./llvm/lib/Transforms/FuzzIntrospector
7373
cd ../
File renamed without changes.

oss_fuzz_integration/build_all_custom_images.sh

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ rm -rf ./oss-fuzz/infra/base-images/base-clang/fuzz-introspector/
3535
mkdir ./oss-fuzz/infra/base-images/base-clang/fuzz-introspector/
3636

3737
cp -rf ../frontends ./oss-fuzz/infra/base-images/base-clang/fuzz-introspector/frontends
38-
cp ../sed_cmds.sh ./oss-fuzz/infra/base-images/base-clang/fuzz-introspector/sed_cmds.sh
3938
cp -rf ../src ./oss-fuzz/infra/base-images/base-clang/fuzz-introspector/src
4039
cp -rf ../src ./oss-fuzz/infra/base-images/base-builder/src
4140

oss_fuzz_integration/oss-fuzz-patches.diff

+16-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/infra/base-images/base-builder/Dockerfile b/infra/base-images/base-builder/Dockerfile
2-
index 12c08499..9808589b 100644
2+
index d77a9486..7e88da2b 100644
33
--- a/infra/base-images/base-builder/Dockerfile
44
+++ b/infra/base-images/base-builder/Dockerfile
5-
@@ -162,5 +162,9 @@ COPY cargo compile compile_afl compile_libfuzzer compile_honggfuzz \
5+
@@ -161,5 +161,9 @@ COPY cargo compile compile_afl compile_libfuzzer compile_honggfuzz \
66
COPY llvmsymbol.diff $SRC
77
COPY detect_repo.py /opt/cifuzz/
88
COPY bazel.bazelrc /root/.bazelrc
@@ -13,7 +13,7 @@ index 12c08499..9808589b 100644
1313

1414
CMD ["compile"]
1515
diff --git a/infra/base-images/base-clang/Dockerfile b/infra/base-images/base-clang/Dockerfile
16-
index aa4eca97..1a3a122f 100644
16+
index 6cc06bee..1e4a2496 100644
1717
--- a/infra/base-images/base-clang/Dockerfile
1818
+++ b/infra/base-images/base-clang/Dockerfile
1919
@@ -45,6 +45,8 @@ RUN apt-get update && apt-get install -y git && \
@@ -25,6 +25,19 @@ index aa4eca97..1a3a122f 100644
2525
RUN /root/checkout_build_install_llvm.sh
2626
RUN rm /root/checkout_build_install_llvm.sh
2727

28+
diff --git a/infra/base-images/base-clang/checkout_build_install_llvm.sh b/infra/base-images/base-clang/checkout_build_install_llvm.sh
29+
index 2b403cfd..65f0ea55 100755
30+
--- a/infra/base-images/base-clang/checkout_build_install_llvm.sh
31+
+++ b/infra/base-images/base-clang/checkout_build_install_llvm.sh
32+
@@ -129,7 +129,7 @@ cp -rf /fuzz-introspector/frontends/llvm/lib/Transforms/FuzzIntrospector ./llvm/
33+
34+
# LLVM currently does not support dynamically loading LTO passes. Thus, we
35+
# hardcode it into Clang instead. Ref: https://reviews.llvm.org/D77704
36+
-/fuzz-introspector/sed_cmds.sh
37+
+/fuzz-introspector/frontends/llvm/patch-llvm.sh
38+
cd $OLD_WORKING_DIR
39+
40+
mkdir -p $WORK/llvm-stage2 $WORK/llvm-stage1
2841
diff --git a/infra/base-images/base-runner/Dockerfile b/infra/base-images/base-runner/Dockerfile
2942
index bc034e19..929e3499 100755
3043
--- a/infra/base-images/base-runner/Dockerfile

0 commit comments

Comments
 (0)