Since the update from binutils 2.37 to this snapshot, linux no longer
builds for powerpc or ppc64 due to unrecognised instructions.
For ppc64, linux is built with the compiler options:
-mtune=power7 -mcpu=power5 -mno-altivec -mno-vsx
so the generated assembly starts with ".machine power5". But because
the kernel does need to conditionally use Altivec and other
extensions, it also uses the options:
-Wa,-maltivec -Wa,-mpower4 -Wa,-many
This is rather strange but used to work. It seems to have been
intentionally changed by commit b25f942e18d6 "PowerPC: ignore sticky
options for .machine" in binutils. Can you find out whether there is
any possibility of this being reverted?
Ben.
See also these reports on the linuxppc list: https://lore.kernel.org/linuxppc-dev/CANtoAtPcRGHafb7LddtrY5g43m82txS_mY3WO_ZtJ+pfuLvKaw@mail.gmail.com/#t https://lore.kernel.org/linuxppc-dev/4424cb7b-2655-c6f3-ec56-fa1b4f31e21d@physik.fu-berlin.de/ Ben.
Cross-compiling PPC on x86-64 is also broken in 2.37 due to assembler errors.
I don't know enough about PPC to know if this is the same underlying root cause
or something different.
With 2.37-90 (amd64), attempting to compile various inline assembly (popcntd is
just one example), e.g.
echo 'int foo(int x) { int p; asm ("popcntd %0,%1" : "=r" (p) : "r" (x)); return p; }' | \
powerpc64-linux-gnu-gcc -x c - -c -o /dev/null
fails with:
/tmp/ccWfffoZ.s: Assembler messages:
/tmp/ccWfffoZ.s:26: Error: unrecognized opcode: `popcntd'
whereas version 2.34 compiles the above without error.
Ah, I belatedly see that Ben's bug report says "update from binutils 2.37 to this snapshot", which suggests that earlier versions of 2.37 are healthy? Whereas the cross-compiling issue goes back to at least 2.37.7.