Re: openbios fails to build with gcc-16 (powerpc code)

Michael Tokarev <[email protected]>
Newsgroups gmane.comp.emulators.qemu
Message-ID <[email protected]>
On 8/6/26 12:56, Michael Tokarev wrote:
> Hi!
> 
> Since debian switch from gcc-15 to gcc-16, qemu fails to build openbios-powerpc:
> 
> powerpc-linux-gnu-gcc -m32 -mcpu=604 ...\
>   roms/openbios/arch/ppc/qemu/start.S
> 
> roms/openbios/arch/ppc/qemu/start.S:292: Error: unrecognized opcode: `clrldi'
> roms/openbios/arch/ppc/qemu/start.S:293: Error: unrecognized opcode: `mtmsrd'
> roms/openbios/arch/ppc/qemu/start.S:178: Error: unrecognized opcode: `std'
> [a lot of other similar errors]
> 
> I know nothing about powerpc assembler.  Google tells me mtmsrd is a 64bit-only
> instruction which can't be used in 32bit mode (which is in effect here).
> 
> It feels like start.S uses the wrong assembly?  I wonder how it worked before..

The issue boils down to missing -many option to as when using gcc-16.
With gcc-15, as is being run with
   -a32 -mppc -many -mbig
but gcc-16 omits -many:
   -a32 -mppc -mbig
Explicitly adding -Wa,-many lets the build to proceed.

It still fails down the line with:

roms/openbios/libopenbios/client.c: In function ‘handle_calls’:
roms/openbios/libopenbios/client.c:249:16: warning: variable ‘j’ set but not used [-Wunused-but-set-variable=]
   249 |         int i, j, dstacksave;
       |                ^
roms/openbios/libopenbios/client.c: In function ‘of_client_interface’:

which also becomes a fatal error due to -Werror.

Adding -Wno-error=unused-but-set-variable lets the build to succeed.

Thanks,

/mjt

> Additionally, there's this new error (due to -Werror being in effect),
> but it is easy to deal with:
> 
> In file included from /build/pkg/build/roms/openbios/kernel/bootstrap.c:28:
> roms/openbios/kernel/bootstrap.c: In function ‘write_dictionary’:
> roms/openbios/kernel/include/dict.h:12:16: warning: initializer-string for array of ‘char’ truncates NUL terminator but destination lacks ‘nonstring’ 
> attribute (9 chars into 8 available) [-Wunterminated-string-initialization]
>     12 | #define DICTID "OpenBIOS"
>        |                ^~~~~~~~~~
> roms/openbios/kernel/bootstrap.c:170:35: note: in expansion of macro ‘DICTID’
>    170 |                 .signature      = DICTID,
>        |                                   ^~~~~~
> 
> 
> FWIW,
> 
> /mjt
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.