From owner-svn-src-all@freebsd.org Tue Aug 23 19:29:38 2016 Return-Path: Delivered-To: svn-src-all@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 B7AC8BC34BC; Tue, 23 Aug 2016 19:29:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (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 93DB51729; Tue, 23 Aug 2016 19:29:38 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7NJTbKX027262; Tue, 23 Aug 2016 19:29:37 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7NJTbr4027260; Tue, 23 Aug 2016 19:29:37 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201608231929.u7NJTbr4027260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Tue, 23 Aug 2016 19:29:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304695 - head X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Aug 2016 19:29:38 -0000 Author: bdrewery Date: Tue Aug 23 19:29:37 2016 New Revision: 304695 URL: https://svnweb.freebsd.org/changeset/base/304695 Log: Fix in-tree GCC builds after r304681. There were a few issues. - In-tree GCC won't have X_COMPILER_TYPE defined but will have WANT_COMPILER_TYPE==gcc set from the SYSTEM_COMPILER logic that can be used. Make the clang check specific to clang as well to ensure -target doesn't leak into a GCC build. - When using a cross-compiler GCC (with a default sysroot or arch) and also passing --sysroot, it basically forgets all internal paths for libraries. We've already worked around this quite a bit for the external toolchains. Now for the in-tree bootstrap cross-compiler GCC, also pass in the needed -B${WORLDTMP}/usr/lib to find the crt object files, but also -isystem and -L to fix the paths. This creates quite a spammy build log, but it is clear and still achieves the goals and stays consistent between internal and external build flags. Reducing the spam by using the '=' prefix feature will help and be done later. MFC after: 3 days X-MFC-With: r304681 Reported by: bz Pointyhat to: bdrewery Sponsored by: EMC / Isilon Storage Division Modified: head/Makefile.inc1 head/Makefile.libcompat Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Tue Aug 23 19:28:01 2016 (r304694) +++ head/Makefile.inc1 Tue Aug 23 19:29:37 2016 (r304695) @@ -572,18 +572,23 @@ TARGET_ABI= gnueabihf TARGET_ABI= gnueabi .endif .endif -.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc +.if ${WANT_COMPILER_TYPE} == gcc || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) # GCC requires -isystem and -L when using a cross-compiler. --sysroot # won't set header path and -L is used to ensure the base library path # is added before the port PREFIX library path. XCFLAGS+= -isystem ${WORLDTMP}/usr/include -L${WORLDTMP}/usr/lib +# GCC requires -B to find /usr/lib/crti.o when using a cross-compiler +# combined with --sysroot. +XCFLAGS+= -B${WORLDTMP}/usr/lib # Force using libc++ for external GCC. # XXX: This should be checking MK_GNUCXX == no .if ${X_COMPILER_VERSION} >= 40800 XCXXFLAGS+= -isystem ${WORLDTMP}/usr/include/c++/v1 -std=c++11 \ -nostdinc++ -L${WORLDTMP}/../lib/libc++ .endif -.else +.elif ${WANT_COMPILER_TYPE} == clang || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == clang) TARGET_ABI?= unknown TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x86_64/}-${TARGET_ABI}-freebsd12.0 XCFLAGS+= -target ${TARGET_TRIPLE} Modified: head/Makefile.libcompat ============================================================================== --- head/Makefile.libcompat Tue Aug 23 19:28:01 2016 (r304694) +++ head/Makefile.libcompat Tue Aug 23 19:29:37 2016 (r304695) @@ -73,7 +73,8 @@ LIBCOMPATCFLAGS+= ${LIBCOMPATCPUFLAGS} \ # Clang/GCC. LIBCOMPATCFLAGS+= -B${LIBCOMPATTMP}/usr/lib${libcompat} -.if defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc +.if ${WANT_COMPILER_TYPE} == gcc || \ + (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) # GCC requires -isystem when using a cross-compiler and --sysroot. Note that # Makefile.inc1 only applies this with an external compiler but libcompat # always does since even in-tree GCC 4.2 needs this to override the built-in