<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:grimar@accesssoftek.com" title="George Rimar <grimar@accesssoftek.com>"> <span class="fn">George Rimar</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - [ELF] - FreeBSD lld linked loader hangs (sys/boot/efi/boot1)."
   href="https://llvm.org/bugs/show_bug.cgi?id=31213">bug 31213</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;">Status</td>
           <td>ASSIGNED
           </td>
           <td>RESOLVED
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Resolution</td>
           <td>---
           </td>
           <td>WONTFIX
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - [ELF] - FreeBSD lld linked loader hangs (sys/boot/efi/boot1)."
   href="https://llvm.org/bugs/show_bug.cgi?id=31213#c15">Comment # 15</a>
              on <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED WONTFIX - [ELF] - FreeBSD lld linked loader hangs (sys/boot/efi/boot1)."
   href="https://llvm.org/bugs/show_bug.cgi?id=31213">bug 31213</a>
              from <span class="vcard"><a class="email" href="mailto:grimar@accesssoftek.com" title="George Rimar <grimar@accesssoftek.com>"> <span class="fn">George Rimar</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=31213#c11">comment #11</a>)
<span class="quote">> Something is still not quite right and linking the FreeBSD bootloaders with
> that change does not work for me, although George reported success.</span >

Yes, minimal scenario from this PR as well as building+linking complete source
of usr/src/sys/boot/efi/boot1 loader is fixed for me with
<a href="https://reviews.freebsd.org/D8681">https://reviews.freebsd.org/D8681</a> applied.

Tested in a next way:
root@freebsd:/usr/src/sys/boot/efi/boot1
make clean
make
objcopy \
  -j .peheader -j .text -j .sdata -j .data  \
  -j .dynamic -j .dynsym -j .rel.dyn  \
  -j .rela.dyn -j .reloc -j .eh_frame \
  --output-target=efi-app-x86_64 boot1.sym.full loader.efi

now loader.efi is workable.

Though I still observe issue with objcopy call from original makefile:
objcopy --only-keep-debug boot1.sym.full boot1.sym.debug
BFD: boot1.sym.debug: section `.dynsym' can't be allocated in segment 4
objcopy: boot1.sym.debug: Bad value
BFD: boot1.sym.debug: section `.dynsym' can't be allocated in segment 4
objcopy: boot1.sym.debug: Bad value
*** Error code 1
That issue can be fixed with passing -N to linker and after that result
boot1.efi also works for me.

(In reply to <a href="show_bug.cgi?id=31213#c12">comment #12</a>)
<span class="quote">> Ah, yes. That is an oddity of ld.bfd I had noticed before. If we can fix the
> freebsd code instead of implementing the same oddity in ld.lld that would be
> awesome.
> </span >

Yep, I also noticed that earlier. I just do not think it is an oddity only of
bfd, I think gold also do that since loader linked from source still has many
left relocations, what means not all of them were relaxed and looks it "worked"
because of the same reasons. (though I did not re-check)
That is why I at first I supposed we might want to do the same, but did not
find anything in ABI or somewhere else about storing addends in relocation
targets.

I am closing this, since this one issue does not requires fixing on LLD side
and we can open separate PR for others if any.</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>