From owner-freebsd-ppc@FreeBSD.ORG Thu Mar 12 01:03:43 2015 Return-Path: Delivered-To: freebsd-ppc@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8C298288 for ; Thu, 12 Mar 2015 01:03:43 +0000 (UTC) Received: from asp.reflexion.net (outbound-241.asp.reflexion.net [69.84.129.241]) (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 0D53AA71 for ; Thu, 12 Mar 2015 01:03:34 +0000 (UTC) Received: (qmail 29622 invoked from network); 12 Mar 2015 01:03:33 -0000 Received: from unknown (HELO mail-cs-01.app.dca.reflexion.local) (10.81.19.1) by 0 (rfx-qmail) with SMTP; 12 Mar 2015 01:03:33 -0000 Received: by mail-cs-01.app.dca.reflexion.local (Reflexion email security v7.40.1) with SMTP; Wed, 11 Mar 2015 21:03:33 -0400 (EDT) Received: (qmail 15546 invoked from network); 12 Mar 2015 01:03:33 -0000 Received: from unknown (HELO iron2.pdx.net) (69.64.224.71) by 0 (rfx-qmail) with (DHE-RSA-AES256-SHA encrypted) SMTP; 12 Mar 2015 01:03:33 -0000 X-No-Relay: not in my network X-No-Relay: not in my network Received: from [192.168.1.8] (c-67-189-19-145.hsd1.or.comcast.net [67.189.19.145]) by iron2.pdx.net (Postfix) with ESMTPSA id 732FA1C439E; Wed, 11 Mar 2015 18:03:27 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) Subject: Re: 11.0-CURRENT: ofw_standard.c:175 (for example): attempts to cast char* to cell_t fail in cross compile from powerpc to powerpc64 From: Mark Millard In-Reply-To: <5500E2C7.7020903@freebsd.org> Date: Wed, 11 Mar 2015 18:03:31 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <6180F9D9-0D41-498A-A8CC-E4BAC7223627@dsl-only.net> References: <5500E2C7.7020903@freebsd.org> To: Nathan Whitehorn X-Mailer: Apple Mail (2.2070.6) Cc: FreeBSD PowerPC ML X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Mar 2015 01:03:43 -0000 You are right: Looking at the logs shows that I did not type all the = "64"s that I should have for the make command and I typed = GENERICvtsc-NODEBUG instead of GENERIC64vtsc-NODEBUG. So the only useful note from this mistake of mine is that the = environment does not catch the combination when tried from a powerpc = 11.0-CURRENT build. Rebulding... And thanks yet again. =3D=3D=3D Mark Millard markmi at dsl-only.net On 2015-Mar-11, at 05:50 PM, Nathan Whitehorn wrote: That is indeed true (OF on PowerPC is 32-bit always). However, = ofw_standard.c is not part of the 64-bit kernel since, as you note, it = does not work on 64-bit PPC systems. I think you are building the wrong = kernel here, or are using the wrong toolchain. In particular, I think = you are trying to build GENERIC for powerpc64 (you need GENERIC64 = instead). The build system is supposed to yell at you if you try to = build GENERIC with a 64-bit toolchain, but it may have gotten confused = by your cross-build environment. -Nathan On 03/11/15 17:34, Mark Millard wrote: > Given the mix of the new relocatable kernels, powerpc64 (and other > = 32 bit-bit addressed openfirmware use?) and "typedef uint32_t cell_t;" = (at least for sys/powerpc/include/ofw_machdep.h)... >=20 > For the char*-to-cell_t casing in 11.0-CURRENT's ofw_standard.c to = work for powerpc64 and others with larger than 32 bit addresses but = restrictions in the openfirmware implementation it would seem that = something must force the strings to stay in lower memory where zero = extended 32 bit values work as addresses. (Which may well be a = requirement of the Openfirmware implementation --no matter how things = are expressed in C/C++ code.) >=20 > On fundamentals it looks to me like the 11.0-CURRENT ofw_standard.c = code assumes that only a <=3D 32 bit pointer environment would be using = openfirmware: I see no hook for keeping the relevant strings inside the = smaller address range. >=20 >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 > On 2015-Mar-11, at 05:12 PM, Mark Millard = wrote: >=20 > Basic context (on a PowerMac G5 but using a powerpc 11.0-CURRENT build = to cross build targeting powerpc64): >=20 > # freebsd-version -ku; uname -a > 11.0-CURRENT > 11.0-CURRENT > FreeBSD FBSDG4C0 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r279514M: Mon = Mar 9 22:24:27 PDT 2015 = root@FBSDG4S0:/usr/obj/usr/srcC/sys/GENERICvtsc-NODEBUG powerpc > # svnlite info > Path: . > Working Copy Root Path: /usr/srcC > URL: https://svn0.us-west.freebsd.org/base/head > Relative URL: ^/head > Repository Root: https://svn0.us-west.freebsd.org/base > Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f > Revision: 279514 > Node Kind: directory > Schedule: normal > Last Changed Author: adrian > Last Changed Rev: 279514 > Last Changed Date: 2015-03-01 18:27:25 -0800 (Sun, 01 Mar 2015) >=20 >=20 > The problem for building powerpc64 kernels from a powerpc build's = context... >=20 > I tried to buildworld buildkernel with TARGET=3Dpowerpc = TARGET_ARCH=3Dpowerpc64. while buildworld completed buildkernel did not. >=20 > I give the relevant part of the script output file below but the basic = problem shows up as point to integer conversions with mismatched sizes = in code casting (for example) char* to cell_t such as: >=20 > static int > ofw_std_test(ofw_t ofw, const char *name) > { > struct { > cell_t name; > cell_t nargs; > cell_t nreturns; > cell_t service; > cell_t missing; > } args =3D { > (cell_t)"test", // <<<<<<<<<< LOOK HERE > 1, > 1, > }; >=20 > args.service =3D (cell_t)name; // <<<<<<<<<< LOOK HERE > if (openfirmware(&args) =3D=3D -1) > return (-1); > return (args.missing); > } >=20 >=20 > The script log shows: >=20 > ... > ctfconvert -L VERSION -g ofwbus.o^M > cc -c -O -pipe -g -Wall -Wredundant-decls -Wnested-externs = -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline = -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-in > clude-dirs -fdiagnostics-show-option -Wno-unknown-pragmas = -Wno-uninitialized -nostdinc -I. -I/usr/srcC/sys = -I/usr/srcC/sys/contrib/altq -I/usr/srcC/sys/contrib/libfdt -D_KERNEL = -DHAVE_KERNEL_OPTION > _HEADERS -include opt_global.h -msoft-float -Wa,-many = -fno-omit-frame-pointer -mno-altivec -ffreestanding -fwrapv = -fstack-protector -gdwarf-2 -Wno-uninitialized -Wall -Wredundant-decls = -Wnested-exter > ns -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline = -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions = -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas > -Wno-uninitialized -fno-common -fms-extensions -finline-limit=3D15000 = --param inline-unit-growth=3D100 --param large-function-growth=3D1000 = -msoft-float -std=3Diso9899:1999 -Werror /usr/srcC/sys/dev/ofw/ > ofw_standard.c^M > cc1: warnings being treated as errors^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_test':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:175: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:180: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_interpret':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:195: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:202: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_peer':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:226: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_child':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:248: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_parent':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:270: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_instance_to_package':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:292: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_getproplen':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:315: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:321: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_getprop':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:342: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:348: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:349: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_nextprop':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:370: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:376: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:377: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_setprop':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:399: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:405: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:406: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_canon':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:426: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:431: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:432: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_finddevice':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:450: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:455: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_instance_to_path':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:474: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:480: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_package_to_path':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:500: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:506: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function = 'ofw_std_call_method':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:526: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:537: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_open':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:567: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:572: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_close':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:588: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_read':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:610: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:616: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_write':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:637: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:643: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_seek':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:663: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_claim':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:693: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:698: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:703: warning: cast to pointer = from integer of different size [-Wint-to-pointer-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_release':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:717: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:722: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_enter':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:740: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > /usr/srcC/sys/dev/ofw/ofw_standard.c: In function 'ofw_std_exit':^M > /usr/srcC/sys/dev/ofw/ofw_standard.c:758: warning: cast from pointer = to integer of different size [-Wpointer-to-int-cast]^M > *** Error code 1^M > ^M > Stop.^M > make[2]: stopped in = /usr/obj/powerpc.powerpc64/usr/srcC/sys/GENERICvtsc-NODEBUG^M > *** Error code 1^M > ^M > Stop.^M > make[1]: stopped in /usr/srcC^M > *** Error code 1^M >=20 >=20 > =3D=3D=3D > Mark Millard > markmi at dsl-only.net >=20 >=20 >=20