Fix the fuzzer build on i386

This commit is contained in:
Sylvestre Ledru 2020-11-05 09:28:45 +01:00
parent a5a3ee8671
commit 2c3d5b5ca2
3 changed files with 16 additions and 33 deletions

View File

@ -1,32 +0,0 @@
Index: llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0/compiler-rt/lib/CMakeLists.txt
===================================================================
--- llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0.orig/compiler-rt/lib/CMakeLists.txt
+++ llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0/compiler-rt/lib/CMakeLists.txt
@@ -59,7 +59,10 @@ if(COMPILER_RT_BUILD_XRAY)
endif()
if(COMPILER_RT_BUILD_LIBFUZZER)
- compiler_rt_build_runtime(fuzzer)
+ if(NOT(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i386" OR CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686"))
+ # Disabled because of https://bugs.llvm.org/show_bug.cgi?id=43677
+ compiler_rt_build_runtime(fuzzer)
+ endif()
endif()
if(COMPILER_RT_BUILD_MEMPROF AND COMPILER_RT_HAS_SANITIZER_COMMON)
Index: llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0/compiler-rt/test/CMakeLists.txt
===================================================================
--- llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0.orig/compiler-rt/test/CMakeLists.txt
+++ llvm-toolchain-snapshot_12~++20201028113421+ebfc427bbe0/compiler-rt/test/CMakeLists.txt
@@ -55,7 +55,10 @@ if(COMPILER_RT_CAN_EXECUTE_TESTS)
# OpenBSD not supporting asan, cannot run the tests
if(COMPILER_RT_BUILD_LIBFUZZER AND NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD" AND NOT ANDROID)
- compiler_rt_test_runtime(fuzzer)
+ if(NOT(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i386" OR CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686"))
+ # Disabled because of https://bugs.llvm.org/show_bug.cgi?id=43677
+ compiler_rt_test_runtime(fuzzer)
+ endif()
endif()
foreach(sanitizer ${COMPILER_RT_SANITIZERS_TO_BUILD})

View File

@ -128,7 +128,8 @@ workaround-bug-42994-use-linker.diff
# bug 939472
#try-to-unbreak-thinlto.diff
D67877.patch
disable-fuzzer-compiler-rt-x86.diff
x86-fuzzer.patch
python3-shebang.patch
print-lldb-path.patch

14
debian/patches/x86-fuzzer.patch vendored Normal file
View File

@ -0,0 +1,14 @@
Description: fuzzer: EMULATION_ARGUMENT is also required when building on i386 for x86_64
Author: Adrian Bunk <bunk@debian.org>
--- llvm-toolchain-11-11.0.0.orig/compiler-rt/lib/fuzzer/CMakeLists.txt
+++ llvm-toolchain-11-11.0.0/compiler-rt/lib/fuzzer/CMakeLists.txt
@@ -121,6 +121,8 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND
macro(partially_link_libcxx name dir arch)
if(${arch} MATCHES "i386")
set(EMULATION_ARGUMENT "-m" "elf_i386")
+ elseif(${arch} MATCHES "x86_64")
+ set(EMULATION_ARGUMENT "-m" "elf_x86_64")
else()
set(EMULATION_ARGUMENT "")
endif()