Skip to content

Commit 91360b4

Browse files
committed
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 7096deb commit 91360b4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

arch/powerpc/mm/nohash/e500_hugetlbpage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ static inline void book3e_tlb_lock(void)
4545
if (!cpu_has_feature(CPU_FTR_SMT))
4646
return;
4747

48-
asm volatile("1: lbarx %0, 0, %1;"
48+
asm volatile(".machine push;"
49+
".machine e6500;"
50+
"1: lbarx %0, 0, %1;"
4951
"cmpwi %0, 0;"
5052
"bne 2f;"
5153
"stbcx. %2, 0, %1;"
@@ -56,6 +58,7 @@ static inline void book3e_tlb_lock(void)
5658
"bne 2b;"
5759
"b 1b;"
5860
"3:"
61+
".machine pop;"
5962
: "=&r" (tmp)
6063
: "r" (&paca->tcd_ptr->lock), "r" (token)
6164
: "memory");

0 commit comments

Comments
 (0)