All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Jan-Benedict Glaw <jbglaw@lug-owl.de>, linuxppc-dev@lists.ozlabs.org
Subject: Re: Mass-building defconfigs: many fail with assembler errors
Date: Tue, 13 Dec 2022 14:49:20 +1100	[thread overview]
Message-ID: <87bko8j73z.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <20221212215117.aa7255t7qd6yefk4@lug-owl.de>

Jan-Benedict Glaw <jbglaw@lug-owl.de> writes:
> Hi!
>
> Is anybody else routinely building current Binutils + GCC, to try to
> build all the Linux defconfigs?

I did for several years, but eventually stopped because it was taking
too much time I needed to spend on other things.

> For PPC, a good number of those fail,
> and I probably don't understand PPC well enough to propose patches. Or
> did I pick wrongly targeted toolchains? Most of the time, my suspicion
> is that we're not giving the correct -m<cpu> flags in
> ./arch/powerpc/boot/?  (My setup for doing test builds is fairly automated, I
> can easily throw in patches for testing.)

All the results against <something>.config are invalid or at least
dubious. Those files are not standalone defconfigs, they're fragments of
defconfigs that are assembled together by arch/powerpc/Makefile using
merge_config.sh.

So your script should exclude all files that end in ".config".

To find the names of the generated configs you can use something like:

 $ awk '/PHONY \+= .*config/ {print $3}' arch/powerpc/Makefile

> 64-bit.config
> 	  powerpc64-linux-gcc -Wp,-MD,arch/powerpc/boot/.opal-calls.o.d -D__ASSEMBLY__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx   -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -m32 -mcpu=powerpc -isystem /var/lib/laminar/run/linux-powerpc-64-bit.config/12/toolchain/bin/../lib/gcc/powerpc64-linux/13.0.0/include -mbig-endian -nostdinc -c -o arch/powerpc/boot/opal-calls.o arch/powerpc/boot/opal-calls.S
> 	arch/powerpc/boot/opal-calls.S: Assembler messages:
> 	arch/powerpc/boot/opal-calls.S:20: Error: unrecognized opcode: `ld'
> 	arch/powerpc/boot/opal-calls.S:21: Error: unrecognized opcode: `ld'
> 	arch/powerpc/boot/opal-calls.S:32: Error: unrecognized opcode: `std'
> 	arch/powerpc/boot/opal-calls.S:49: Error: unrecognized opcode: `ld'
> 	arch/powerpc/boot/opal-calls.S:50: Error: unrecognized opcode: `ld'
> 	arch/powerpc/boot/opal-calls.S:52: Error: unrecognized opcode: `hrfid'
> 	arch/powerpc/boot/opal-calls.S:55: Error: unrecognized opcode: `tdi'
> 	arch/powerpc/boot/opal-calls.S:58: Error: unrecognized opcode: `ld'
> 	make[1]: *** [arch/powerpc/boot/Makefile:232: arch/powerpc/boot/opal-calls.o] Error 1
> 	make: *** [arch/powerpc/Makefile:247: zImage] Error 2

...

> bamboo_defconfig
> 	  powerpc-linux-gcc -Wp,-MD,arch/powerpc/boot/.treeboot-akebono.o.d -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx   -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -m32 -mcpu=powerpc -isystem /var/lib/laminar/run/linux-powerpc-bamboo_defconfig/12/toolchain/bin/../lib/gcc/powerpc-linux/13.0.0/include -mbig-endian -fno-stack-protector -include ./include/linux/compiler_attributes.h -I./arch/powerpc/boot -I./arch/powerpc/boot -mcpu=405 -c -o arch/powerpc/boot/treeboot-akebono.o arch/powerpc/boot/treeboot-akebono.c
> 	{standard input}: Assembler messages:
> 	{standard input}:94: Error: unrecognized opcode: `mtdcrx'
> 	{standard input}:101: Error: unrecognized opcode: `mfdcrx'
> 	{standard input}:107: Error: unrecognized opcode: `mtdcrx'
> 	{standard input}:306: Error: unrecognized opcode: `mfdcrx'
> 	make[1]: *** [arch/powerpc/boot/Makefile:229: arch/powerpc/boot/treeboot-akebono.o] Error 1
> 	make: *** [arch/powerpc/Makefile:247: zImage] Error 2

Both treeboot-akebono.c and treeboot-currituck.c are for 476 so should
probably be built with -mcpu=476. eg:

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index d32d95aea5d6..acb6eddace8f 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -88,8 +88,8 @@ $(obj)/cuboot-taishan.o: BOOTCFLAGS += -mcpu=440
 $(obj)/cuboot-katmai.o: BOOTCFLAGS += -mcpu=440
 $(obj)/cuboot-acadia.o: BOOTCFLAGS += -mcpu=405
 $(obj)/treeboot-iss4xx.o: BOOTCFLAGS += -mcpu=405
-$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=405
-$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=405
+$(obj)/treeboot-currituck.o: BOOTCFLAGS += -mcpu=476
+$(obj)/treeboot-akebono.o: BOOTCFLAGS += -mcpu=476
 
 # The pre-boot decompressors pull in a lot of kernel headers and other source
 # files. This creates a bit of a dependency headache since we need to copy


