From owner-svn-src-all@freebsd.org Sun Nov 5 19:56:39 2017 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 B48EEE4FC01 for ; Sun, 5 Nov 2017 19:56:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 68E3468220 for ; Sun, 5 Nov 2017 19:56:39 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x230.google.com with SMTP id p138so2953272itp.2 for ; Sun, 05 Nov 2017 11:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=nnni17/uyd2H1RfauzF3vb/8ehvB7yfZya+gVbbY+2Q=; b=KOQi14701u7/y4sh7T8sQ1xPV3J0a3PFLmVfAHIwMlP1YpLtWoZDpkIq/M3/B83ScF pQKJKacUDkY0PaSL85BzADGbWoEOSmZSljhzTZgN4j7+qdKRRuW4K/uFA9ctp8nYbTOR dhPMXC/yO4ahpk0GBC/fWaykMq3v2OerSAvmvpvGuDQtNewIQUZRUrzWvdX3kHRlPfat FHIkBg4EivwcK/Nkx3esqZIJWbipaLSWJAY50p9EkBURlPib+GJA568H3Qn1wS9Y4M8g lIKQb9znncMYqwecocFDQibE1ecaqth5SmC5lSdGUziAshShZH6JsX5hfRoBcswZmr3F GoCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=nnni17/uyd2H1RfauzF3vb/8ehvB7yfZya+gVbbY+2Q=; b=tjXInHpEHAtEJ9JkPHnmhw8096UUAjORBj5NhppbucWc9cTUHPdLHlUq2xOE+XXKAG H9uJG7UcmoQpKqZamu4u7QzPp8OR0vFcAcFgrDcRusiMa4l6mBTMWYgyhhwZVPaVYKOv CuDoUXp8Z53A2KY31XqV/DaS22q77YtKjHtWFe47/VSVSXpZDzO8ZxWCD3zwvXYsgYXg 9QUl3iU81poam7mqMg/mT4MjNjNpCK0cAoe6bLacBcGFj82tdpqSVMZYMYoOkoRUNCT7 3ADWbJxkk9duTD27PNccI1gRpq4fbobPEwFHAqmi/2nsFm/Z9+15Fy7XkNvUiTF15Pcx 8DdQ== X-Gm-Message-State: AJaThX7g99nicIBdsogVO4um/DdePKKR2yZAV6gX1tBQxgGUy9mYqCxH viXgY6Uufu1OzECUqdT8Ju16hb5clEI+E52hliInKw== X-Google-Smtp-Source: ABhQp+SrvekvB3eV4rC2QO5O3CLo+YIPWuAea/5/hjYLDLWAXuxrWSKwI8+k0dmJs4MSS/uQixYYTRauraPn41S7YWI= X-Received: by 10.36.94.129 with SMTP id h123mr5621270itb.64.1509911798701; Sun, 05 Nov 2017 11:56:38 -0800 (PST) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.57.22 with HTTP; Sun, 5 Nov 2017 11:56:38 -0800 (PST) X-Originating-IP: [2603:300b:6:5100:c96d:b7be:45de:c872] In-Reply-To: References: <201711051938.vA5Jcpnc033399@repo.freebsd.org> From: Warner Losh Date: Sun, 5 Nov 2017 12:56:38 -0700 X-Google-Sender-Auth: qHccbQizBZgjQvqvp8nYNLWqcGU Message-ID: Subject: Re: svn commit: r325443 - in head: . lib/libclang_rt share/mk To: Ngie Cooper Cc: src-committers , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 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: Sun, 05 Nov 2017 19:56:39 -0000 On Sun, Nov 5, 2017 at 12:52 PM, Warner Losh wrote: > > > On Sun, Nov 5, 2017 at 12:38 PM, Ngie Cooper wrote: > >> Author: ngie >> Date: Sun Nov 5 19:38:51 2017 >> New Revision: 325443 >> URL: https://svnweb.freebsd.org/changeset/base/325443 >> >> Log: >> Fix paths for cross-built versions of lib/libclang_rt and hardfloat arm >> variants >> >> - Define TARGET_CPUARCH and use in libclang_rt as the basis for CRTARCH >> >> When cross-compiling, the wrong architecture was being embedded in the >> libclang_rt binary filenames. It should be based on TARGET_ARCH >> (target), not >> MACHINE_ARCH (host). >> > MACHINE_ARCH, btw, is always the target we are compiling for in the Makefiles that are not Makefile.inc1 at the top level. We do not define TARGET* anything below that. Warner > If TARGET_ARCH isn't defined (host-builds), fallback to MACHINE_ARCH. >> >> - Define CRTARCH to armhf when TARGET/TARGET_ARCH are set to >> arm/armv[67] >> >> TARGET_ABI/TARGET_CPU in Makefile.inc1 sets the ABI to gnueabihf, >> which >> affects the clang lookup path per `getArchNameForCompilerRTLib(..)` >> in >> contrib/llvm/tools/clang/lib/Driver/ToolChain.cpp, so chase clang and >> Linux's assumed naming convention for hard-float arm architectures. >> >> CROSSENV (in Makefile.inc1) sets CPUTYPE/MACHINE(_ARCH)? to the >> TARGET*-relevant values when building the `libraries` target, so test >> those variables instead. >> >> - Add OLD_FILES/OLD_LIBS entries for TARGET/TARGET_ARCH == >> arm/armv[67]. This >> impacts only arm/armv6 and arm/armv7. >> >> PR: 222925 >> >> Modified: >> head/ObsoleteFiles.inc >> head/lib/libclang_rt/Makefile.inc >> head/share/mk/sys.mk >> Directory Properties: >> head/ (props changed) >> >> Modified: head/ObsoleteFiles.inc >> ============================================================ >> ================== >> --- head/ObsoleteFiles.inc Sun Nov 5 19:25:06 2017 (r325442) >> +++ head/ObsoleteFiles.inc Sun Nov 5 19:38:51 2017 (r325443) >> @@ -38,6 +38,21 @@ >> # xargs -n1 | sort | uniq -d; >> # done >> >> +# 20171105: fixing lib/libclang_rt CRTARCH for arm:armv[67]. >> +.if ${MACHINE} == "arm" >> +.if ${MACHINE_ARCH:Marmv[67]*} != "" && ${CPUTYPE:M*soft*} == "" >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan >> -preinit-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-arm.a >> +OLD_LIBS+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan-arm.so >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.asan_cxx-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.profile-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.safestack-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stats-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.stat >> s_client-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsa >> n_standalone-arm.a >> +OLD_FILES+=usr/lib/clang/5.0.0/lib/freebsd/libclang_rt.ubsa >> n_standalone_cxx-arm.a >> +.endif >> +.endif >> # 20171104: libcap_random should be in /lib not in /usr/lib >> OLD_LIBS+=usr/lib/libcap_random.so.0 >> # 20171104: Casper can work only as shared library >> >> Modified: head/lib/libclang_rt/Makefile.inc >> ============================================================ >> ================== >> --- head/lib/libclang_rt/Makefile.inc Sun Nov 5 19:25:06 2017 >> (r325442) >> +++ head/lib/libclang_rt/Makefile.inc Sun Nov 5 19:38:51 2017 >> (r325443) >> @@ -2,7 +2,14 @@ >> >> .include >> >> -CRTARCH= ${MACHINE_CPUARCH:C/amd64/x86_64/} >> +# NOTE: based on TARGET_ABI/TARGET_CPUTYPE, set in Makefile.inc1 . >> +.if ${MACHINE} == "arm" >> +.if ${MACHINE_ARCH:Marmv[67]*} != "" && ${CPUTYPE:M*soft*} == "" >> +CRTARCH= armhf >> +.endif >> +.endif >> + >> +CRTARCH?= ${TARGET_CPUARCH:C/amd64/x86_64/} >> CRTSRC= ${SRCTOP}/contrib/compiler-rt >> >> .PATH: ${CRTSRC}/lib >> >> Modified: head/share/mk/sys.mk >> ============================================================ >> ================== >> --- head/share/mk/sys.mk Sun Nov 5 19:25:06 2017 (r325442) >> +++ head/share/mk/sys.mk Sun Nov 5 19:38:51 2017 (r325443) >> @@ -15,6 +15,11 @@ unix ?= We run FreeBSD, not UNIX. >> # >> __TO_CPUARCH=C/mips(n32|64)?(el)?(hf)?/mips/:C/arm(v[67])?( >> eb)?/arm/:C/powerpc(64|spe)/powerpc/:C/riscv64(sf)?/riscv/ >> MACHINE_CPUARCH=${MACHINE_ARCH:${__TO_CPUARCH}} >> +.ifdef TARGET_ARCH >> +TARGET_CPUARCH=${TARGET_ARCH:${__TO_CPUARCH}} >> +.else >> +TARGET_CPUARCH=${MACHINE_CPUARCH} >> +.endif >> .endif >> > > Please back this out. This os wrong. TARGET_* is never to be defined > outside of Makefile.inc1. There are a couple of places in the tree that > have TARGET_ stuff defined that have a private meaning to the places in the > tree where it is defined. It is never a global setting. > > Warner > >