From owner-freebsd-toolchain@freebsd.org Wed Feb 24 14:06:01 2016 Return-Path: Delivered-To: freebsd-toolchain@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C6ECAB2F23 for ; Wed, 24 Feb 2016 14:06:01 +0000 (UTC) (envelope-from gofdt-freebsd-toolchain@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C7AF6106E for ; Wed, 24 Feb 2016 14:06:00 +0000 (UTC) (envelope-from gofdt-freebsd-toolchain@m.gmane.org) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aYa4e-0000Cm-6K for freebsd-toolchain@freebsd.org; Wed, 24 Feb 2016 15:05:52 +0100 Received: from dhcp-077-248-147-050.chello.nl ([77.248.147.50]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Feb 2016 15:05:52 +0100 Received: from rakuco by dhcp-077-248-147-050.chello.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 24 Feb 2016 15:05:52 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-toolchain@freebsd.org From: Raphael Kubo da Costa Subject: Re: clang -pg, libm and the _end symbol Date: Wed, 24 Feb 2016 15:05:38 +0100 Lines: 34 Message-ID: <86egc2b3v1.fsf@FreeBSD.org> References: <86povmbb7c.fsf@FreeBSD.org> <20160224123045.GM91220@kib.kiev.ua> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dhcp-077-248-147-050.chello.nl User-Agent: Gnus/5.130016 (Ma Gnus v0.16) Emacs/24.5 (berkeley-unix) Cancel-Lock: sha1:ZDU2SoiV4Eri4TJ+q7f44JUjzik= X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2016 14:06:01 -0000 Konstantin Belousov 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