<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - libcxx custom build from fuzzer not built PIC (causes regression test failures on AArch64 due to msan enforcing -fPIE on non X86 platforms)"
   href="https://bugs.llvm.org/show_bug.cgi?id=41671">41671</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libcxx custom build from fuzzer not built PIC (causes regression test failures on AArch64 due to msan enforcing -fPIE on non X86 platforms)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>compiler-rt
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>fuzzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>peter.smith@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Some recently added libfuzzer tests are failing with link errors on AArch64
when the libcxx/libcxxabi sources are available [*].
msan.text
sigint.test

Both of these tests use -sanitize=memory,fuzzer which on non X86_64 platforms
implicitly sets -fPIE and -pie. The test fails with a link error due to non-PIC
relocations. Tracing through to find where these are coming from it it seems
like libfuzzer is being built -fPIC as is libc++abi, but libc++ is not.

I can make the test fail on x86_64 by adding -fPIE -pie to the line:
RUN: %msan_compiler %S/SleepOneSecondTest.cpp -o %t/LFSIGINT
lib/clang/9.0.0/lib/linux/libclang_rt.fuzzer-x86_64.a(fuzzer.o): relocation
R_X86_64_32 against `.bss' can not be used when making a shared object;
recompile with -fPIC
This may not be a fair test on x86_64, some distributions default to -fPIE -PIE
but it can be overridden.

Assuming that using msan and fuzzer on a non x86_64 platform is a supported
combination. I think that the static libc++ that is merged into libfuzzer needs
to be built -fPIC. If it is not supported then msan.test and sigint.test need
to be disabled on non x86_64 platforms. 

The AArch64 buildbots currently do not have the libcxx/libcxxabi sources
available so they are not showing up the problem as they don't build it. When
the bots switch to the monorepo and LLVM_ENABLE_PROJECTS they will start
failing these tests.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>