<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - [ELF] - FreeBSD lld linked loader hangs (sys/boot/efi/boot1)."
   href="https://llvm.org/bugs/show_bug.cgi?id=31213">31213</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[ELF] - FreeBSD lld linked loader hangs (sys/boot/efi/boot1).
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>ELF
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>grimar@accesssoftek.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>sys/boot/efi/boot1 loader hangs in QEMU if linked with lld.

I was able to reduce its code to minimal case:

#include <sys/param.h>
#include <machine/elf.h>
#include <machine/stdarg.h>
#include <stand.h>
#include <efi.h>
#include <eficonsctl.h>
#include "boot_module.h"

EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE* Xsystab);

EFI_SYSTEM_TABLE *systab;
EFI_BOOT_SERVICES *bs;
static EFI_HANDLE *image;

EFI_STATUS
efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab)
{
  SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL;
  systab = Xsystab;
  image = Ximage;
  bs = Xsystab->BootServices;

  //conout = Xsystab->ConOut; //1
  conout = systab->ConOut;    //2

  conout->Reset(conout, TRUE);
  return EFI_SUCCESS;
}

Now note that if line 1 is used, lld linked loader hangs. If line 2 is used, it
does not.
ld.bfd linked loader feels fine with any of these lines.

I am investigating the difference in output now.</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>