Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Nodejs] initial integration. #3860

Merged
merged 8 commits into from
Jun 9, 2020
Prev Previous commit
utilise all cores and a bit nicer structure in build.
DavidKorczynski committed Jun 7, 2020
commit f030d2314da9bad7db408b83ec56fbd421dc2e50
31 changes: 13 additions & 18 deletions projects/nodejs/build.sh
Original file line number Diff line number Diff line change
@@ -14,38 +14,33 @@
# limitations under the License.
#
################################################################################
cd node
cd $SRC/node

# Build node
export LDFLAGS="$CXXFLAGS"
export LD="$CXX"

./configure --without-intl --without-node-code-cache --without-dtrace --without-snapshot --without-ssl
make -j4
make -j$(nproc)

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

# Compilation settings
# 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"

# Includes
INCLUDES="-I./ -I../deps/v8/include -I../deps/uv/include"

$CXX -o fuzzers/fuzz_url.o fuzzers/fuzz_url.cc $CXXFLAGS $CMDS $INCLUDES \
# 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

cd /src/node/out
rm -rf ./library_files && mkdir library_files
find . -name "*.a" -exec cp {} ./library_files/ \;

# 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 \
../src/fuzzers/fuzz_url.o ./library_files/*.a \
fuzz_url.o ./library_files/*.a \
-latomic -lm -ldl -Wl,--end-group