<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 --- - lld: entry is past the end of the section"
   href="https://llvm.org/bugs/show_bug.cgi?id=28822">28822</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld: entry is past the end of the section
          </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>Linux
          </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>krasin@google.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>While trying to move Chrome to LLD on Linux x86-64 (now it uses the Gold
plugin), I encountered the following issue on multiple targets, if compiled
with CFI:

"entry is past the end of the section"

I was able to reproduce this in LLVM tree. Any C++ file will fit the bill, I
used the following simple.cc:

int main(void) {
  return 0;
}

The command line to trigger the bug:

$ clang++ -fuse-ld=lld -flto -fsanitize=cfi -fvisibility=hidden
-fno-sanitize-trap=cfi -g -o simple simple.cc
entry is past the end of the section
clang-3.9: error: linker command failed with exit code 1 (use -v to see
invocation)

After putting debug printfs into the strategic place:
<a href="https://cs.chromium.org/chromium/src/third_party/llvm/tools/lld/ELF/InputSection.cpp?q=entry.is.past.the.end.of.the.section&sq=package:chromium&l=552&dr=C">https://cs.chromium.org/chromium/src/third_party/llvm/tools/lld/ELF/InputSection.cpp?q=entry.is.past.the.end.of.the.section&sq=package:chromium&l=552&dr=C</a>

I've got these hints:

Section name: .debug_str
File: sanitizer_linux_s390.cc.o
Size: 0
Offset: 0</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>