[llvm-bugs] [Bug 26360] New: Undefined symbol checking should be done after --gc-sections, not before

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jan 28 13:26:57 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26360

            Bug ID: 26360
           Summary: Undefined symbol checking should be done after
                    --gc-sections, not before
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: ed at 80386.nl
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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. :-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160128/df06c5b5/attachment.html>


More information about the llvm-bugs mailing list