@@ -33,6 +33,7 @@ fn main() -> io::Result<ExitCode> {
3333
3434 let manifest_dir =
3535 PathBuf :: from ( env:: var_os ( "CARGO_MANIFEST_DIR" ) . expect ( "CARGO_MANIFEST_DIR unset" ) ) ;
36+ let fake_include_dir = manifest_dir. join ( "cxx/include" ) ;
3637 let target_dir = env:: var_os ( "CARGO_TARGET_DIR" )
3738 . map ( PathBuf :: from)
3839 . unwrap_or_else ( || manifest_dir. parent ( ) . unwrap ( ) . join ( "target" ) ) ;
@@ -61,6 +62,7 @@ fn main() -> io::Result<ExitCode> {
6162 let sh_script_exit_status = Command :: new ( "bash" )
6263 . args ( [ "-c" , SH_SCRIPT ] )
6364 . env ( "llvm" , & llvm_dir. join ( "llvm" ) )
65+ . env ( "manifest_dir" , & manifest_dir)
6466 . envs ( [
6567 ( "llvm_project_git_hash" , llvm_commit_hash) ,
6668 ( "cxx_apf_fuzz_exports" , & cxx_exported_symbols. join ( "," ) ) ,
@@ -81,20 +83,6 @@ fn main() -> io::Result<ExitCode> {
8183const SH_SCRIPT : & str = r#"
8284set -eux
8385
84- mkdir -p "$OUT_DIR"/fake-config/llvm/Config
85- touch "$OUT_DIR"/fake-config/llvm/Config/{abi-breaking,config,llvm-config}.h
86-
87- # HACK(eddyb) we want standard `assert`s to work, but `NDEBUG` also controls
88- # unrelated LLVM facilities that are spread all over the place and it's harder
89- # to compile all of them, than do this workaround where we shadow `assert.h`.
90- echo -e '#undef NDEBUG\n#include_next <assert.h>\n#define NDEBUG' \
91- > "$OUT_DIR"/fake-config/assert.h
92-
93- # HACK(eddyb) bypass `$llvm/include/llvm/Support/DataTypes.h.cmake`.
94- mkdir -p "$OUT_DIR"/fake-config/llvm/Support
95- echo -e '#include <'{math,inttypes,stdint,sys/types}'.h>\n' \
96- > "$OUT_DIR"/fake-config/llvm/Support/DataTypes.h
97-
9886# FIXME(eddyb) maybe split `$clang_codegen_flags` into front-end vs back-end.
9987clang_codegen_flags="-g -fPIC -fno-exceptions -O3 -march=native"
10088
@@ -104,9 +92,10 @@ clang_codegen_flags="-g -fPIC -fno-exceptions -O3 -march=native"
10492echo | clang++ -x c++ - -std=c++17 \
10593 $clang_codegen_flags \
10694 -I "$llvm"/include \
107- -I "$OUT_DIR"/fake-config \
95+ -I "$llvm"/lib/Support \
96+ -I "$manifest_dir/cxx/include" \
10897 -DNDEBUG -DHAVE_UNISTD_H -DLLVM_ON_UNIX -DLLVM_ENABLE_THREADS=0 \
109- --include="$llvm"/lib/Support/{APInt,APFloat,SmallVector,ErrorHandling} .cpp \
98+ --include="$manifest_dir/cxx/fuzz_unity_build .cpp" \
11099 --include="$OUT_DIR"/cxx_apf_fuzz.cpp \
111100 -c -emit-llvm -o "$OUT_DIR"/cxx_apf_fuzz.bc
112101
0 commit comments