public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17601] New: __start function can not reach __libc_start_main in different region
@ 2014-11-14 16:22 mips32r2 at gmail dot com
  2014-11-14 16:59 ` [Bug libc/17601] " mips32r2 at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mips32r2 at gmail dot com @ 2014-11-14 16:22 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

            Bug ID: 17601
           Summary: __start function can not reach __libc_start_main in
                    different region
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: mips32r2 at gmail dot com
                CC: drepper.fsp at gmail dot com

Reproduction steps:

Try to compile the following example for mips32:

int main() {
  asm(".fill 100000000, 4, 0x00000000\n");
  return 0;
}

Current behaviour:

Compiling it will trigger the following error:

../sysdeps/mips/start.S:109:(.text+0x44): relocation truncated to fit:
R_MIPS_26 against `__libc_start_main@@GLIBC_2.0'
collect2: error: ld returned 1 exit status

Expected behaviour:

The program is linked without problems and can be executed.

Additional info:

This is a small and trivial example, but the real world application - and that
is Chromium browser_tests will fail to link due to the very same issue.
As reported by ld, the root cause is in the function __start which tends to
use:

jal     __libc_start_main

even though __libc_start_main may not be in the same 256MB-aligned region.
This function ends up as part of the initial runtime code in crt1.o.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
@ 2014-11-14 16:59 ` mips32r2 at gmail dot com
  2014-11-14 17:52 ` joseph at codesourcery dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mips32r2 at gmail dot com @ 2014-11-14 16:59 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

--- Comment #1 from Petar Jovanovic <mips32r2 at gmail dot com> ---
Created attachment 7936
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7936&action=edit
patch for start.S

Potential fix for start.S is attached.

This would likely need to be followed with similar change in
gcc/config/mips/mips.h
for CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) macro

i.e. replace use of 
jal " USER_LABEL_PREFIX #FUNC "\n\

with
la $25, " USER_LABEL_PREFIX #FUNC "\n\
jalr $25\n\

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
  2014-11-14 16:59 ` [Bug libc/17601] " mips32r2 at gmail dot com
@ 2014-11-14 17:52 ` joseph at codesourcery dot com
  2014-12-02 23:05 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: joseph at codesourcery dot com @ 2014-11-14 17:52 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

--- Comment #2 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
Please submit the patch to libc-alpha once you've tested the affected 
cases (including MIPS16, since you're changing that code).

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
  2014-11-14 16:59 ` [Bug libc/17601] " mips32r2 at gmail dot com
  2014-11-14 17:52 ` joseph at codesourcery dot com
@ 2014-12-02 23:05 ` cvs-commit at gcc dot gnu.org
  2014-12-02 23:12 ` jsm28 at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2014-12-02 23:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

--- Comment #3 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  bbe4c142b024d639418069b480b0f3d05b489803 (commit)
      from  909e16d96064708b43170eeb01135315f540e6ff (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=bbe4c142b024d639418069b480b0f3d05b489803

commit bbe4c142b024d639418069b480b0f3d05b489803
Author: Petar Jovanovic <petar.jovanovic@rt-rk.com>
Date:   Tue Dec 2 23:04:43 2014 +0000

    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.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog            |    6 ++++++
 NEWS                 |    2 +-
 sysdeps/mips/start.S |    8 ++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
                   ` (2 preceding siblings ...)
  2014-12-02 23:05 ` cvs-commit at gcc dot gnu.org
@ 2014-12-02 23:12 ` jsm28 at gcc dot gnu.org
  2014-12-03 22:41 ` mips32r2 at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2014-12-02 23:12 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

Joseph Myers <jsm28 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Joseph Myers <jsm28 at gcc dot gnu.org> ---
Fix applied for 2.21.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
                   ` (3 preceding siblings ...)
  2014-12-02 23:12 ` jsm28 at gcc dot gnu.org
@ 2014-12-03 22:41 ` mips32r2 at gmail dot com
  2015-04-29 22:26 ` mips32r2 at gmail dot com
  2015-04-29 22:28 ` mips32r2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: mips32r2 at gmail dot com @ 2014-12-03 22:41 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

--- Comment #5 from Petar Jovanovic <mips32r2 at gmail dot com> ---
[Just a comment that may be obvious to someone familiar with the issue
but not to someone who comes across this page for the first time.]

The glibc part of the issue has been fixed, but we still need to
upstream a similar change to GCC (see comment #1 in this issue) before
the whole problem is resolved.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
                   ` (4 preceding siblings ...)
  2014-12-03 22:41 ` mips32r2 at gmail dot com
@ 2015-04-29 22:26 ` mips32r2 at gmail dot com
  2015-04-29 22:28 ` mips32r2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: mips32r2 at gmail dot com @ 2015-04-29 22:26 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

--- Comment #6 from Petar Jovanovic <mips32r2 at gmail dot com> ---
Just for a reference, GCC part of the fix is now committed in r222589 [1].

The issue can be closed now.

[1] https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=222589

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libc/17601] __start function can not reach __libc_start_main in different region
  2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
                   ` (5 preceding siblings ...)
  2015-04-29 22:26 ` mips32r2 at gmail dot com
@ 2015-04-29 22:28 ` mips32r2 at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: mips32r2 at gmail dot com @ 2015-04-29 22:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17601

Petar Jovanovic <mips32r2 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED

--- Comment #7 from Petar Jovanovic <mips32r2 at gmail dot com> ---
Fixes for glibc and GCC have been committed.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-29 22:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-14 16:22 [Bug libc/17601] New: __start function can not reach __libc_start_main in different region mips32r2 at gmail dot com
2014-11-14 16:59 ` [Bug libc/17601] " mips32r2 at gmail dot com
2014-11-14 17:52 ` joseph at codesourcery dot com
2014-12-02 23:05 ` cvs-commit at gcc dot gnu.org
2014-12-02 23:12 ` jsm28 at gcc dot gnu.org
2014-12-03 22:41 ` mips32r2 at gmail dot com
2015-04-29 22:26 ` mips32r2 at gmail dot com
2015-04-29 22:28 ` mips32r2 at gmail dot com

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).