<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 --- - Assertion failed: (Piece.Live), function getOffset, file .../llvm/tools/lld/ELF/InputSection.cpp, line 619"
   href="https://llvm.org/bugs/show_bug.cgi?id=30539">30539</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Assertion failed: (Piece.Live), function getOffset, file .../llvm/tools/lld/ELF/InputSection.cpp, line 619
          </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>llvm@sjor.sg
          </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>Building a simple "hello world" binary fails with the assertion error given in
the summary. If clang is not called with -g, or lld is not called with
--gc-sections, the problem disappears. This is llvm & lld trunk, r282489.

$ cat simple.cpp
#include <stdio.h>

int main(void) {
    dprintf(1, "Hello, world\n");
}

$ x86_64-unknown-cloudabi-c++ -v simple.cpp -g -o simple
[...]
 "/usr/local/bin/x86_64-unknown-cloudabi-ld" -Bstatic --no-dynamic-linker -pie
-zrelro --eh-frame-hdr --gc-sections -o simple
/usr/local/llvm39/bin/../x86_64-unknown-cloudabi/lib/crt0.o
/usr/local/llvm39/bin/../x86_64-unknown-cloudabi/lib/crtbegin.o
-L/usr/local/llvm39/bin/../x86_64-unknown-cloudabi/lib /tmp/simple-813c59.o
-lc++ -lc++abi -lunwind -lc -lcompiler_rt
/usr/local/llvm39/bin/../x86_64-unknown-cloudabi/lib/crtend.o
Assertion failed: (Piece.Live), function getOffset, file
/root/llvm/tools/lld/ELF/InputSection.cpp, line 619.
clang-3.9: error: unable to execute command: Abort trap (core dumped)
clang-3.9: error: linker command failed due to signal (use -v to see
invocation)

The repro.cpio is attached.</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>