[llvm-dev] libFuzzer on s390x architecture (compiler-rt)

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[llvm-dev] libFuzzer on s390x architecture (compiler-rt)

Alberto Barbaro via llvm-dev
Hello experts,

I am trying to get libFuzzer work on s390x architecture on Ubuntu 16.04.  In doing so I built clang/compiler-rt master branch as per http://compiler-rt.llvm.org/.

By making following changes I was able to generate libclang_rt.fuzzer-s390x.a and libclang_rt.fuzzer_no_main-s390x.a

/home/llvm/llvm/projects/compiler-rt# git diff
diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake
index 7e9ad63..61b3eff 100644
--- a/cmake/config-ix.cmake
+++ b/cmake/config-ix.cmake
@@ -227,7 +227,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} ${S390X})

However, lot of test cases are failing due to following error:

FAIL: libFuzzer :: bad-strcmp.test (4 of 103)
******************** TEST 'libFuzzer :: bad-strcmp.test' FAILED ********************
: 'RUN: at line 1';     /home/llvm/llvm/build/./bin/clang  --driver-mode=g++ -std=c++11 -lstdc++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/home/llvm/llvm/projects/compiler-rt/lib/fuzzer  /home/llvm/llvm/projects/compiler-rt/test/fuzzer/BadStrcmpTest.cpp -o /home/llvm/llvm/build/projects/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/bad-strcmp.test.tmp-BadStrcmpTest
: 'RUN: at line 2';    /home/llvm/llvm/build/projects/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/bad-strcmp.test.tmp-BadStrcmpTest -runs=100000
Exit Code: 1

Command Output (stderr):
INFO: Seed: 4127689547
INFO: Loaded 1 modules   (2 inline 8-bit counters): 2 [0x801b9ab0, 0x801b9ab2), 
INFO: Loaded 1 PC tables (3 PCs): 3 [0x80189908,0x80189938), 
ERROR: The size of coverage PC tables does not match the
number of instrumented PCs. This might be a compiler bug,
please contact the libFuzzer developers.
for possible workarounds (tl;dr: don't use the old GNU ld)


I already tried using Gold linker to no avail.  Here are some details of my environment:

root@1b1607e24d3f:/home/llvm/llvm/build# clang -v
clang version 8.0.0 (https://git.llvm.org/git/clang.git/ 33b30eb6d622918dcdc0425730a712f0460db522) (https://git.llvm.org/git/llvm.git fb147dee9d54c7905df5a61539112edc1d5d3a90)
Target: s390x-ibm-linux
Thread model: posix

root@1b1607e24d3f:/home/llvm/llvm/build# ld -v
GNU ld (GNU Binutils) 2.27

Please let me know if there is something I can look at to get it working on this arch.


LLVM Developers mailing list
[hidden email]