[llvm-bugs] [Bug 26729] New: lld: define special symbols _etext and _edata

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Feb 24 13:32:14 PST 2016


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: unassignedbugs at nondot.org
          Reporter: emaste at freebsd.org
                CC: llvm-bugs at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160224/b91c04f6/attachment.html>


More information about the llvm-bugs mailing list