From owner-freebsd-toolchain@freebsd.org Wed Feb 24 13:19:59 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 3EF74AB3C6F for ; Wed, 24 Feb 2016 13:19:59 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB3311612; Wed, 24 Feb 2016 13:19:58 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u1ODJsBH054940 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 24 Feb 2016 15:19:54 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u1ODJsBH054940 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u1ODJshG054939; Wed, 24 Feb 2016 15:19:54 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 24 Feb 2016 15:19:54 +0200 From: Konstantin Belousov To: Dimitry Andric Cc: Raphael Kubo da Costa , freebsd-toolchain@freebsd.org Subject: Re: clang -pg, libm and the _end symbol Message-ID: <20160224131954.GP91220@kib.kiev.ua> References: <86povmbb7c.fsf@FreeBSD.org> <1CEB597F-1446-4E73-B5E2-5E5A4B3E9313@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1CEB597F-1446-4E73-B5E2-5E5A4B3E9313@FreeBSD.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home 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 13:19:59 -0000 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.