* [PATCH] mips: Do not use jal to reach __libc_start_main
@ 2014-11-17 23:29 Petar Jovanovic
2014-11-17 23:56 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: Petar Jovanovic @ 2014-11-17 23:29 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
---
Follow up to the issue reported in BZ#17601.
sysdeps/mips/start.S | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
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] 6+ messages in thread
* Re: [PATCH] mips: Do not use jal to reach __libc_start_main
2014-11-17 23:29 [PATCH] mips: Do not use jal to reach __libc_start_main Petar Jovanovic
@ 2014-11-17 23:56 ` Joseph Myers
2014-11-18 19:32 ` Petar Jovanovic
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Myers @ 2014-11-17 23:56 UTC (permalink / raw)
To: Petar Jovanovic; +Cc: libc-alpha, petar.jovanovic
On Tue, 18 Nov 2014, Petar Jovanovic wrote:
> 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.
Could you detail how this patch has been tested? (And provide a ChangeLog
entry for it.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] mips: Do not use jal to reach __libc_start_main
2014-11-17 23:56 ` Joseph Myers
@ 2014-11-18 19:32 ` Petar Jovanovic
2014-11-18 22:54 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: Petar Jovanovic @ 2014-11-18 19:32 UTC (permalink / raw)
To: 'Joseph Myers'; +Cc: libc-alpha, petar.jovanovic
In short, the failing test program (reported in #17601) has been tested
in the following combinations (given to gcc):
1. -EL
2. -EL -fPIC
3. -EL -fPIC -pie
4. -EL -mabi=32 -mips16
5. -EL -mabi=32 -mips16 -fPIC
6. -EL -mabi=32 -mips16 -fPIC -pie
To execute it correctly for options 1, 2, 4 and 5, additional change
(described in the bug tracker) was added in gcc/config/mips/mips.h.
Further, a subset (1500 tests) from DejaGnu GCC test suite has been
executed and has shown no regressions.
Regards,
Petar
-----Original Message-----
From: Joseph Myers [mailto:joseph@codesourcery.com]
Sent: Tuesday, November 18, 2014 12:57 AM
To: Petar Jovanovic
Cc: libc-alpha@sourceware.org; petar.jovanovic@imgtec.com
Subject: Re: [PATCH] mips: Do not use jal to reach __libc_start_main
On Tue, 18 Nov 2014, Petar Jovanovic wrote:
> 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.
Could you detail how this patch has been tested? (And provide a ChangeLog
entry for it.)
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] mips: Do not use jal to reach __libc_start_main
2014-11-18 19:32 ` Petar Jovanovic
@ 2014-11-18 22:54 ` Joseph Myers
2014-12-01 15:59 ` Petar Jovanovic
0 siblings, 1 reply; 6+ messages in thread
From: Joseph Myers @ 2014-11-18 22:54 UTC (permalink / raw)
To: Petar Jovanovic; +Cc: libc-alpha, petar.jovanovic
On Tue, 18 Nov 2014, Petar Jovanovic wrote:
> In short, the failing test program (reported in #17601) has been tested
> in the following combinations (given to gcc):
>
> 1. -EL
> 2. -EL -fPIC
> 3. -EL -fPIC -pie
> 4. -EL -mabi=32 -mips16
> 5. -EL -mabi=32 -mips16 -fPIC
> 6. -EL -mabi=32 -mips16 -fPIC -pie
>
> To execute it correctly for options 1, 2, 4 and 5, additional change
> (described in the bug tracker) was added in gcc/config/mips/mips.h.
>
> Further, a subset (1500 tests) from DejaGnu GCC test suite has been
> executed and has shown no regressions.
I think you need to run the glibc testsuite for at least one MIPS16 case,
at least one non-MIPS16 case; at least one case with GCC configured
--with-mips-plt, at least one case with GCC configured --without-mips-plt
(so at least two glibc testsuite runs, depending on how you combine those
cases).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] mips: Do not use jal to reach __libc_start_main
2014-11-18 22:54 ` Joseph Myers
@ 2014-12-01 15:59 ` Petar Jovanovic
2014-12-02 23:05 ` Joseph Myers
0 siblings, 1 reply; 6+ messages in thread
From: Petar Jovanovic @ 2014-12-01 15:59 UTC (permalink / raw)
To: 'Joseph Myers'; +Cc: libc-alpha, petar.jovanovic
In addition to the previous, the following testing has been done:
- tested glibc testsuite in MIPS32 case with default GCC ("-mno-plt" as
default option) configuration,
- tested glibc testsuite in MIPS16 case with default GCC ("-mno-plt" as
default option) configuration with extra CFLAGS/CPPFLAGS "-mplt"
passed to glibc configure.
Regards,
Petar
-----Original Message-----
From: Joseph Myers [mailto:joseph@codesourcery.com]
Sent: Tuesday, November 18, 2014 11:55 PM
To: Petar Jovanovic
Cc: libc-alpha@sourceware.org; petar.jovanovic@imgtec.com
Subject: RE: [PATCH] mips: Do not use jal to reach __libc_start_main
On Tue, 18 Nov 2014, Petar Jovanovic wrote:
> In short, the failing test program (reported in #17601) has been tested
> in the following combinations (given to gcc):
>
> 1. -EL
> 2. -EL -fPIC
> 3. -EL -fPIC -pie
> 4. -EL -mabi=32 -mips16
> 5. -EL -mabi=32 -mips16 -fPIC
> 6. -EL -mabi=32 -mips16 -fPIC -pie
>
> To execute it correctly for options 1, 2, 4 and 5, additional change
> (described in the bug tracker) was added in gcc/config/mips/mips.h.
>
> Further, a subset (1500 tests) from DejaGnu GCC test suite has been
> executed and has shown no regressions.
I think you need to run the glibc testsuite for at least one MIPS16 case,
at least one non-MIPS16 case; at least one case with GCC configured
--with-mips-plt, at least one case with GCC configured --without-mips-plt
(so at least two glibc testsuite runs, depending on how you combine those
cases).
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] mips: Do not use jal to reach __libc_start_main
2014-12-01 15:59 ` Petar Jovanovic
@ 2014-12-02 23:05 ` Joseph Myers
0 siblings, 0 replies; 6+ messages in thread
From: Joseph Myers @ 2014-12-02 23:05 UTC (permalink / raw)
To: Petar Jovanovic; +Cc: libc-alpha, petar.jovanovic
On Mon, 1 Dec 2014, Petar Jovanovic wrote:
> In addition to the previous, the following testing has been done:
>
> - tested glibc testsuite in MIPS32 case with default GCC ("-mno-plt" as
> default option) configuration,
> - tested glibc testsuite in MIPS16 case with default GCC ("-mno-plt" as
> default option) configuration with extra CFLAGS/CPPFLAGS "-mplt"
> passed to glibc configure.
Thanks, I've committed this patch.
--
Joseph S. Myers
joseph@codesourcery.com
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-12-02 23:05 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17 23:29 [PATCH] mips: Do not use jal to reach __libc_start_main Petar Jovanovic
2014-11-17 23:56 ` Joseph Myers
2014-11-18 19:32 ` Petar Jovanovic
2014-11-18 22:54 ` Joseph Myers
2014-12-01 15:59 ` Petar Jovanovic
2014-12-02 23:05 ` Joseph Myers
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).