Skip to content

Commit 37106f2

Browse files
committed
oss-fuzz: convert to static cross-build
This way we can get rid of the pre-generated locale data and the special fuzzers target, which invokes a full gbuild make for every prereqisite, always parsing the whole tree, taking ages. This also reverts: - commit d0780b2 ("fix oss-fuzz build") by adding epubgen and revenge dependencies. - commit ff25d6a ("ofz#41602 fix more build failure"), which shouldn't happen anymore since commit d47628f ("don't want to link to system static libs for DISABLE_DYNLOADING") Change-Id: I3aed9ec62da507254b42e4e7470bae1097b4bc8c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127031 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <[email protected]>
1 parent fa5db38 commit 37106f2

14 files changed

+24
-24
lines changed

Makefile.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,8 +504,6 @@ $(BUILDDIR)/vs-code.code-workspace: $(BUILDDIR)/vs-code.code-workspace.template
504504
@test -e $@ || cp $< $@ && \
505505
cmp -s $@ $< || echo "ATTN: $(@F) differs from $(<F), please check yourself for changes"
506506

507-
fuzzers: StaticLibrary_dtoa StaticLibrary_zlib StaticLibrary_libjpeg-turbo Library_sal Library_salhelper Library_reg Library_store Library_unoidl codemaker Library_cppu Library_i18nlangtag Library_cppuhelper Library_comphelper StaticLibrary_ulingu StaticLibrary_findsofficepath Library_tl Library_basegfx Library_canvastools Library_cppcanvas Library_dbtools Library_deploymentmisc Library_editeng Library_i18nutil Library_localebe1 Library_sax Library_sofficeapp Library_ucbhelper Rdb_services udkapi offapi Library_icg Library_reflection Library_invocadapt Library_bootstrap Library_introspection Library_stocservices Library_xmlreader Library_gcc3_uno instsetoo_native StaticLibrary_boost_locale StaticLibrary_fuzzerstubs StaticLibrary_fuzzer_core StaticLibrary_fuzzer_calc StaticLibrary_fuzzer_draw StaticLibrary_fuzzer_writer StaticLibrary_fuzzer_math Library_forui Library_binaryurp Library_io Library_invocation Library_namingservice Library_proxyfac Library_uuresolver Module_ure Library_wpftwriter Library_sb Library_file Library_avmedia Executable_pptfuzzer Executable_cgmfuzzer Executable_ww2fuzzer Executable_ww6fuzzer Executable_ww8fuzzer Executable_qpwfuzzer Executable_slkfuzzer Executable_fodtfuzzer Executable_fodsfuzzer Executable_fodpfuzzer Executable_xlsfuzzer Executable_scrtffuzzer Executable_wksfuzzer Executable_diffuzzer Executable_docxfuzzer Executable_xlsxfuzzer Executable_pptxfuzzer Executable_htmlfuzzer Executable_rtffuzzer Executable_mmlfuzzer Executable_mtpfuzzer Executable_olefuzzer Executable_lwpfuzzer Executable_hwpfuzzer Executable_wmffuzzer Executable_dxffuzzer Executable_sftfuzzer Executable_svmfuzzer Executable_tiffuzzer Executable_epsfuzzer Executable_jpgfuzzer Executable_metfuzzer Executable_bmpfuzzer Executable_giffuzzer Executable_pngfuzzer Executable_602fuzzer Executable_tgafuzzer Executable_pcxfuzzer Executable_psdfuzzer Executable_ppmfuzzer Executable_pcdfuzzer Executable_rasfuzzer Executable_pctfuzzer Executable_xpmfuzzer Executable_xbmfuzzer Executable_dbffuzzer
508-
509507
endif # MAKE_RESTARTS
510508

511509
# vim: set noet sw=4 ts=4:

