<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 FIXED - missing error on reference to undefined weak symbol"
   href="https://bugs.llvm.org/show_bug.cgi?id=34058">bug 34058</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;">Resolution</td>
           <td>---
           </td>
           <td>FIXED
           </td>
         </tr>

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

         <tr>
           <td style="text-align:right;">Status</td>
           <td>NEW
           </td>
           <td>RESOLVED
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - missing error on reference to undefined weak symbol"
   href="https://bugs.llvm.org/show_bug.cgi?id=34058#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - missing error on reference to undefined weak symbol"
   href="https://bugs.llvm.org/show_bug.cgi?id=34058">bug 34058</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>leaq    foo(%rip), %rax # R_X86_64_PC32
movabsq $foo-., %rax    # R_X86_64_PC64
.weak foo
.hidden foo

The idea was implemented in D19844/r268350. Note, ld.bfd/gold error on
R_X86_64_PC32:

% ld.bfd a.o -shared -o a
ld.bfd: a.o: relocation R_X86_64_PC32 against undefined hidden symbol `foo' can
not be used when making a shared object
ld.bfd: final link failed: Bad value
% gold a.o -shared -o a
gold: error: a.o: requires dynamic R_X86_64_PC32 reloc against 'foo' which may
overflow at runtime; recompile with -fPIC

The error is bogus as this should be fine if the link-time address is smaller
than 0x80000000.

% ld.lld a.o -shared -o a
% ld.lld a.o -shared -o a -Ttext=0x80000000
ld.lld: error: a.o:(.text+0x3): relocation R_X86_64_PC32 out of range:
-2147483655 is not in [-2147483648, 2147483647]</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>