public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de>
To: Richard Sandiford <rsandifo@redhat.com>
Cc: binutils@sources.redhat.com
Subject: Re: Address sizes on 64-bit MIPS targets
Date: Wed, 02 Mar 2005 02:58:00 -0000	[thread overview]
Message-ID: <20050302025754.GC1272@rembrandt.csv.ica.uni-stuttgart.de> (raw)
In-Reply-To: <87vf8byvqm.fsf@firetop.home>

Richard Sandiford wrote:
[snip]
> However, if the sequence is:
> 
>         dla     $2,0xa8000000000000
>         lw      $2,0x100000($2)
> 
> then the lw will use 32-bit address arithmetic:
> 
>         lui     $1,0x10
>         addu    $1,$1,$2
>         lw      $2,0($1)
> 
> and the behaviour will be unpredictable.

Which isn't exactly a problem, because 0xa8000000000000 is an invalid
address for n32. For 32bit sign-extended addresses it works fine.

> The existing dejagnu testcase
> explicitly tests for this, so I assume it's deliberate, but it seems
> pretty dangerous to me.
> 
> I suppose one justification for using "addu" might be that addresses
> should stay within the 32-bit address space for n32 and o64, even if
> the calculation overflows.  But suppose we have a (non-macro) instruction
> with a 16-bit offset:
> 
>         lw      $2,0x1000($2)
> 
> The behaviour of this instruction is unpredicatable for 32-bit address
> spaces on 64-bit targets if $2 + 0x1000 overflows (for example, if
> $2 == 0x7ffffff0).

What is unpredictable there? It will point to the start of CKSEG0, and
trigger an address exception.

[snip]
> I'd like to change things so that:
> 
>     - "dla"s with no symbolic component use 64-bit arithmetic
>     - "la"s with no symbolic component use 32-bit arithmetic
>     - "la"s and "dla"s with a symbolic component use 64-bit arithmetic
>       iff HAVE_64BIT_ADDRESSES (i.e. they use whatever the ABI dictates). [*]
> 
>     - loads and stores with no symbolic component use 64-bit arithmetic
>       iff HAVE_64BIT_GPRS.
>     - loads and stores with a symbolic component use 64-bit arithmetic
>       iff HAVE_64BIT_ADDRESSES. [*]

Instead of changing the behaviour of this already fragile hack I would
prefer an explicit -msym32 switch for ABI N64. This would also avoid
relocation overflows due to the ELF32 format, and has the nice side
effect of an instantly working Linux module loader. :-)

(There's little hope to get working modules with N64-in-ELF32, it would
need massive changes in the architecture independent implementation.)


Thiemo

  reply	other threads:[~2005-03-02  2:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-01 20:09 Richard Sandiford
2005-03-02  2:58 ` Thiemo Seufer [this message]
2005-03-02  9:36   ` Richard Sandiford
2005-03-02 14:59     ` Thiemo Seufer
2005-03-02 16:42       ` Paul Koning
2005-03-02 16:55         ` Richard Sandiford
2005-03-03 21:35       ` Adding a MIPS -msym32 option (was Re: Address sizes on 64-bit MIPS targets) Richard Sandiford
2005-03-03 22:10         ` Thiemo Seufer
2005-03-04  9:59           ` Adding a MIPS -msym32 option Richard Sandiford
2005-03-04  0:46         ` Adding a MIPS -msym32 option (was Re: Address sizes on 64-bit MIPS targets) Daniel Jacobowitz

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=20050302025754.GC1272@rembrandt.csv.ica.uni-stuttgart.de \
    --to=ica2_ts@csv.ica.uni-stuttgart.de \
    --cc=binutils@sources.redhat.com \
    --cc=rsandifo@redhat.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).