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: unassignedb...@nondot.org
          Reporter: e...@80386.nl
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to