Skip to contentSkip to conversation

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

DISCUSSION Michael Tokarev 1 participant 3 messages Aug 6 – Aug 7

lore
Share & tools
lore
#0 lore raw

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..

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

#1 lore raw
Quoted 12 lines · Michael Tokarev

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]

Quoted 4 lines

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

Quoted 17 lines

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

#2 lore raw
Quoted 16 lines · Michael Tokarev
Quoted 15 lines · Michael Tokarev

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).

Quoted 8 lines
Quoted 1 line

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.

This seems to be a debian bug or gcc bug which is fixed in a later version (unfortunately searching for the term "many" isn't giving good results) --
https://bugs.debian.org/1143807

/mjt