From owner-freebsd-toolchain@freebsd.org Mon Apr 4 15:29:05 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 8782CB02FB3 for ; Mon, 4 Apr 2016 15:29:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ig0-x22e.google.com (mail-ig0-x22e.google.com [IPv6:2607:f8b0:4001:c05::22e]) (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 270AA1D98 for ; Mon, 4 Apr 2016 15:29:05 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ig0-x22e.google.com with SMTP id ma7so94322326igc.0 for ; Mon, 04 Apr 2016 08:29:05 -0700 (PDT) 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:date:message-id:subject :from:to:cc; bh=jOkdCTcwh4jOi+cf4H+UnIOYBAxLG/meVwyNc0/C2bU=; b=gTGsysbQT5L7KuGHrlrailFlW43xjEnkFlcatPN3IhaWsU4XuGx3Y5mRCuph+BWy4d P19Nhr9ZVm6p2TLjA2EzY12YSh74ia2Z7VyVQ2hwucmChVhDThTxThzFzHT+U5uIrW3W +vo8+Zu7n55uQtt8r0ByzWEJwUHbdGqHY3h2AGb8s6lyDIWJVUcU9Oxwx1ByqfhY3+9e fHWXUtt6kGyxP+xWVVdgUSgVEljxsDTym+vXGc21+6ukCNKiaNIumBFUztQS4emzYN68 M6O9pbv7nZghH7hnWPR55JGg1lcHBmcsM9ksWoYa0wX3/wGZmMWuYe5ndKCLNymc3Nd1 jx8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=jOkdCTcwh4jOi+cf4H+UnIOYBAxLG/meVwyNc0/C2bU=; b=kv3GRMAL6GeWlO1g/duiX77TUx0bO1LxDG5XFd4BZZgCLhne83cleg2o9tJBP/HP/Y McnAuU9isCOiSVGZIA9ymC3QzaFPk/4rMvr9hx8yndw1UNX0d8xYVbcTczuAcnQAZY4r jppsRsxJbP3Oj5cvEzTpcsG4jco58Cr6QBVWDX6mXH3tXwt9sD0e+h8FdtZrPLzdYbSy FbhkYyoZwulOT1CbdpWEu7DrA1tT7BgEyYOfCNmnV5KeAXGMm8V1i3/DvwIGt6KTJxV2 IxzG86QXyJOqa6mPA0qNl+/zWwnGe5GfNNTbmIqZlC2LN6UG3ezayvlyU1QYcrOSpMUI OMfA== X-Gm-Message-State: AD7BkJKjWz4+oz1m9FPSLUCEL3dCxIzXqQQknpYbO/gZL9uDDkX5dzwdct2hyGpwqO/5W7+lo4sz/x3cU80/pg== MIME-Version: 1.0 X-Received: by 10.50.108.108 with SMTP id hj12mr10588453igb.57.1459783720931; Mon, 04 Apr 2016 08:28:40 -0700 (PDT) Sender: wlosh@bsdimp.com Received: by 10.36.194.3 with HTTP; Mon, 4 Apr 2016 08:28:40 -0700 (PDT) X-Originating-IP: [50.253.99.174] In-Reply-To: <3A6ED16B-F941-41FC-B844-50292894D5F4@dsl-only.net> References: <3A6ED16B-F941-41FC-B844-50292894D5F4@dsl-only.net> Date: Mon, 4 Apr 2016 09:28:40 -0600 X-Google-Sender-Auth: 4vHw8rHAOxqhX5PJEU33_K6Gka4 Message-ID: Subject: Re: 11.0: head/lib/libsysdecode/Makefile for . . ./libsoft/usr/include uses CPP when XCPP needed? From: Warner Losh To: Mark Millard Cc: FreeBSD Toolchain , freebsd-arm Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: freebsd-toolchain@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Maintenance of FreeBSD's integrated toolchain List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Apr 2016 15:29:05 -0000 On Mon, Apr 4, 2016 at 12:18 AM, Mark Millard wrote: > The following may be suggestive of the "upstream" issue: > > Makefile.libcompat has things like. . . > > > .if ${TARGET_ARCH} == "amd64" > . . . > > LIB32WMAKEFLAGS= \ > > AS="${XAS} --32" \ > > LD="${XLD} -m elf_i386_fbsd -Y > P,${LIBCOMPATTMP}/usr/lib32" \ > > OBJCOPY="${XOBJCOPY}" > > > > > .elif ${TARGET_ARCH} == "powerpc64" > . . . > > LIB32WMAKEFLAGS= \ > > LD="${XLD} -m elf32ppc_fbsd" \ > > OBJCOPY="${XOBJCOPY}" > > .endif > > that set up to deal with some host vs. cross distinctions. > > But: > > > # soft-fp world > > .if ${TARGET_ARCH} == "armv6" > > LIBSOFTCFLAGS= -DCOMPAT_SOFTFP > > LIBSOFTCPUFLAGS= -mfloat-abi=softfp > > LIBSOFTWMAKEENV= CPUTYPE=soft MACHINE=arm MACHINE_ARCH=armv6 > > LIBSOFTWMAKEFLAGS= -DCOMPAT_SOFTFP > > .endif > > in the file has no such translations and Makefile.libcompat has no > examples of ${XCPP} anywhere. > > The only place that has ${XCPP} in /usr/src/Makefile* and > /usr/src/share/mk/* is Makefile.inc1 : > Yes, X* is an invention of the top level Makefile*. I've long been uneasy about it, but haven't been able to articulate why. > > CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} > ${XCXXFLAGS}" \ > > CPP="${XCPP} ${XCFLAGS}" \ > > AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \ > > OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \ > > RANLIB=${XRANLIB} STRINGS=${XSTRINGS} \ > > SIZE="${XSIZE}" > > but WMAKE does not use CROSSENV. Maybe it got removed over time? It there's one more layer of indirection? However, I'm not sure I agree with that: We see that's it's part of WMAKEENV, which is used by WMAKE: WMAKEENV= ${CROSSENV} \ ... WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP} And several others. Am I missing something or looking at old code? Warner > > > === > Mark Millard > markmi at dsl-only.net > > On 2016-Apr-3, at 10:22 PM, Mark Millard wrote: > > On 2016-Apr-3, at 9:48 PM, Warner Losh wrote: > > > > On Sun, Apr 3, 2016 at 10:25 PM, Mark Millard > wrote: > > For an amd64 -> armv7a (rpi2 targeting) cross-compile the code > > > >> # $FreeBSD: head/lib/libsysdecode/Makefile 295931 2016-02-23 20:00:55Z > jhb $ > >> > >> . . . > >> ioctl.c: mkioctls > >> env MACHINE=${MACHINE} CPP="${CPP}" \ > >> /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > > ${.TARGET} > > > > (with its use of CPP instead of the XCPP) got: > > > >> --- all_subdir_lib/libsysdecode --- > >> --- ioctl.c --- > >> env MACHINE=arm CPP="/usr/bin/clang-cpp" /bin/sh > /usr/src/lib/libsysdecode/mkioctls > /usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include > ioctl.c > >> . . . > >> --- all_subdir_lib/libsysdecode --- > >> In file included from :17: > >> In file included from > /usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/dev/nvme/nvme.h:36: > >> In file included from > /usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/sys/param.h:135: > >> In file included from > /usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/machine/param.h:49: > >> > /usr/obj/clang/arm.armv6/usr/src/libsoft/usr/include/machine/acle-compat.h:182:4: > error: Unable to determine architecture version. > >> # error Unable to determine architecture version. > >> ^ > > > > In my case I had the following in the in-use src.conf in order to > control the cross compile specifics: > > > >> XCC=/usr/bin/clang -target ${TO_TYPE}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > >> XCXX=/usr/bin/clang++ -target ${TO_TYPE}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > >> XCPP=/usr/bin/clang-cpp -target ${TO_TYPE}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > > > > > > (I've been doing such for a long time but only just progressed to a 11.0 > source vintage with libsoft involved.) > > > > Even if I'm out of bounds for technique in some way I expect that > > > >> ioctl.c: mkioctls > >> env MACHINE=${MACHINE} CPP="${CPP}" \ > >> /bin/sh ${.CURDIR}/mkioctls ${DESTDIR}${INCLUDEDIR} > > ${.TARGET} > > > > is not doing everything it should to have the full context needed for . > . ./machine/acle-compat.h . > > > > It's gotta be upstream. XCPP XCC and XCXX are all exclusive to > Makefile.inc1. It's up to it to sort out the > > rest... And none of the X{AR,AS,LD,etc} are defined, so there's bound > to be an impedance mismatch. :) > > In the past when I've seen this it's been due to some kind of variable > contamination, perhaps one that's > > not otherwise known... > > > > Warner > > For reference the src.conf used for amd64 -> arm is: > > > KERNCONF=RPI2-NODBG > > TARGET=arm > > .if ${.MAKE.LEVEL} == 0 > > TARGET_ARCH=armv6 > > .export TARGET_ARCH > > .endif > > # > > WITH_LIBSOFT= > > WITH_FAST_DEPEND= > > WITH_LIBCPLUSPLUS= > > WITH_BINUTILS_BOOTSTRAP= > > WITH_CLANG= > > WITH_CLANG_IS_CC= > > WITH_CLANG_FULL= > > WITH_LLDB= > > WITH_CLANG_EXTRAS= > > WITH_BOOT= > > # > > WITHOUT_LIB32= > > WITHOUT_ELFTOOLCHAIN_BOOTSTRAP= > > WITHOUT_CLANG_BOOTSTRAP= > > WITHOUT_GCC_BOOTSTRAP= > > WITHOUT_GCC= > > WITHOUT_GNUCXX= > > # > > NO_WERROR= > > MALLOC_PRODUCTION= > > # > > WITH_DEBUG_FILES= > > # > > .if ${.MAKE.LEVEL} == 0 > > XCC=/usr/bin/clang -target ${TARGET_ARCH}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > > XCXX=/usr/bin/clang++ -target ${TARGET_ARCH}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > > XCPP=/usr/bin/clang-cpp -target ${TARGET_ARCH}--freebsd11.0-gnueabi > -march=armv7a -mcpu=cortex-a7 -mno-unaligned-access > > .export XCC > > .export XCXX > > .export XCPP > > .endif > > # > > .if ${.MAKE.LEVEL} == 0 > > CC=/usr/bin/clang > > CXX=/usr/bin/clang++ > > CPP=/usr/bin/clang-cpp > > .export CC > > .export CXX > > .export CPP > > .endif > > > === > Mark Millard > markmi at dsl-only.net > > >