<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - lld: define special symbols _etext and _edata"
   href="https://llvm.org/bugs/show_bug.cgi?id=26729">26729</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>lld: define special symbols _etext and _edata
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>FreeBSD
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>emaste@freebsd.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>23214
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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)</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>