<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><span class="vcard"><a class="email" href="mailto:i@maskray.me" title="Fangrui Song <i@maskray.me>"> <span class="fn">Fangrui Song</span></a>
</span> changed
          <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - lld unable to link compiler-rt on aarch64 (hwasan)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35929">bug 35929</a>
          <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">CC</td>
           <td>
                
           </td>
           <td>i@maskray.me
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WORKSFORME
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Status</td>
           <td>CONFIRMED
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - lld unable to link compiler-rt on aarch64 (hwasan)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35929#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WORKSFORME - lld unable to link compiler-rt on aarch64 (hwasan)"
   href="https://bugs.llvm.org/show_bug.cgi?id=35929">bug 35929</a>
              from <span class="vcard"><a class="email" href="mailto:i@maskray.me" title="Fangrui Song <i@maskray.me>"> <span class="fn">Fangrui Song</span></a>
</span></b>
        <pre><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - hwasan does not link with lld due to pc-relative relocations to .text"
   href="show_bug.cgi?id=35931">https://bugs.llvm.org/show_bug.cgi?id=35931</a> has been fixed.

With -shared,
neither ld.bfd nor gold allows R_X86_64_PC32 (not link-time constant, not
dynamic relocation) against the preemptable symbol 'func'. So is it obsoleted?

x86_64:
% clang -fuse-ld=bfd a.c --shared -fPIE -ffunction-sections -Wl,-znotext        
/usr/bin/ld.bfd: /tmp/a-ce6897.o: relocation R_X86_64_PC32 against symbol
`func' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld.bfd: final link failed: Bad value
clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)

aarch64:
% ld.lld -shared a.o -o a
ld.lld: error: relocation R_AARCH64_ADR_PREL_PG_HI21 cannot be used against
symbol func; recompile with -fPIC
<span class="quote">>>> defined in a.o
>>> referenced by a.c
>>>               a.o:(func2)</span >

ld.lld: error: can't create dynamic relocation R_AARCH64_ADD_ABS_LO12_NC
against symbol: func in readonly segment; recompile object files with -fPIC or
pass '-Wl,-z,notext' to allow text relocations in the output
<span class="quote">>>> defined in a.o
>>> referenced by a.c
>>>               a.o:(func2)</span >

% ./ld-new -shared a.o -o a                                 
./ld-new: a.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `func'
which may bind externally can not be used when making a shared object;
recompile with -fPIC
a.o: in function `func2':
a.c:(.text.func2+0x0): dangerous relocation: unsupported relocation</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>