From owner-freebsd-toolchain@freebsd.org Wed May 11 21:16:44 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 3F359B37167 for ; Wed, 11 May 2016 21:16:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2FBD71665 for ; Wed, 11 May 2016 21:16:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u4BLGid6097055 for ; Wed, 11 May 2016 21:16:44 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-toolchain@FreeBSD.org Subject: [Bug 209413] c++ symbolic functions broken on arm Date: Wed, 11 May 2016 21:16:44 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: arm X-Bugzilla-Version: 11.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: sylvain@sylvaingarrigues.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-arm@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.22 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, 11 May 2016 21:16:44 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D209413 Sylvain Garrigues changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |freebsd-toolchain@FreeBSD.o | |rg --=20 You are receiving this mail because: You are on the CC list for the bug.= From owner-freebsd-toolchain@freebsd.org Fri May 13 21:21:04 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 BFE70B3A385 for ; Fri, 13 May 2016 21:21:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mailman.ysv.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id ACDFD1AF5 for ; Fri, 13 May 2016 21:21:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: by mailman.ysv.freebsd.org (Postfix) id A885CB3A383; Fri, 13 May 2016 21:21:04 +0000 (UTC) Delivered-To: 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 A80CFB3A381; Fri, 13 May 2016 21:21:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 99FC81AF2; Fri, 13 May 2016 21:21:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [IPv6:::1]) by freefall.freebsd.org (Postfix) with ESMTP id 88C58130D; Fri, 13 May 2016 21:21:04 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mail.xzibition.com (localhost [172.31.3.2]) by mail.xzibition.com (Postfix) with ESMTP id 44C241DE32; Fri, 13 May 2016 21:21:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at mail.xzibition.com Received: from mail.xzibition.com ([172.31.3.2]) by mail.xzibition.com (mail.xzibition.com [172.31.3.2]) (amavisd-new, port 10026) with LMTP id yXO8NbM6egXt; Fri, 13 May 2016 21:21:00 +0000 (UTC) To: toolchain@FreeBSD.org DKIM-Filter: OpenDKIM Filter v2.9.2 mail.xzibition.com B30C31DE2C Cc: arch@FreeBSD.org From: Bryan Drewery Subject: universe/buildworld: Skipping building cross clang when /usr/bin/cc matches the source tree. Organization: FreeBSD Message-ID: <9c5bdbae-9faf-1f16-8358-e35f5e079426@FreeBSD.org> Date: Fri, 13 May 2016 14:20:57 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 May 2016 21:21:04 -0000 Review at: https://reviews.freebsd.org/D6357 Full patch: https://people.freebsd.org/~bdrewery/patches/skip-clang-bootstrap-1.diff For context, when using an external compiler with our build currently it will use --sysroot/-L/-B flags as well as -target with clang. GCC assumes it is building the same arch as the compiler is built for since it lacks -target support. [This is just my commit message but I think it explains it well enough] Opportunistically skip building a cross-compiler with SMART_CROSS_COMPILER set. This will still build the compiler for the target but will not build the bootstrap cross-compiler in the cross-tools phase. Other toolchain bootstrapping, such as elftoolchan an binutils, currently still occurs. This will utilize the default CC (cc, /usr/bin/cc) as an external compile= r. This is planned to be on-by-default eventually. This will utilize the __FreeBSD_cc_version compiler macro defined in the source tree and compare it to CC's version. If they match then the cross-compiler is skipped. If [X]CC is an external compiler (absolute path) or WITHOUT_CROSS_COMPILER is already set, then this logic is skippe= d. If the expected bootstrap compiler type no longer matches the found CC compiler type (clang vs gcc), then the logic is skipped. As an extra safety check the version number is also compared from the compiler to the tree version. Clang: The macro FREEBSD_CC_VERSION is defined in: lib/clang/include/clang/Basic/Version.inc For clang -target will be used if TARGET_ARCH !=3D MACHINE_ARCH. This is from the current external toolchain logic. There is currently an assumption that the host compiler can build the TARGET_ARCH. This will usually be the case since we don't conditionalize target arch support in clang, but it will break when introducing new architectures. This problem is mitigated by incrementing the version when adding new architectures. GCC: The macro FBSD_CC_VER is defined in: gnu/usr.bin/cc/cc_tools/freebsd-native.h For GCC there is no simple -target support when TARGET_ARCH !=3D MACHINE_ARCH. In this case the opportunistic skip is not done. If we add proper support for this case in external toolchain logic then it will be fine to enable. This relies on the macros being incremented whenever any change occurs to these compilers that warrant rebuilding files. It also should never repeat earlier values. This also depends on http://reviews.llvm.org/D20037 and a change such as this: > index 94dc282..373cdb4 100644 > --- lib/clang/include/clang/Basic/Version.inc > +++ lib/clang/include/clang/Basic/Version.inc > @@ -8,3 +8,5 @@ > #define CLANG_VENDOR "FreeBSD " >=20 > #define SVN_REVISION "262564" > + > +#define FREEBSD_CC_VERSION 1100001U Here is a ministat as well (no ccache and clean build on all 6 builds). It's kind of obvious that skipping one of the clangs helps but I wanted to show how much it did for me: > x before > + after > +----------------------------------------------------------------------= ----+ > | + = x| > |+ + = x| > ||AM| = A| > +----------------------------------------------------------------------= ----+ > N Min Max Median Avg St= ddev > x 3 2966 2968 2966 2966.6667 1.154= 7005 > + 3 2300 2319 2318 2312.3333 10.69= 2677 > Difference at 95.0% confidence > -654.333 +/- 17.2371 > -22.0562% +/- 0.581024% > (Student's t, pooled s =3D 7.60482) This also works for universe! > ~/git/freebsd # grep SMART _*.buildworld > _.amd64.amd64.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" lin= e 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache c= c matches the source tree. Not bootstrapping a cross-compiler. > _.arm.arm.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" line 14= 4: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache cc ma= tches the source tree. Not bootstrapping a cross-compiler. > _.arm.armeb.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" line = 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache cc = matches the source tree. Not bootstrapping a cross-compiler. > _.arm.armv6.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" line = 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache cc = matches the source tree. Not bootstrapping a cross-compiler. > _.arm.armv6hf.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" lin= e 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache c= c matches the source tree. Not bootstrapping a cross-compiler. > _.i386.i386.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" line = 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache cc = matches the source tree. Not bootstrapping a cross-compiler. > _.pc98.i386.buildworld:make[2]: "/root/git/freebsd/Makefile.inc1" line = 144: SMART_CROSS_COMPILER: Determined that CC=3D/usr/local/bin/ccache cc = matches the source tree. Not bootstrapping a cross-compiler. A future improvement will be to build 1 clang before universe if /usr/bin/cc cannot be used. It will not be a cross-compiler but just a staged (in OBJDIR) external compiler that will use -target. I won't give GCC the same treatment since it lacks the nice -target support. --=20 Regards, Bryan Drewery