From 2e24b11ccc354581562f2ed014cd6f936aad7ddc Mon Sep 17 00:00:00 2001 From: Jonathan Metzman Date: Tue, 30 Apr 2019 17:58:54 +0000 Subject: Enable x86 builds git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@359583 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/config-ix.cmake | 2 +- lib/fuzzer/CMakeLists.txt | 9 +++++++-- test/fuzzer/dataflow.test | 3 +-- test/fuzzer/fork.test | 4 ++-- test/fuzzer/only-some-bytes.test | 3 +-- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake index b072c1180..2d9b5d664 100644 --- a/cmake/config-ix.cmake +++ b/cmake/config-ix.cmake @@ -230,7 +230,7 @@ set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64} set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64} ${MIPS32} ${MIPS64} ${PPC64} ${S390X}) set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64}) -set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64}) +set(ALL_FUZZER_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM64}) if(APPLE) set(ALL_LSAN_SUPPORTED_ARCH ${X86} ${X86_64} ${MIPS64} ${ARM64}) diff --git a/lib/fuzzer/CMakeLists.txt b/lib/fuzzer/CMakeLists.txt index 602f33297..42158cc26 100644 --- a/lib/fuzzer/CMakeLists.txt +++ b/lib/fuzzer/CMakeLists.txt @@ -120,11 +120,16 @@ add_compiler_rt_runtime(clang_rt.fuzzer_no_main if(OS_NAME MATCHES "Linux|Fuchsia" AND COMPILER_RT_LIBCXX_PATH AND COMPILER_RT_LIBCXXABI_PATH) - macro(partially_link_libcxx name dir arch) + macro(partially_link_libcxx name dir arch) + if (${arch} MATCHES "i386") + set(EMULATION_ARGUMENT "-m" "elf_i386") + else() + set(EMULATION_ARGUMENT "") + endif() set(cxx_${arch}_merge_dir "${CMAKE_CURRENT_BINARY_DIR}/cxx_${arch}_merge.dir") file(MAKE_DIRECTORY ${cxx_${arch}_merge_dir}) add_custom_command(TARGET clang_rt.${name}-${arch} POST_BUILD - COMMAND ${CMAKE_LINKER} --whole-archive "$" --no-whole-archive ${dir}/lib/libc++.a -r -o ${name}.o + COMMAND ${CMAKE_LINKER} --whole-archive ${EMULATION_ARGUMENT} "$" --no-whole-archive ${dir}/lib/libc++.a -r -o ${name}.o COMMAND ${CMAKE_OBJCOPY} --localize-hidden ${name}.o COMMAND ${CMAKE_COMMAND} -E remove "$" COMMAND ${CMAKE_AR} qcs "$" ${name}.o diff --git a/test/fuzzer/dataflow.test b/test/fuzzer/dataflow.test index 36ec55881..3fd2a9580 100644 --- a/test/fuzzer/dataflow.test +++ b/test/fuzzer/dataflow.test @@ -1,6 +1,5 @@ # Tests the data flow tracer. -REQUIRES: linux -UNSUPPORTED: aarch64 +REQUIRES: linux, x86_64 # Build the tracer and the test. RUN: %no_fuzzer_cpp_compiler -c -fno-sanitize=all -fsanitize=dataflow %S/../../lib/fuzzer/dataflow/DataFlow.cpp -o %t-DataFlow.o diff --git a/test/fuzzer/fork.test b/test/fuzzer/fork.test index 393a9f66b..703fdbaf7 100644 --- a/test/fuzzer/fork.test +++ b/test/fuzzer/fork.test @@ -11,8 +11,8 @@ OOM: ERROR: libFuzzer: out-of-memory RUN: %cpp_compiler %S/OutOfMemoryTest.cpp -o %t-OutOfMemoryTest RUN: not %run %t-OutOfMemoryTest -fork=1 -ignore_ooms=0 -rss_limit_mb=128 2>&1 | FileCheck %s --check-prefix=OOM -# access-violation is the error thrown on Windows. -CRASH: {{SEGV|access-violation}} on unknown address 0x000000000000 +# access-violation is the error thrown on Windows. Address will be smaller on x86. +CRASH: {{SEGV|access-violation}} on unknown address {{0x000000000000|0x00000000}} RUN: %cpp_compiler %S/ShallowOOMDeepCrash.cpp -o %t-ShallowOOMDeepCrash RUN: not %run %t-ShallowOOMDeepCrash -fork=1 -rss_limit_mb=128 2>&1 | FileCheck %s --check-prefix=CRASH diff --git a/test/fuzzer/only-some-bytes.test b/test/fuzzer/only-some-bytes.test index 861718384..a783548da 100644 --- a/test/fuzzer/only-some-bytes.test +++ b/test/fuzzer/only-some-bytes.test @@ -1,6 +1,5 @@ # Tests the data flow tracer. -REQUIRES: linux -UNSUPPORTED: aarch64 +REQUIRES: linux, x86_64 # Build the tracer and the test. RUN: %no_fuzzer_cpp_compiler -c -fno-sanitize=all -fsanitize=dataflow %S/../../lib/fuzzer/dataflow/DataFlow.cpp -o %t-DataFlow.o -- cgit v1.2.1