Skip to content

Commit

Permalink
[nodejs] Simplify build process as most work is now upstreamed. (#4327)
Browse files Browse the repository at this point in the history
* Build of nodejs has now been upstreamed and this commit simplifies the build for nodejs to the new updates.

* We only support libfuzzer for now.

* Simplified the build script.
  • Loading branch information
DavidKorczynski authored Aug 17, 2020
1 parent 56525dc commit 0acecb4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 25 deletions.
2 changes: 0 additions & 2 deletions projects/nodejs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,3 @@ RUN apt-get install -y flex bison build-essential
RUN git clone --recursive --depth 1 https://github.com/nodejs/node
WORKDIR $SRC
COPY build.sh $SRC/

COPY fuzz_url.cc $SRC/
26 changes: 3 additions & 23 deletions projects/nodejs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,8 @@ cd $SRC/node
# Build node
export LDFLAGS="$CXXFLAGS"
export LD="$CXX"
./configure --without-intl --without-node-code-cache --without-dtrace --without-snapshot --without-ssl
./configure --experimental-quic --with-ossfuzz
make -j$(nproc)

# Gather static libraries
cd $SRC/node/out
rm -rf ./library_files && mkdir library_files
find . -name "*.a" -exec cp {} ./library_files/ \;

# Build the fuzzers
CMDS="-D__STDC_FORMAT_MACROS -D__POSIX__ -DNODE_HAVE_I18N_SUPPORT=1 \
-DNODE_ARCH=\"x64\" -DNODE_PLATFORM=\"linux\" -DNODE_WANT_INTERNALS=1"
INCLUDES="-I../src -I../deps/v8/include -I../deps/uv/include"

# Compilation
$CXX -o fuzz_url.o $SRC/fuzz_url.cc $CXXFLAGS $CMDS $INCLUDES \
-pthread -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -c

# Linking
$CXX -o $OUT/fuzz_url $LIB_FUZZING_ENGINE $CXXFLAGS \
-rdynamic -Wl,-z,noexecstack,-z,relro,-z,now \
-pthread -Wl,--start-group \
./Release/obj.target/cctest/src/node_snapshot_stub.o \
./Release/obj.target/cctest/src/node_code_cache_stub.o \
fuzz_url.o ./library_files/*.a \
-latomic -lm -ldl -Wl,--end-group
# Copy all fuzzers to OUT folder
cp out/Release/fuzz_* ${OUT}/
2 changes: 2 additions & 0 deletions projects/nodejs/project.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
homepage: "https://nodejs.org"
primary_contact: "[email protected]"
language: c++
fuzzing_engines:
- libfuzzer
sanitizers:
- address
auto_ccs:
Expand Down

0 comments on commit 0acecb4

Please sign in to comment.