Skip to content

Commit 7f5eb09

Browse files
paulburtongregkh
authored andcommitted
MIPS: End asm function prologue macros with .insn
[ Upstream commit 08889582b8aa0bbc01a1e5a0033b9f98d2e11caa ] When building a kernel targeting a microMIPS ISA, recent GNU linkers will fail the link if they cannot determine that the target of a branch or jump is microMIPS code, with errors such as the following: mips-img-linux-gnu-ld: arch/mips/built-in.o: .text+0x542c: Unsupported jump between ISA modes; consider recompiling with interlinking enabled. mips-img-linux-gnu-ld: final link failed: Bad value or: ./arch/mips/include/asm/uaccess.h:1017: warning: JALX to a non-word-aligned address Placing anything other than an instruction at the start of a function written in assembly appears to trigger such errors. In order to prepare for allowing us to follow function prologue macros with an EXPORT_SYMBOL invocation, end the prologue macros (LEAD, NESTED & FEXPORT) with a .insn directive. This ensures that the start of the function is marked as code, which always makes sense for functions & safely prevents us from hitting the link errors described above. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Reviewed-by: Maciej W. Rozycki <macro@imgtec.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/14508/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b158774 commit 7f5eb09

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

  • arch/mips/include/asm

arch/mips/include/asm/asm.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
.align 2; \
5555
.type symbol, @function; \
5656
.ent symbol, 0; \
57-
symbol: .frame sp, 0, ra
57+
symbol: .frame sp, 0, ra; \
58+
.insn
5859

5960
/*
6061
* NESTED - declare nested routine entry point
@@ -63,8 +64,9 @@ symbol: .frame sp, 0, ra
6364
.globl symbol; \
6465
.align 2; \
6566
.type symbol, @function; \
66-
.ent symbol, 0; \
67-
symbol: .frame sp, framesize, rpc
67+
.ent symbol, 0; \
68+
symbol: .frame sp, framesize, rpc; \
69+
.insn
6870

6971
/*
7072
* END - mark end of function
@@ -86,7 +88,7 @@ symbol: .frame sp, framesize, rpc
8688
#define FEXPORT(symbol) \
8789
.globl symbol; \
8890
.type symbol, @function; \
89-
symbol:
91+
symbol: .insn
9092

9193
/*
9294
* ABS - export absolute symbol

0 commit comments

Comments
 (0)