Date: Wed, 24 Feb 2016 12:27:03 +0100 From: Raphael Kubo da Costa <rakuco@FreeBSD.org> To: freebsd-toolchain@freebsd.org Subject: clang -pg, libm and the _end symbol Message-ID: <86povmbb7c.fsf@FreeBSD.org>
next in thread | raw e-mail | index | archive | help
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?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86povmbb7c.fsf>