powerpc/nohash: Fix build error with binutils >= 2.38
Michael Ellerman
reviewerPATCH 1/1 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.
--- arch/powerpc/mm/nohash/e500_hugetlbpage.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/powerpc/mm/nohash/e500_hugetlbpage.c +4 -1
@@ -45,7 +45,9 @@ static inline void book3e_tlb_lock(void)if (!cpu_has_feature (CPU_FTR_SMT ))return ; - asmvolatile ("1: lbarx %0, 0, %1;" + asmvolatile (".machine push;" +".machine e6500;" +"1: lbarx %0, 0, %1;" "cmpwi %0, 0;" "bne 2f;" "stbcx. %2, 0, %1;"
@@ -56,6 +58,7 @@ static inline void book3e_tlb_lock(void)"bne 2b;" "b 1b;" "3:" +".machine pop;" : "=&r" (tmp) : "r" (&paca->tcd_ptr->lock), "r" (token) : "memory");
Signature · 1 line
2.39.1
Michael Ellerman
AppliedQuoted 8 lines · Michael Ellerman
With bintils >= 2.38 the
ppc64_book3e_allmodconfigbuild 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[...]
Applied to powerpc/next.
[1/1] powerpc/nohash: Fix build error with binutils >= 2.38
https://git.kernel.org/powerpc/c/91360b446a5cced537d61fc2394253e8c6b9ae7b
cheers