* [PATCH v2] mips: Do not use jal to reach __libc_start_main
@ 2014-11-18 22:52 Petar Jovanovic
0 siblings, 0 replies; only message in thread
From: Petar Jovanovic @ 2014-11-18 22:52 UTC (permalink / raw)
To: libc-alpha; +Cc: petar.jovanovic, joseph
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
---
v2:
- add ChangeLog entry.
ChangeLog | 6 ++++++
sysdeps/mips/start.S | 8 ++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 17ec07b..af7121a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,10 @@
+2014-11-18 Petar Jovanovic <petar.jovanovic@rt-rk.com>
+
+ [BZ #17601]
+ * sysdeps/mips/start.S (__start): Use indirect jump to call
+ __libc_start_main.
+
2014-11-17 Richard Henderson <rth@redhat.com>
* sysdeps/alpha/soft-fp/local-soft-fp.h (_FP_UNPACK_RAW_2): Remove.
diff --git a/sysdeps/mips/start.S b/sysdeps/mips/start.S
index a454941..3c012f1 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 */
--
1.7.9.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-11-18 22:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-18 22:52 [PATCH v2] mips: Do not use jal to reach __libc_start_main Petar Jovanovic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).