Skip to content

Commit 8698378

Browse files
authored
Add V8 integration (#13903)
1 parent ffece2f commit 8698378

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

projects/v8/Dockerfile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
#
15+
################################################################################
16+
17+
FROM gcr.io/oss-fuzz-base/base-builder
18+
RUN apt-get update && \
19+
apt-get install --no-install-recommends -y \
20+
lsb-release sudo pkg-config file libc++-18-dev libc++abi-18-dev
21+
RUN git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
22+
ENV PATH=/src/depot_tools:$PATH
23+
RUN fetch v8
24+
WORKDIR v8
25+
26+
RUN ./build/install-build-deps.sh --no-prompt
27+
COPY build.sh *.cc $SRC/
28+
29+
ENV CLANG_TOOLCHAIN $SRC/v8/third_party/llvm-build/Release+Asserts
30+
ENV CLANG_VERSION 21
31+
32+
# Temporary hack: use an indexer built against LLVM 21.
33+
ADD https://clusterfuzz-builds.storage.googleapis.com/oss-fuzz-artifacts/indexer-21 /opt/indexer/indexer
34+
RUN chmod +x /opt/indexer/indexer

projects/v8/build.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash -eu
2+
# Copyright 2025 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
################################################################################
17+
18+
# Configure arguments for gn build
19+
ARGS='is_asan = true
20+
is_component_build = false
21+
use_clang_modules = false
22+
is_debug = true
23+
symbol_level = 2
24+
forbid_non_component_debug_builds = false
25+
use_debug_fission = false
26+
use_dwarf5 = true
27+
target_cpu = "x64"
28+
target_os = "linux"
29+
use_reclient = false
30+
use_remoteexec = false
31+
use_siso = false
32+
treat_warnings_as_errors = false
33+
libcxx_is_shared = false
34+
v8_enable_backtrace = true
35+
v8_enable_slow_dchecks = false
36+
v8_optimized_debug = false
37+
v8_enable_fast_mksnapshot = true'
38+
39+
if [[ -n "${INDEXER_BUILD:-}" ]]; then
40+
ARGS="$ARGS clang_base_path=\"/opt/toolchain\""
41+
fi
42+
43+
# Generate ninja file for build
44+
gn gen out/fuzz --args="$ARGS"
45+
echo $SANITIZER
46+
# Build binary
47+
ninja -C out/fuzz d8 -j$(nproc)
48+
49+
# Copy binary to $OUT
50+
cp ./out/fuzz/{d8,snapshot_blob.bin} $OUT

projects/v8/project.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
homepage: "https://chromium.googlesource.com/v8/v8"
2+
language: c++
3+
main_repo: "https://chromium.googlesource.com/v8/v8"
4+
fuzzing_engines:
5+
- none
6+
sanitizers:
7+
- address

0 commit comments

Comments
 (0)