> cell_defconfig
> 	  powerpc64-linux-gcc -Wp,-MD,arch/powerpc/boot/.pseries-head.o.d -D__ASSEMBLY__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -O2 -msoft-float -mno-altivec -mno-vsx   -pipe -fomit-frame-pointer -fno-builtin -fPIC -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -m32 -mcpu=powerpc -isystem /var/lib/laminar/run/linux-powerpc-cell_defconfig/12/toolchain/bin/../lib/gcc/powerpc64-linux/13.0.0/include -mbig-endian -nostdinc -c -o arch/powerpc/boot/pseries-head.o arch/powerpc/boot/pseries-head.S
> 	arch/powerpc/boot/pseries-head.S: Assembler messages:
> 	arch/powerpc/boot/pseries-head.S:8: Error: unrecognized opcode: `tdi'
> 	make[1]: *** [arch/powerpc/boot/Makefile:232: arch/powerpc/boot/pseries-head.o] Error 1
> 	make: *** [arch/powerpc/Makefile:247: zImage] Error 2

I guess it's complaining about tdi in 32-bit code.

Except that tdi is in the FIXUP_ENDIAN macro. Not sure how we fix that.

> powernv_defconfig
> 	  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/lib/.sstep.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -fno-PIE -Werror=implicit-function-declaration -Werror=implicit-int -Werror=return-type -Wno-format-security -std=gnu11 -mlittle-endian -m64 -msoft-float -pipe -mtraceback=no -mabi=elfv2 -mcmodel=medium -mno-pointers-to-nested-functions -mcpu=power8 -mtune=power10 -mno-prefixed -mno-pcrel -mno-altivec -mno-vsx -mno-mma -fno-asynchronous-unwind-tables -mno-string -Wa,-maltivec -Wa,-mpower4 -Wa,-many -mno-strict-align -mlittle-endian -mstack-protector-guard=tls -mstack-protector-guard-reg=r13 -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-address-of-packed-member -O2 -fno-allow-store-data-races -Wframe-larger-than=2048 -fstack-protector-strong -Wno-main -Wno-unused-but-set-variable -Wno-unused-const-variable -Wno-dangling-pointer -ftrivial-auto-var-init=zero -fno-stack-clash-protection -pg -mprofile-kernel -Wdeclaration-after-statement -Wvla -Wno-pointer-sign -Wcast-function-type -Wno-stringop-truncation -Wno-stringop-overflow -Wno-restrict -Wno-maybe-uninitialized -Wno-alloc-size-larger-than -Wimplicit-fallthrough=5 -fno-strict-overflow -fno-stack-check -fconserve-stack -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -Wno-packed-not-aligned -mstack-protector-guard-offset=3184 -Werror    -DKBUILD_MODFILE='"arch/powerpc/lib/sstep"' -DKBUILD_BASENAME='"sstep"' -DKBUILD_MODNAME='"sstep"' -D__KBUILD_MODNAME=kmod_sstep -c -o arch/powerpc/lib/sstep.o arch/powerpc/lib/sstep.c  
> 	In function 'do_byte_reverse',
> 	    inlined from 'do_vec_store' at arch/powerpc/lib/sstep.c:722:3,
> 	    inlined from 'emulate_loadstore' at arch/powerpc/lib/sstep.c:3509:9:
> 	arch/powerpc/lib/sstep.c:286:25: error: array subscript [3, 4] is outside array bounds of 'union <anonymous>[1]' [-Werror=array-bounds=]
> 	  286 |                 up[0] = byterev_8(up[3]);
> 	      |                         ^~~~~~~~~~~~~~~~

I've seen this one before, prior to array-bounds being disabled upstream.

The code is not actually buggy AFAICS, but it is quite complicated and relies on
the caller passing the correct size array to match the nb argument,
which is fairly fragile.

I'd be happy for it to be rewritten.

> ppc64e_defconfig
> 	  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  -I./include -I./arch/powerpc/include/uapi -I./arch/powerpc/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 -Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian    -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o arch/powerpc/kernel/vdso/gettimeofday.S
> 	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:82: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:104: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `stdu'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `std'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `ld'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:115: Error: unrecognized opcode: `ld'
> 	make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1
> 	make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2


I'm guessing but possibly fixed by:
  http://patchwork.ozlabs.org/project/linuxppc-dev/patch/3fd60c2d8a28668a42b766b18362a526ef47e757.1670420281.git.christophe.leroy@csgroup.eu/

cheers

  parent reply	other threads:[~2022-12-13  3:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-12 21:51 Mass-building defconfigs: many fail with assembler errors Jan-Benedict Glaw
2022-12-13  0:26 ` Segher Boessenkool
2022-12-13 10:00   ` Jan-Benedict Glaw
2022-12-14  9:00     ` Jan-Benedict Glaw
2022-12-14 18:36       ` Jan-Benedict Glaw
2022-12-14 20:08         ` Segher Boessenkool
2022-12-15  8:47       ` Jan-Benedict Glaw
2022-12-13  3:49 ` Michael Ellerman [this message]
2022-12-13  8:41   ` Jan-Benedict Glaw
2022-12-13 12:23     ` Segher Boessenkool
2022-12-14 14:45   ` Jan-Benedict Glaw
2022-12-15  6:49     ` Christophe Leroy
2022-12-15  6:55       ` Christophe Leroy
2022-12-15 12:47     ` Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bko8j73z.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=jbglaw@lug-owl.de \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.