about summary refs log tree commit diff
path: root/sysdeps/mips
diff options
context:
space:
mode:
authorPetar Jovanovic <petar.jovanovic@rt-rk.com>2014-12-02 23:04:43 +0000
committerJoseph Myers <joseph@codesourcery.com>2014-12-02 23:04:43 +0000
commitbbe4c142b024d639418069b480b0f3d05b489803 (patch)
tree50ef7dd7950f932dd7a5734b1f7e5e74e612edcc /sysdeps/mips
parent909e16d96064708b43170eeb01135315f540e6ff (diff)
downloadglibc-bbe4c142b024d639418069b480b0f3d05b489803.tar.gz
glibc-bbe4c142b024d639418069b480b0f3d05b489803.tar.xz
glibc-bbe4c142b024d639418069b480b0f3d05b489803.zip
mips: Do not use jal to reach __libc_start_main
Since __libc_start_main may not be in the same 256MB-aligned region as
the function __start, replace use of jal instruction with la/jalr.

This fixes linker issue reported in:
https://sourceware.org/bugzilla/show_bug.cgi?id=17601

	[BZ #17601]
	* sysdeps/mips/start.S (__start): Use indirect jump to call
	__libc_start_main.
Diffstat (limited to 'sysdeps/mips')
-rw-r--r--sysdeps/mips/start.S8
1 files changed, 6 insertions, 2 deletions
diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S
index a454941e55..3c012f1987 100644
--- a/sysdeps/mips/start.S
+++ b/sysdeps/mips/start.S
@@ -106,7 +106,8 @@ ENTRY_POINT:
 	move $9, $2		/* rtld_fini */
 	move $10, $29		/* stack_end */
 # endif
-	jal __libc_start_main
+	PTR_LA $25, __libc_start_main
+	jalr   $25
 hlt:	b hlt			/* Crash if somehow it does return.  */
 
 #elif _MIPS_SIM == _ABIO32 /* __mips16 */
@@ -157,7 +158,9 @@ ENTRY_POINT:
 	sw	$4, 16($sp)			/* fini */
 	lw	$4, 3f				/* main */
 	sw	$2, 20($sp)			/* rtld_fini */
-	jal	__libc_start_main
+	/* Load and call __libc_start_main().  */
+	lw	$3, 4f
+	jalr	$3
 # endif
 hlt:	b	hlt		/* Crash if somehow it does return.  */
 # ifndef __PIC__
@@ -165,6 +168,7 @@ hlt:	b	hlt		/* Crash if somehow it does return.  */
 1:	.word	__libc_csu_fini
 2:	.word	__libc_csu_init
 3:	.word	main
+4:	.word	__libc_start_main
 # endif
 
 #else /* __mips16 && _MIPS_SIM != _ABIO32 */