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

            Bug ID: 26729
           Summary: lld: define special symbols _etext and _edata
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedb...@nondot.org
          Reporter: ema...@freebsd.org
                CC: llvm-bugs@lists.llvm.org
            Blocks: 23214
    Classification: Unclassified

In addition to _end, other linkers define _etext and _edata as the first
address after the text and data segment respectively. GNU GDB in the FreeBSD
base system relies on _etext and fails to build with lld.

Demonstration code:

% cat end_syms.c
#include <stdio.h>
#include <stdlib.h>

extern char etext, edata, end;

int
main(int argc, char *argv[])
{
        printf("etext: %p\n", &etext);
        printf("edata: %p\n", &edata);
        printf("end:   %p\n", &end);
}
% cc -fuse-ld=bfd end_syms.c 
% ./a.out
etext: 0x4007e6
edata: 0x600aa4
end:   0x600ab8
% cc -fuse-ld=lld end_syms.c
udefined symbol: edata in /tmp/end_syms-2375e5.o
undefined symbol: etext in /tmp/end_syms-2375e5.o
cc: error: linker command failed with exit code 1 (use -v to see invocation)

-- 
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