diff mbox

Replace bltzal with lapc for MIPS R6 builds.

Message ID 1450888721-27573-1-git-send-email-sellcey@imgtec.com
State New
Headers show

Commit Message

Steve Ellcey Dec. 23, 2015, 4:38 p.m. UTC
The R6 version of MIPS does not support the bltzal instruction.  This
patch changes dl-startup.h and dl-sysdep.h to use lapc on R6 instead.
lapc is a new R6 insruction so older systems need to continue to use
bltzal in order to load register $31.

Signed-off-by: Steve Ellcey <sellcey@imgtec.com>
---
 ldso/ldso/mips/dl-startup.h |    5 +++++
 ldso/ldso/mips/dl-sysdep.h  |    5 +++++
 2 files changed, 10 insertions(+)
diff mbox

Patch

diff --git a/ldso/ldso/mips/dl-startup.h b/ldso/ldso/mips/dl-startup.h
index 4d9918d..0cab7be 100644
--- a/ldso/ldso/mips/dl-startup.h
+++ b/ldso/ldso/mips/dl-startup.h
@@ -37,6 +37,7 @@  __asm__(""
 #if _MIPS_SIM == _MIPS_SIM_ABI32
     "	subu	$29, 16\n"
 #endif
+# if !defined __mips_isa_rev || __mips_isa_rev < 6
 #if _MIPS_SIM == _MIPS_SIM_ABI64
     "	dla	$8, .coff\n"
 #else	/* O32 || N32 */
@@ -44,6 +45,10 @@  __asm__(""
 #endif	/* O32 || N32 */
     "	bltzal	$8, .coff\n"
     ".coff:\n"
+# else
+    ".coff:\n"
+    "   lapc $31, .coff\n"
+# endif
 #if _MIPS_SIM == _MIPS_SIM_ABI64
     "	dsubu	$8, $31, $8\n"
     "	dla	$25, _dl_start\n"
diff --git a/ldso/ldso/mips/dl-sysdep.h b/ldso/ldso/mips/dl-sysdep.h
index 6041245..b2caa7f 100644
--- a/ldso/ldso/mips/dl-sysdep.h
+++ b/ldso/ldso/mips/dl-sysdep.h
@@ -225,10 +225,15 @@  elf_machine_load_address (void)
 {
 	ElfW(Addr) addr;
 	__asm__ ("        .set noreorder\n"
+# if !defined __mips_isa_rev || __mips_isa_rev < 6
 	     "        " STRINGXP (PTR_LA) " %0, 0f\n"
 	     "        bltzal $0, 0f\n"
 	     "        nop\n"
 	     "0:      " STRINGXP (PTR_SUBU) " %0, $31, %0\n"
+#else
+	     "0:      lapc $31, 0\n"
+	     "        " STRINGXP (PTR_SUBU) " %0, $31, %0\n"
+#endif
 	     "        .set reorder\n"
 	     :        "=r" (addr)
 	     :        /* No inputs */