From owner-freebsd-ppc@FreeBSD.ORG Thu Mar 12 00:50:19 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 E1D7769 for ; Thu, 12 Mar 2015 00:50:19 +0000 (UTC) Received: from c.mail.sonic.net (c.mail.sonic.net [64.142.111.80]) (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 C3CD28F5 for ; Thu, 12 Mar 2015 00:50:19 +0000 (UTC) Received: from aurora.physics.berkeley.edu (aurora.Physics.Berkeley.EDU [128.32.117.67]) (authenticated bits=0) by c.mail.sonic.net (8.15.1/8.15.1) with ESMTPSA id t2C0oF2o011535 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 11 Mar 2015 17:50:15 -0700 Message-ID: <5500E2C7.7020903@freebsd.org> Date: Wed, 11 Mar 2015 17:50:15 -0700 From: Nathan Whitehorn User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Mark Millard , FreeBSD PowerPC ML 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 References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Sonic-CAuth: UmFuZG9tSVYlg/QsMXLwVc6O3Y7bm2FHc2zGagTLpj+4D4/hRrQOnCALhPaw66d1uFT07snvK2B6QCPv2NOiUIKNnuJLnQbsoRbeMC8I2ag= X-Sonic-ID: C;oFEcv1HI5BGLTe8Jj30JFw== M;vjJyv1HI5BGLTe8Jj30JFw== X-Spam-Flag: No X-Sonic-Spam-Details: 0.0/5.0 by cerberusd 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 00:50:20 -0000 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)... > > 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.) > > On fundamentals it looks to me like the 11.0-CURRENT ofw_standard.c code assumes that only a <= 32 bit pointer environment would be using openfirmware: I see no hook for keeping the relevant strings inside the smaller address range. > > > === > Mark Millard > markmi at dsl-only.net > > On 2015-Mar-11, at 05:12 PM, Mark Millard wrote: > > Basic context (on a PowerMac G5 but using a powerpc 11.0-CURRENT build to cross build targeting powerpc64): > > # 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) > > > The problem for building powerpc64 kernels from a powerpc build's context... > > I tried to buildworld buildkernel with TARGET=powerpc TARGET_ARCH=powerpc64. while buildworld completed buildkernel did not. > > 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: > > 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 = { > (cell_t)"test", // <<<<<<<<<< LOOK HERE > 1, > 1, > }; > > args.service = (cell_t)name; // <<<<<<<<<< LOOK HERE > if (openfirmware(&args) == -1) > return (-1); > return (args.missing); > } > > > The script log shows: > > ... > 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=15000 --param inline-unit-growth=100 --param large-function-growth=1000 -msoft-float -std=iso9899: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 > > > === > Mark Millard > markmi at dsl-only.net > > >