svn commit: r255321 - in head: contrib/llvm/tools/clang/lib/Driver gnu/lib gnu/usr.bin/cc share/mk sys/sys tools/build/options

David Chisnall theraven at FreeBSD.org
Sun Sep 8 20:30:53 UTC 2013


On 8 Sep 2013, at 21:18, Dag-Erling Smørgrav <des at des.no> wrote:

> David Chisnall <theraven at FreeBSD.org> writes:
>> Log:
>>  On platforms where clang is the default compiler, don't build gcc or libstdc++.
> 
> This uncovers what I think is a bug in bsd.prog.mk:
> 
> des at ds4 /usr/src/usr.bin% make
> ===> alias (all)
> ===> apply (all)
> ===> ar (all)
> ===> asa (all)
> ===> at (all)
> ===> atf (all)
> ===> atf/atf-config (all)
> make[2]: /usr/obj/usr/src/usr.bin/atf/atf-config/.depend, 111: ignoring stale .depend for /usr/obj/usr/src/tmp/usr/lib/libstdc++.a
> c++ -O2 -pipe -march=native -DGDB=\"gdb\" -DHAVE_CONFIG_H -I/usr/src/usr.bin/atf/atf-config/../../../contrib/atf -g -Qunused-arguments -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wpointer-arith -Wno-uninitialized -Wno-empty-body -Wno-string-plus-int -Wno-tautological-compare -Wno-unused-value -Wno-parentheses-equality -Wno-unused-function -Wno-conversion -Wno-c++11-extensions -g  -o atf-config atf-config.o -latf-c++ -latf-c
> des at ds4 /usr/src/usr.bin% grep libstdc /usr/obj/usr/src/usr.bin/atf/atf-config/.depend 
> atf-config: /usr/obj/usr/src/tmp/usr/lib/libstdc++.a
> des at ds4 /usr/src/usr.bin% stat /usr/obj/usr/src/tmp/usr/lib/libstdc++.a
> stat: /usr/obj/usr/src/tmp/usr/lib/libstdc++.a: stat: No such file or directory
> 
> That line was added by bsd.prog.mk:
> 
> .if defined(PROG_CXX)
> .if !empty(CXXFLAGS:M-stdlib=libc++)
>        echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
> .else
>        echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
> .endif
> .endif
> 
> AFAICT, this logic should be inverted on platforms where clang is the
> default compiler - perhaps like this:
> 
> Index: share/mk/bsd.prog.mk
> ===================================================================
> --- share/mk/bsd.prog.mk	(revision 255393)
> +++ share/mk/bsd.prog.mk	(working copy)
> @@ -173,7 +173,7 @@
> .else
> 	echo ${PROG}: ${LIBC} ${DPADD} >> ${DEPENDFILE}
> .if defined(PROG_CXX)
> -.if !empty(CXXFLAGS:M-stdlib=libc++)
> +.if ${MK_CLANG_IS_CC} != "no" || !empty(CXXFLAGS:M-stdlib=libc++)
> 	echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
> .else
> 	echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}
> 
> although this misses the case where CLANG_IS_CC but we still want the
> old libstdc++ - is that even possible?

This case is possible with -stdlib=libstdc++, so similar logic should apply.  I think it should say:

.if ${MK_CLANG_IS_CC} != "no" && empty(CXXFLAGS:M-stdlib=libstdc++)
	echo ${PROG}: ${LIBCPLUSPLUS} >> ${DEPENDFILE}
.else
	echo ${PROG}: ${LIBSTDCPLUSPLUS} >> ${DEPENDFILE}

David



More information about the svn-src-all mailing list