powerpc/nohash: Fix build error with binutils >= 2.38
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 13 Feb 2023 11:23:22 +0000 (22:23 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 16 Feb 2023 12:53:15 +0000 (23:53 +1100)
commit91360b446a5cced537d61fc2394253e8c6b9ae7b
tree2b1297b9a440381f261640065ca520b20a81fea5
parent7096deb7b5387e7899655213b7430ab043ddda4f
powerpc/nohash: Fix build error with binutils >= 2.38

With bintils >= 2.38 the ppc64_book3e_allmodconfig build fails:

  {standard input}: Assembler messages:
  {standard input}:196: Error: unrecognized opcode: `lbarx'
  {standard input}:196: Error: unrecognized opcode: `stbcx.'
  make[5]: *** [scripts/Makefile.build:252: arch/powerpc/mm/nohash/e500_hugetlbpage.o] Error 1

That happens because the default CPU for that config is e5500, set via
CONFIG_TARGET_CPU, and so the assembler is building for e5500, which
doesn't support those instructions.

Fix it by using machine directives to tell the assembler to assemble the
relevant code for e6500, which does support lbarx/stbcx.

That is safe because the code already has the CPU_FTR_SMT check, which
ensures the lbarx sequence doesn't run on e5500, which doesn't support
SMT.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20230213112322.998003-1-mpe@ellerman.id.au
arch/powerpc/mm/nohash/e500_hugetlbpage.c