bin/oss-fuzz-build.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ echo start at `date -u`
1212
#shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
1313
#the CXX as the linker and need to pass -stdlib=libc++ to build
1414
export CXX="$CXX -stdlib=libc++ -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
15+
export CXX_FOR_BUILD="$CXX"
1516
export CC="$CC -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
17+
export CC_FOR_BUILD="$CC"
1618
#similarly force the -fsanitize etc args in as well as pthread to get
1719
#things to link successfully during the build
1820
export LDFLAGS="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread"
21+
#build-time rsc tool leaks a titch
22+
export ASAN_OPTIONS="detect_leaks=0"
1923

2024
df -h $OUT $WORK
2125

@@ -24,10 +28,7 @@ $SRC/libreoffice/autogen.sh --with-distro=LibreOfficeOssFuzz --with-external-tar
2428

2529
make clean
2630

27-
#build-time rsc tool leaks a titch
28-
export ASAN_OPTIONS="detect_leaks=0"
29-
30-
make fuzzers
31+
make
3132

3233
pushd instdir/program
3334
head -c -14 services.rdb > templateservices.rdb

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3799,7 +3799,7 @@ if test -n "$WIN_MULTI_ARCH" -a -n "$WIN_OTHER_ARCH"; then
37993799
fi
38003800

38013801

3802-
if test "$build_cpu" != "$host_cpu" -o \( "$DISABLE_DYNLOADING" = TRUE -a "$enable_fuzzers" != yes \); then
3802+
if test "$build_cpu" != "$host_cpu" -o "$DISABLE_DYNLOADING" = TRUE; then
38033803
# To allow building Windows multi-arch releases without cross-tooling
38043804
if test "$DISABLE_DYNLOADING" = TRUE -o \( -z "$WIN_MULTI_ARCH" -a -z "$WIN_OTHER_ARCH" \); then
38053805
cross_compiling="yes"
@@ -9574,7 +9574,7 @@ else
95749574
LIBXML_LIBS="${WORKDIR}/UnpackedTarball/libxml2/win32/bin.msvc/libxml2.lib"
95759575
else
95769576
LIBXML_LIBS="-L${WORKDIR}/UnpackedTarball/libxml2/.libs -lxml2"
9577-
if test "$DISABLE_DYNLOADING" = TRUE -a "$ENABLE_FUZZERS" != "TRUE"; then
9577+
if test "$DISABLE_DYNLOADING" = TRUE; then
95789578
LIBXML_LIBS="$LIBXML_LIBS -lm"
95799579
fi
95809580
fi

