11.0-CURRENT: ofw_standard.c:175 (for example): attempts to cast char* to cell_t fail in cross compile from powerpc to powerpc64
Mark Millard
markmi at dsl-only.net
Thu Mar 12 01:03:43 UTC 2015
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.
===
Mark Millard
markmi at dsl-only.net
On 2015-Mar-11, at 05:50 PM, Nathan Whitehorn <nwhitehorn at freebsd.org> 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)...
>
> 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 <markmi at dsl-only.net> 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 at 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
>
>
>
More information about the freebsd-ppc
mailing list