accept 64-bit constant addresses in mips n32

Alexandre Oliva aoliva@redhat.com
Tue Apr 8 07:05:00 GMT 2003


On Apr  8, 2003, Thiemo Seufer <ica2_ts@csv.ica.uni-stuttgart.de> wrote:

> After thinking a bit about this, I'm still not sure if the 'fix' is ok.
> n32 normally guarantees properly sign-extended 32-bit addresses, and
> people may rely on it for pointer arithmethics (in broken code).

I believe the point is that, if you really know what you're doing to
the point of inserting a 64-bit address explicitly in your n32
assembly code, there's no reason for the assembler to not do it other
than just being picky.

> IMHO the assembler should complain about attempted 64-bit addressing
> in order to catch compiler bugs.

> For what actual usage scenario was this patch developed?

It's a trick from mips64 linux (the kernel) folks: they build the
kernel with -mabi=64, but assemble it as -n32 (-Wa,-n32), such that,
for some reasons I haven't really investigated, the resulting kernel
binary is far smaller and more efficient than assembling everything as
n64, linking as n64, then converting to an ELF32 format (as required
by a number of mips boot loaders) with objcopy.


That said, Chris came up with a follow-up patch, that addresses some
of your concerns and fixes a merge bug I unintentionally introduced,
but Eric still hasn't reviewed it.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mips-gas-n32-64bit-addr-part2.patch
Type: text/x-patch
Size: 1203 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20030408/44c1d564/attachment.bin>
-------------- next part --------------

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer


More information about the Binutils mailing list