<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hello experts,<div><br></div><div>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 <a href="http://compiler-rt.llvm.org/">http://compiler-rt.llvm.org/</a>.</div><div><br></div><div>By making following changes I was able to generate libclang_rt.fuzzer-s390x.a and libclang_rt.fuzzer_no_main-s390x.a</div><div><br></div><div>/================================/</div><div>/home/llvm/llvm/projects/compiler-rt# git diff<br></div><div><div>diff --git a/cmake/config-ix.cmake b/cmake/config-ix.cmake</div><div>index 7e9ad63..61b3eff 100644</div><div>--- a/cmake/config-ix.cmake</div><div>+++ b/cmake/config-ix.cmake</div><div>@@ -227,7 +227,7 @@ set(ALL_SANITIZER_COMMON_SUPPORTED_ARCH ${X86} ${X86_64} ${PPC64}</div><div> set(ALL_ASAN_SUPPORTED_ARCH ${X86} ${X86_64} ${ARM32} ${ARM64}</div><div>     ${MIPS32} ${MIPS64} ${PPC64} ${S390X})</div><div> set(ALL_DFSAN_SUPPORTED_ARCH ${X86_64} ${MIPS64} ${ARM64})</div><div>-set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64})</div><div>+set(ALL_FUZZER_SUPPORTED_ARCH ${X86_64} ${ARM64} ${S390X})</div></div><div>/================================/ </div><div><br></div><div>However, lot of test cases are failing due to following error:</div><div><br></div><div>/=================================/</div><div><div>FAIL: libFuzzer :: bad-strcmp.test (4 of 103)</div><div>******************** TEST 'libFuzzer :: bad-strcmp.test' FAILED ********************</div><div>Script:</div><div>--</div><div>: '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</div><div>: 'RUN: at line 2';    /home/llvm/llvm/build/projects/compiler-rt/test/fuzzer/S390XDefaultLinuxConfig/Output/bad-strcmp.test.tmp-BadStrcmpTest -runs=100000</div><div>--</div><div>Exit Code: 1</div><div><br></div><div>Command Output (stderr):</div><div>--</div><div>INFO: Seed: 4127689547</div><div>INFO: Loaded 1 modules   (2 inline 8-bit counters): 2 [0x801b9ab0, 0x801b9ab2), </div><div>INFO: Loaded 1 PC tables (3 PCs): 3 [0x80189908,0x80189938), </div><div><b>ERROR: The size of coverage PC tables does not match the</b></div><div><b>number of instrumented PCs. This might be a compiler bug,</b></div><div><b>please contact the libFuzzer developers.</b></div><div>Also check <a href="https://bugs.llvm.org/show_bug.cgi?id=34636">https://bugs.llvm.org/show_bug.cgi?id=34636</a></div><div>for possible workarounds (tl;dr: don't use the old GNU ld)</div><div><br></div><div>--</div></div><div>/=================================/ <br></div><div><br></div><div>I already tried using Gold linker to no avail.  Here are some details of my environment:</div><div><br></div><div><div>root@1b1607e24d3f:/home/llvm/llvm/build# clang -v</div><div>clang version 8.0.0 (<a href="https://git.llvm.org/git/clang.git/">https://git.llvm.org/git/clang.git/</a> 33b30eb6d622918dcdc0425730a712f0460db522) (<a href="https://git.llvm.org/git/llvm.git">https://git.llvm.org/git/llvm.git</a> fb147dee9d54c7905df5a61539112edc1d5d3a90)</div><div>Target: s390x-ibm-linux</div><div>Thread model: posix</div></div><div><div><br></div><div>root@1b1607e24d3f:/home/llvm/llvm/build# ld -v</div><div>GNU ld (GNU Binutils) 2.27</div></div><div><br></div><div>Please let me know if there is something I can look at to get it working on this arch.</div><div><br></div><div>Thanks.</div></div></div></div></div></div></div></div>