<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 --- - Undefined symbol checking should be done after --gc-sections, not before"
   href="https://llvm.org/bugs/show_bug.cgi?id=26360">26360</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Undefined symbol checking should be done after --gc-sections, not before
          </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>All
          </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>All Bugs
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>ed@80386.nl
          </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>With GNU ld, the following C application will build properly if --gc-sections
is passed to the linker:

----------------
void undefined_function(void);
void unreferenced_function(void);

void unreferenced_function(void) {
  undefined_function();
}

int main(int argc, char **argv) {
  return 0;
}
----------------

As in, if code is unreferenced and is about to be pruned away by --gc-sections,
it is allowed to contain references to undefined symbols. My observation is
that lld 3.8.0rc1 does not allow this. In other words, the checking for
undefined symbols is done before --gc-sections is performed, instead of the
other way around.

I'm not saying that what GNU ld is doing is better than what lld does; it's
merely an observation. :-)</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>