From owner-freebsd-toolchain@freebsd.org Wed Feb 24 14:10:12 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 0BBDEAB3095 for ; Wed, 24 Feb 2016 14:10:12 +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 C8BB4119E for ; Wed, 24 Feb 2016 14:10:11 +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 1aYa8h-0003Hq-MM for freebsd-toolchain@freebsd.org; Wed, 24 Feb 2016 15:10:03 +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:10:03 +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:10:03 +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:07:32 +0100 Lines: 28 Message-ID: <86a8mqb3rv.fsf@FreeBSD.org> References: <86povmbb7c.fsf@FreeBSD.org> <1CEB597F-1446-4E73-B5E2-5E5A4B3E9313@FreeBSD.org> <20160224131954.GP91220@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:98fjp9FMTmIss1U4/j6BrgToCec= 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:10:12 -0000 Konstantin Belousov writes: > On Wed, Feb 24, 2016 at 01:54:25PM +0100, Dimitry Andric wrote: >> On 24 Feb 2016, at 12:27, Raphael Kubo da Costa wrote: >> > >> > I'm reviewing an update to the textproc/miller port in bug 207194, and >> > noticed it does some ugly things in post-configure to seemingly >> > work around the following problem (on 11-HEAD at least): >> > >> > % echo 'int main(void) { return 0; }' > foo.c >> > % clang -pg foo.c -lm >> > /usr/bin/ld: undefined reference to symbol `_end' (try adding -lc) >> > //lib/libc.so.7: could not read symbols: Bad value >> > cc: error: linker command failed with exit code 1 (use -v to see >> > invocation) >> >> Try using: clang -pg foo.c -lm_p >> >> That works for me (also with gcc). > > It probably not quite works, in the sense that it resolves _end to > something not correctly provided by libm_p.a. In other words, sbrk(), > if used for anything, would be broken. It at least "works" in the sense that clang doesn't fail; however, in addition to kib's point this doesn't look optimal from a ports perspective, as it requires giving special treatment to certain targets and possibly hacking the build system in different ports.