public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Petar Jovanovic <Petar.Jovanovic@rt-rk.com>
Cc: "Moore, Catherine" <Catherine_Moore@mentor.com>,
	       Matthew Fortune <Matthew.Fortune@imgtec.com>,
	       "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: RE: [PATCH v2][MIPS] fix CRT_CALL_STATIC_FUNCTION macro
Date: Fri, 17 Apr 2015 19:36:00 -0000	[thread overview]
Message-ID: <alpine.LFD.2.11.1504172005440.2813@eddie.linux-mips.org> (raw)
In-Reply-To: <6a22-55314b00-5-5cf51280@159592552>

On Fri, 17 Apr 2015, Petar Jovanovic wrote:

> This issue will not trigger a linker error (I believe it treats the
> symbol referred by the relocation as a local symbol). This is a follow
> up to GLIBC BZ #17601, the problem is seen only at runtime. So, I think
> this brings back the need to run the test. I can look into separating
> sections with -Wl,-T.. (that may also require extending
> mips_option_groups in mips/mips.exp), if running executable is OK.

 If the assembler or the linker knowingly (or under conditions where it 
can be determined) creates a broken executable, then it is a separate bug 
that needs to be filed against binutils.  Due to the unusual constraints 
of absolute MIPS jump instructions any associated symbol references have 
to result in external relocations, to be resolved in the final static link 
only.  If this is not the case or such a relocation resolves successfully 
despite a range overflow, then this has to be fixed in binutils.  Can you 
double-check if this is the case?

 I see this in a dump from crtbegin.o:

Disassembly of section .init:

00000000 <.init>:
   0:	04110001 	bal	8 <.init+0x8>
   4:	00000000 	nop
   8:	0c00004b 	jal	12c <frame_dummy>
			8: R_MIPS_26	.text
   c:	00000000 	nop

-- if `.text+0x12c' is out of range for JAL (R_MIPS_26) from `.init+0xc', 
that is the 4 most significant bits of both final addresses are not the 
same (the range calculation for this instruction/relocation is relative to 
the delay slot), then the static link is supposed to fail.  I think this 
can be easily verified and if needed, converted to an LD test case.

 As to a GCC test case I agree with Catherine that a run-time test case 
will be fine, and actually inevitable if the linker fails to fail.

  Maciej

  parent reply	other threads:[~2015-04-17 19:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6a22-55314b00-5-5cf51280@159592552>
2015-04-17 18:23 ` Petar Jovanovic
2015-04-17 18:35   ` Moore, Catherine
2015-04-21 18:05     ` Petar Jovanovic
2015-04-17 19:36 ` Maciej W. Rozycki [this message]
     [not found] <003e01d04179$ccc38bc0$664aa340$@rt-rk.com>
2015-02-05 20:51 ` Matthew Fortune
2015-02-06 10:43   ` Maciej W. Rozycki
2015-02-06 10:57     ` Matthew Fortune
2015-02-06 12:23       ` Maciej W. Rozycki
2015-02-06 17:27         ` Mike Stump
2015-02-06 17:41           ` Matthew Fortune
2015-02-06 18:03             ` Mike Stump
2015-02-06 19:19               ` Maciej W. Rozycki
2015-02-06 17:46           ` Maciej W. Rozycki
2015-02-06 15:12   ` Moore, Catherine
2015-02-13  0:28     ` Petar Jovanovic
2015-02-13  1:36       ` Moore, Catherine
2015-04-16 16:53         ` Petar Jovanovic
2015-04-16 18:23           ` Maciej W. Rozycki
2015-04-16 20:38             ` Moore, Catherine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.11.1504172005440.2813@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=Catherine_Moore@mentor.com \
    --cc=Matthew.Fortune@imgtec.com \
    --cc=Petar.Jovanovic@rt-rk.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).