<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 - Building scudo trunk"
   href="https://bugs.llvm.org/show_bug.cgi?id=47323">47323</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Building scudo trunk
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>scudo
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>josh@joshtriplett.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I tried to build scudo from LLVM trunk (commit
486ed885339d70cd71ee55567282a43cce28d763), following the instructions on
<a href="https://www.llvm.org/docs/ScudoHardenedAllocator.html">https://www.llvm.org/docs/ScudoHardenedAllocator.html</a> (under "You may also
build Scudo like this:"). (I had to make the slight modification of changing cc
to cpp when referencing sanitizer_common.)

I ended up with this error:

ld.lld: error: relocation R_X86_64_PC32 cannot be used against symbol
__interception::real_vfork; recompile with -fPIC
<span class="quote">>>> defined in /tmp/sanitizer_common_interceptors_vfork_x86_64-5badfa.o
>>> referenced by /tmp/sanitizer_common_interceptors_vfork_x86_64-5badfa.o:(vfork)</span >
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I get the same error (other than symbol encoding) if I build with ld:

/usr/bin/ld: /tmp/sanitizer_common_interceptors_vfork_x86_64-01b7d5.o: warning:
relocation against `_ZN14__interception10real_vforkE' in read-only section
`.text'
/usr/bin/ld: /tmp/sanitizer_common_interceptors_vfork_x86_64-01b7d5.o:
relocation R_X86_64_PC32 against symbol `_ZN14__interception10real_vforkE' can
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I used this command line:

clang++-11 -fPIC -std=c++11 -msse4.2 -O2 -I. scudo/*.cpp $(\ls
sanitizer_common/*.{cpp,S} | grep -v
"sanitizer_termination\|sanitizer_common_nolibc\|sancov_\|sanitizer_unwind\|sanitizer_symbol")
-shared -o libscudo.so -pthread</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>