[llvm-bugs] [Bug 25528] New: lld -Bstatic fails to link because _end is undefined

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Nov 13 15:20:56 PST 2015


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

            Bug ID: 25528
           Summary: lld -Bstatic fails to link because _end is undefined
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: davide at freebsd.org
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The first bug found while building world on FreeBSD =)

sbrk() access _end (directly!) to understand where .bss ends.
The linker should probably insert that in the generated executable (at least
when -Bstatic is used). It seems gold doesn't strip the symbol even if not
referenced.

 % ./clang sbrk.c -fuse-ld=lld2 -o sbrs -static
undefined symbol: _end in sbrk.o
clang-3.8: error: linker command failed with exit code 1 (use -v to see
invocation)

Linker invocation:

 "/exps/llvm-lld/build/bin/./ld.lld2" -Bstatic -o sbrs /usr/lib/crt1.o
/usr/lib/crti.o /usr/lib/crtbeginT.o -L/usr/lib /tmp/sbrk-63b6db.o -lgcc
-lgcc_eh -lc -lgcc -lgcc_eh /usr/lib/crtend.o /usr/lib/crtn.o


% cat sbrk.c

#include <sys/types.h>
#include <unistd.h>

int
main(void)
{
  void *me = sbrk(42);
  return (0);
}

-- 
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/20151113/f137404f/attachment-0001.html>


More information about the llvm-bugs mailing list