Date: Wed, 24 Feb 2016 15:05:38 +0100 From: Raphael Kubo da Costa <rakuco@FreeBSD.org> To: freebsd-toolchain@freebsd.org Subject: Re: clang -pg, libm and the _end symbol Message-ID: <86egc2b3v1.fsf@FreeBSD.org> References: <86povmbb7c.fsf@FreeBSD.org> <20160224123045.GM91220@kib.kiev.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Konstantin Belousov <kostikbel@gmail.com> writes: > This is probably not a clang bug, but could be. More likely it is ld problem. > I do not want to dig into the issue, but I can provide you some points to > look at further. > > The _end symbol is magic, it is defined as the address of the last byte > + 1 of zero-initialized data section (.bss). But the symbol is not > provided by any object file participating in the linkage of the binary, > instead it is created by the linker after all sections are combined in > the segments and segments are laid out. > > The symbol is creation requested by the linker script, look at the > /usr/libdata/ldscripts for them, first line of the file contains > comment explaining which final binary format is served by the each > script. > > We are aware that binutils 2.25.1 ld for aarch64 has bug where _end is > not exported from executable, I was not able to track the bug. > > To diagnose your issue, look up which linker script is used for -pg > linking, look for the _end symbol there. If it is properly requested, > then the bug is in base linker. With and without -pg, the linker script being used is elf_x86_64_fbsd.xc ("Script for -z combreloc: combine and sort reloc sections"). It does contain an entry for _end: 182 _end = .; PROVIDE (end = .); lang/gcc with ld from devel/binutils also fails on HEAD: /usr/local/bin/ld: //usr/lib/libc_p.a(sbrk.po): undefined reference to symbol '_end' //lib/libc.so.7: error adding symbols: DSO missing from command line
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86egc2b3v1.fsf>