public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: "Joseph S. Myers" <joseph@codesourcery.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: Richard Sandiford <rdsandiford@googlemail.com>,
	    Ilie Garbacea <ilie@mips.com>,
	binutils@sourceware.org,     Chao-ying Fu <fu@mips.com>,
	Rich Fuhler <rich@mips.com>,     David Lau <davidlau@mips.com>,
	Kevin Mills <kevinm@mips.com>,
	    Catherine Moore <clm@codesourcery.com>,
	    Nathan Sidwell <nathan@codesourcery.com>,
	    Nathan Froyd <froydnj@codesourcery.com>
Subject: Re: [PATCH] MIPS: microMIPS ASE support
Date: Tue, 14 Dec 2010 17:56:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.64.1012141658490.9479@digraph.polyomino.org.uk> (raw)
In-Reply-To: <alpine.DEB.1.10.1012131400320.4142@tp.orcam.me.uk>

On Tue, 14 Dec 2010, Maciej W. Rozycki wrote:

> > >    /* Calls from 16-bit code to 32-bit code and vice versa require the
> > > -     mode change.  */
> > > -  *cross_mode_jump_p = !info->relocatable
> > > -		       && ((r_type == R_MIPS16_26 && !target_is_16_bit_code_p)
> > > -			   || ((r_type == R_MIPS_26 || r_type == R_MIPS_JALR)
> > > -			       && target_is_16_bit_code_p));
> > > +     mode change.  This is not required for calls to undefined weak
> > > +     symbols, which should never be executed at runtime.  */
> > 
> > But why do we need to go out of our way to check for them?  I'm sure
> > there's a good reason, but the comment doesn't give much clue what it is.
> 
>  Undefined weak symbols are, well, undefined, so they have resolved to nil 
> and are meant never to be jumped to, so we don't want to error out on them 
> just because they do not have the ISA bit set and a JALX therefore 
> required could not be used for some reason, like the invocation being a 
> sibling call or because it would not satisfy the fixed delay slot 
> dependency.
> 
>  So we decide never to make a cross-mode jump in this situation and leave 
> the original jump instruction (i.e. JAL, JALS or JR) in place.  If the 
> instruction is indeed reached, then 1 will be written to the PC rather 
> than 0 that would "canonically" be required here, but the outcome will be 
> the same (assuming the zeroth page is unmapped), i.e. a segfault will 
> happen.
> 
>  Joseph, I reckon you were involved with this piece -- did I get all the 
> context right here?

Yes.  A call to an undefined weak function is equally valid at compile and 
link time and invalid at execution time if executed whether or not the 
code is compiled in such a way as to support cross-mode jumps.  Such a 
call is a call to an undefined function, never a call to an other-mode 
function, and so the linker should never give errors for cases such as 
JALS where it cannot convert to a cross-mode jump.  The original observed 
problem case was statically linking sln with a call to 
__nptl_deallocate_tsd that never gets executed in single-threaded 
programs.

-- 
Joseph S. Myers
joseph@codesourcery.com

  parent reply	other threads:[~2010-12-14 17:05 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-18 18:19 [PATCH] MIPS: microMIPS and MCU ASE instruction set support Maciej W. Rozycki
2010-05-23 21:38 ` Richard Sandiford
2010-05-24 22:25   ` Fu, Chao-Ying
2010-05-26 19:47     ` Richard Sandiford
2010-06-01 14:21   ` Maciej W. Rozycki
2010-06-01 14:39     ` Catherine Moore
2010-06-01 22:04     ` Richard Sandiford
2010-06-01 22:47     ` Fu, Chao-Ying
2010-06-05  9:17     ` Richard Sandiford
2010-07-26 10:56   ` [PATCH] MIPS: microMIPS ASE support Maciej W. Rozycki
2010-07-26 13:25     ` Nathan Froyd
2010-07-26 13:53       ` Maciej W. Rozycki
2010-07-26 19:03     ` Richard Sandiford
2010-12-07  1:13       ` Maciej W. Rozycki
2010-12-12 14:59         ` Richard Sandiford
2010-12-14 13:30           ` Maciej W. Rozycki
2010-12-14 14:51             ` Richard Sandiford
2010-12-16 11:54               ` Maciej W. Rozycki
2010-12-18 10:26                 ` Richard Sandiford
2010-12-14 17:56             ` Joseph S. Myers [this message]
2010-12-16 15:28               ` Maciej W. Rozycki
2010-12-17 20:56             ` Fu, Chao-Ying
2010-12-18 10:09               ` Richard Sandiford
2011-01-02 11:36         ` Richard Sandiford
2011-02-21 15:35           ` Maciej W. Rozycki
2011-02-22 20:12             ` Fu, Chao-Ying
2011-02-22 20:19             ` Fu, Chao-Ying
2011-02-24 10:46               ` Maciej W. Rozycki
2011-02-26 11:41                 ` Richard Sandiford
2011-02-28 16:41                   ` Maciej W. Rozycki
2011-02-26  0:00             ` Maciej W. Rozycki
2011-03-13  9:23               ` Richard Sandiford
2011-07-25  7:49                 ` Richard Sandiford
2011-07-26  2:01                   ` Maciej W. Rozycki
2011-07-29  0:58                     ` Maciej W. Rozycki
2011-07-29 11:30                       ` Richard Sandiford
2011-07-29 22:52                         ` Maciej W. Rozycki
2011-02-26 11:36             ` Richard Sandiford
2011-07-26 14:00               ` Maciej W. Rozycki
2010-05-26 20:19 ` [PATCH] MIPS: microMIPS and MCU ASE instruction set support Richard Sandiford
2010-05-27 21:39 ` Richard Sandiford

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=Pine.LNX.4.64.1012141658490.9479@digraph.polyomino.org.uk \
    --to=joseph@codesourcery.com \
    --cc=binutils@sourceware.org \
    --cc=clm@codesourcery.com \
    --cc=davidlau@mips.com \
    --cc=froydnj@codesourcery.com \
    --cc=fu@mips.com \
    --cc=ilie@mips.com \
    --cc=kevinm@mips.com \
    --cc=macro@codesourcery.com \
    --cc=nathan@codesourcery.com \
    --cc=rdsandiford@googlemail.com \
    --cc=rich@mips.com \
    /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).