From owner-freebsd-toolchain@freebsd.org Wed Feb 24 11:30:09 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 42A93AB3E23 for ; Wed, 24 Feb 2016 11:30:09 +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 0A9C59EC for ; Wed, 24 Feb 2016 11:30:08 +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 1aYXdu-00056u-64 for freebsd-toolchain@freebsd.org; Wed, 24 Feb 2016 12:30:06 +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 12:30:06 +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 12:30:06 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-toolchain@freebsd.org From: Raphael Kubo da Costa Subject: clang -pg, libm and the _end symbol Date: Wed, 24 Feb 2016 12:27:03 +0100 Lines: 26 Message-ID: <86povmbb7c.fsf@FreeBSD.org> 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:moKda/I6cwgeDppbIhPU2PhRylM= 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 11:30:09 -0000 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) (FWIW, using another library such as -lz instead of -lm retuls in the same problem) Adding LDFLAGS+=-lc to the port's Makefile would've been enough, but I'm not sure if it'd be just working around an actual bug, plus libtool automatically strips -lc from the linker invocation: 7534 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) 7535 # Do not include libc due to us having libc/libc_r. 7536 test X-lc = "X$arg" && continue The port builds and links fine on 9.3 without any workarounds, and if I explicitly use ld.gold to link the above file it also works on HEAD. Is clang working as expected or is this a bug?