This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: accept 64-bit constant addresses in mips n32
On Apr 8, 2003, Eric Christopher <echristo at redhat dot com> wrote:
> While I don't particularly like the idea of 64-bit constant addresses in
> n32 (especially on the number of bogus things in the port) the savings
> are fairly impressive which is why I allowed it. Alex: can you document
> what's going on a bit more as well and then throw it in?
Here's the patch I'm going to check in along with Chris'.
Index: gas/ChangeLog
from Alexandre Oliva <aoliva at redhat dot com>
* config/tc-mips.c (macro): Add comments explaining the rationale
for Chris' change.
Index: gas/config/tc-mips.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mips.c,v
retrieving revision 1.200
diff -u -p -r1.200 tc-mips.c
--- gas/config/tc-mips.c 6 Apr 2003 03:16:20 -0000 1.200
+++ gas/config/tc-mips.c 9 Apr 2003 03:05:33 -0000
@@ -5846,7 +5846,23 @@ macro (ip)
range is shifted down by 32768 here. This code should
probably attempt to generate 64-bit constants more
efficiently in general.
- */
+
+ As an extension for architectures with 64-bit registers,
+ we don't truncate 64-bit addresses given as literal
+ constants down to 32 bits, to support existing practice
+ in the mips64 Linux (the kernel), that compiles source
+ files with -mabi=64, assembling them as o32 or n32 (with
+ -Wa,-32 or -Wa,-n32). This is not beautiful, but since
+ the whole kernel is loaded into a memory region that is
+ addressible with sign-extended 32-bit addresses, it is
+ wasteful to compute the upper 32 bits of every
+ non-literal address, that takes more space and time.
+ Some day this should probably be implemented as an
+ assembler option, such that the kernel doesn't have to
+ use such ugly hacks, even though it will still have to
+ end up converting the binary to ELF32 for a number of
+ platforms whose boot loaders don't support ELF64
+ binaries. */
if ((offset_expr.X_op != O_constant && HAVE_64BIT_ADDRESSES)
|| (offset_expr.X_op == O_constant
&& !IS_SEXT_32BIT_NUM (offset_expr.X_add_number)
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist Professional serial bug killer