#1004504 Regression of -many on powerpc, ppc64

Package:
binutils
Source:
binutils
Description:
GNU assembler, linker and binary utilities
Submitter:
Ben Hutchings
Date:
2022-03-03 18:42:02 UTC
Severity:
important
#1004504#5
Date:
2022-01-29 17:41:07 UTC
From:
To:
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.

#1004504#17
Date:
2022-03-03 18:36:14 UTC
From:
To:
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.

#1004504#22
Date:
2022-03-03 18:38:54 UTC
From:
To:
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.