1
1
#! /bin/bash -eu
2
2
# Copyright 2016 Google Inc.
3
+ # Copyright 2025 Sebastian Pipping <[email protected] >
3
4
#
4
5
# Licensed under the Apache License, Version 2.0 (the "License");
5
6
# you may not use this file except in compliance with the License.
15
16
#
16
17
# ###############################################################################
17
18
19
+ # NOTE: We need to drop -stdlib=libc++ to not get (pages of) link errors when
20
+ # linking against system Protobuf that is linked against GCC's libstdc++
21
+ # rather than Clang's own libstdc++
22
+ CXXFLAGS=" ${CXXFLAGS/ -stdlib=libc++/ } "
23
+
24
+ # NOTE: Without -static-libstdc++, the bad build checker in base-runner
25
+ # will fail with output:
26
+ # > error while loading shared libraries: libstdc++.so.6:
27
+ # > cannot open shared object file: No such file or directory
28
+ # The addition of -Wno-unused-command-line-argument silences Clang's
29
+ # misleading output on argument -static-libstdc++ appearing as unused.
30
+ CXXFLAGS=" ${CXXFLAGS} -static-libstdc++ -Wno-unused-command-line-argument"
31
+
18
32
: ${LD:= " ${CXX} " }
19
33
: ${LDFLAGS:= " ${CXXFLAGS} " } # to make sure we link with sanitizer runtime
20
34
21
35
cmake_args=(
22
36
# Specific to Expat
37
+ -DEXPAT_BUILD_DOCS=OFF
38
+ -DEXPAT_BUILD_EXAMPLES=OFF
23
39
-DEXPAT_BUILD_FUZZERS=ON
40
+ -DEXPAT_BUILD_TESTS=OFF
41
+ -DEXPAT_BUILD_TOOLS=OFF
24
42
-DEXPAT_OSSFUZZ_BUILD=ON
25
43
-DEXPAT_SHARED_LIBS=OFF
44
+ -DProtobuf_USE_STATIC_LIBS=ON
26
45
27
46
# C compiler
28
47
-DCMAKE_C_COMPILER=" ${CC} "
@@ -48,14 +67,11 @@ for fuzzer in fuzz/*;
48
67
do
49
68
cp $fuzzer $OUT
50
69
fuzzer_name=$( basename $fuzzer )
51
- if [[ ${fuzzer_name} =~ ^.* UTF-16$ ]];
52
- then
70
+ if [[ ${fuzzer_name} =~ ^.* UTF-16$ ]]; then
53
71
cp $SRC /xml_UTF_16.dict $OUT /${fuzzer_name} .dict
54
- elif [[ ${fuzzer_name} =~ ^.* UTF-16LE$ ]];
55
- then
72
+ elif [[ ${fuzzer_name} =~ ^.* UTF-16LE$ ]]; then
56
73
cp $SRC /xml_UTF_16LE.dict $OUT /${fuzzer_name} .dict
57
- elif [[ ${fuzzer_name} =~ ^.* UTF-16BE$ ]];
58
- then
74
+ elif [[ ${fuzzer_name} =~ ^.* UTF-16BE$ ]]; then
59
75
cp $SRC /xml_UTF_16BE.dict $OUT /${fuzzer_name} .dict
60
76
else
61
77
cp $SRC /xml.dict $OUT /${fuzzer_name} .dict
0 commit comments