desktop/Module_desktop.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ $(eval $(call gb_Module_add_targets,desktop,\
100100

101101
else ifeq (,$(filter MACOSX ANDROID iOS HAIKU,$(OS)))
102102

103+
ifeq (,$(filter FUZZERS,$(BUILD_TYPE)))
103104
$(eval $(call gb_Module_add_targets,desktop,\
104105
Executable_oosplash \
105106
))
107+
endif
106108

107109
endif
108110

distro-configs/LibreOfficeOssFuzz.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
--disable-cups
99
--disable-dbus
1010
--disable-dconf
11+
--disable-extensions
1112
--disable-firebird-sdbc
1213
--disable-gio
1314
--disable-gtk3
@@ -29,5 +30,6 @@
2930
--with-locales=en
3031
--with-system-lockfile
3132
--without-fonts
33+
--without-galleries
3234
--without-java
3335
--without-webdav

smoketest/Module_smoketest.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ $(eval $(call gb_Module_Module,smoketest))
1212

1313
ifeq ($(CROSS_COMPILING),)
1414

15+
ifneq (,$(filter DESKTOP,$(BUILD_TYPE)))
1516
$(eval $(call gb_Module_add_targets,smoketest,\
1617
Library_smoketest \
1718
Zip_smoketestdoc \
1819
))
20+
endif
1921

2022
ifneq ($(ENABLE_JAVA),)
2123
ifneq ($(filter EXTENSIONS,$(BUILD_TYPE)),)

vcl/Executable_docxfuzzer.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ $(eval $(call gb_Executable_use_api,docxfuzzer,\
1919

2020
$(eval $(call gb_Executable_use_externals,docxfuzzer,\
2121
$(fuzzer_externals) \
22+
epubgen \
23+
revenge \
2224
))
2325

2426
$(eval $(call gb_Executable_set_include,docxfuzzer,\

vcl/Executable_fodtfuzzer.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ $(eval $(call gb_Executable_use_api,fodtfuzzer,\
1919

2020
$(eval $(call gb_Executable_use_externals,fodtfuzzer,\
2121
$(fuzzer_externals) \
22+
epubgen \
23+
revenge \
2224
))
2325

2426
$(eval $(call gb_Executable_set_include,fodtfuzzer,\

vcl/Executable_htmlfuzzer.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ $(eval $(call gb_Executable_use_api,htmlfuzzer,\
1818
))
1919

2020
$(eval $(call gb_Executable_use_externals,htmlfuzzer,\
21-
$(fuzzer_externals) \
21+
$(fuzzer_externals) \
22+
epubgen \
23+
revenge \
2224
))
2325

2426
$(eval $(call gb_Executable_set_include,htmlfuzzer,\

vcl/Module_vcl.mk

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $(eval $(call gb_Module_add_targets,vcl,\
2929
Package_opengl_denylist ) \
3030
$(if $(filter SKIA,$(BUILD_TYPE)), \
3131
Package_skia_denylist ) \
32-
$(if $(filter DESKTOP,$(BUILD_TYPE)), \
32+
$(if $(filter DESKTOP FUZZERS,$(BUILD_TYPE)), \
3333
StaticLibrary_vclmain \
3434
$(if $(DISABLE_GUI),, \
3535
$(if $(filter LINUX MACOSX SOLARIS WNT %BSD,$(OS)), \
@@ -151,7 +151,6 @@ $(eval $(call gb_Module_add_targets,vcl,\
151151
CustomTarget_nativedraw \
152152
CustomTarget_nativewriter \
153153
CustomTarget_nativemath \
154-
StaticLibrary_fuzzerstubs \
155154
StaticLibrary_fuzzer_core \
156155
StaticLibrary_fuzzer_calc \
157156
StaticLibrary_fuzzer_draw \

vcl/commonfuzzer.mk

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ fuzzer_externals = \
4444

4545
fuzzer_statics = \
4646
findsofficepath \
47-
fuzzerstubs \
4847
ulingu \
4948

5049
fuzzer_core_libraries = \
@@ -150,6 +149,9 @@ fuzzer_core_libraries = \
150149
gcc3_uno \
151150
salhelper \
152151
sal \
152+
index_data \
153+
localedata_en \
154+
localedata_others \
153155

154156
fuzzer_calc_libraries = \
155157
analysis \

vcl/workben/docxfuzzer.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ extern "C" void* SwCreateDialogFactory()
1616
return nullptr;
1717
}
1818

19-
extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation()
20-
{
21-
return nullptr;
22-
}
23-
2419
extern "C" bool TestImportDOCX(SvStream &rStream);
2520

2621
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)

vcl/workben/fodtfuzzer.cxx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ extern "C" void* SwCreateDialogFactory()
1616
return nullptr;
1717
}
1818

19-
extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation()
20-
{
21-
return nullptr;
22-
}
23-
2419
extern "C" bool TestImportFODT(SvStream &rStream);
2520

2621
extern "C" int LLVMFuzzerInitialize(int *argc, char ***argv)

vcl/workben/htmlfuzzer.cxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
extern "C" void* SwCreateDialogFactory() { return nullptr; }
1515

16-
extern "C" void* com_sun_star_comp_Writer_EPUBExportFilter_get_implementation() { return nullptr; }
17-
1816
extern "C" bool TestImportHTML(SvStream& rStream);
1917

2018
extern "C" int LLVMFuzzerInitialize(int* argc, char*** argv)

0 commit comments

Comments
 (0)