Commit 08889582 authored by Paul Burton's avatar Paul Burton Committed by Ralf Baechle

MIPS: End asm function prologue macros with .insn

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: default avatarPaul Burton <paul.burton@imgtec.com>
Reviewed-by: default avatarMaciej W. Rozycki <macro@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/14508/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 2c0e57ea
...@@ -54,7 +54,8 @@ ...@@ -54,7 +54,8 @@
.align 2; \ .align 2; \
.type symbol, @function; \ .type symbol, @function; \
.ent symbol, 0; \ .ent symbol, 0; \
symbol: .frame sp, 0, ra symbol: .frame sp, 0, ra; \
.insn
/* /*
* NESTED - declare nested routine entry point * NESTED - declare nested routine entry point
...@@ -64,7 +65,8 @@ symbol: .frame sp, 0, ra ...@@ -64,7 +65,8 @@ symbol: .frame sp, 0, ra
.align 2; \ .align 2; \
.type symbol, @function; \ .type symbol, @function; \
.ent symbol, 0; \ .ent symbol, 0; \
symbol: .frame sp, framesize, rpc symbol: .frame sp, framesize, rpc; \
.insn
/* /*
* END - mark end of function * END - mark end of function
...@@ -86,7 +88,7 @@ symbol: .frame sp, framesize, rpc ...@@ -86,7 +88,7 @@ symbol: .frame sp, framesize, rpc
#define FEXPORT(symbol) \ #define FEXPORT(symbol) \
.globl symbol; \ .globl symbol; \
.type symbol, @function; \ .type symbol, @function; \
symbol: symbol: .insn
/* /*
* ABS - export absolute symbol * ABS - export absolute symbol
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment