Skip to content

Commit 7680190

Browse files
paulburtongregkh
authored andcommitted
MIPS: End spinlocks with .insn
commit 4b5347a24a0f2d3272032c120664b484478455de upstream. When building for microMIPS we need to ensure that the assembler always knows that there is code at the target of a branch or jump. Recent toolchains will fail to link a microMIPS kernel when this isn't the case due to what it thinks is a branch to non-microMIPS code. mips-mti-linux-gnu-ld kernel/built-in.o: .spinlock.text+0x2fc: Unsupported branch between ISA modes. mips-mti-linux-gnu-ld final link failed: Bad value This is due to inline assembly labels in spinlock.h not being followed by an instruction mnemonic, either due to a .subsection pseudo-op or the end of the inline asm block. Fix this with a .insn direction after such labels. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Signed-off-by: James Hogan <james.hogan@imgtec.com> Reviewed-by: Maciej W. Rozycki <macro@imgtec.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/15325/ Signed-off-by: James Hogan <james.hogan@imgtec.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 22665fe commit 7680190

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

arch/mips/include/asm/spinlock.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
112112
" andi %[ticket], %[ticket], 0xffff \n"
113113
" bne %[ticket], %[my_ticket], 4f \n"
114114
" subu %[ticket], %[my_ticket], %[ticket] \n"
115-
"2: \n"
115+
"2: .insn \n"
116116
" .subsection 2 \n"
117117
"4: andi %[ticket], %[ticket], 0xffff \n"
118118
" sll %[ticket], 5 \n"
@@ -187,7 +187,7 @@ static inline unsigned int arch_spin_trylock(arch_spinlock_t *lock)
187187
" sc %[ticket], %[ticket_ptr] \n"
188188
" beqz %[ticket], 1b \n"
189189
" li %[ticket], 1 \n"
190-
"2: \n"
190+
"2: .insn \n"
191191
" .subsection 2 \n"
192192
"3: b 2b \n"
193193
" li %[ticket], 0 \n"
@@ -367,7 +367,7 @@ static inline int arch_read_trylock(arch_rwlock_t *rw)
367367
" .set reorder \n"
368368
__WEAK_LLSC_MB
369369
" li %2, 1 \n"
370-
"2: \n"
370+
"2: .insn \n"
371371
: "=" GCC_OFF_SMALL_ASM() (rw->lock), "=&r" (tmp), "=&r" (ret)
372372
: GCC_OFF_SMALL_ASM() (rw->lock)
373373
: "memory");
@@ -407,7 +407,7 @@ static inline int arch_write_trylock(arch_rwlock_t *rw)
407407
" lui %1, 0x8000 \n"
408408
" sc %1, %0 \n"
409409
" li %2, 1 \n"
410-
"2: \n"
410+
"2: .insn \n"
411411
: "=" GCC_OFF_SMALL_ASM() (rw->lock), "=&r" (tmp),
412412
"=&r" (ret)
413413
: GCC_OFF_SMALL_ASM() (rw->lock)

0 commit comments

Comments
 (0)