This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Don't set TEXT_START_ADDR for MIPS n64
- From: "Maciej W. Rozycki" <macro at linux-mips dot org>
- To: Richard Sandiford <rdsandiford at googlemail dot com>
- Cc: binutils at sourceware dot org
- Date: Sat, 28 Jun 2008 22:59:31 +0100 (BST)
- Subject: Re: [PATCH] Don't set TEXT_START_ADDR for MIPS n64
- References: <873amxzdkr.fsf@firetop.home>
On Sat, 28 Jun 2008, Richard Sandiford wrote:
> In:
>
> http://sourceware.org/ml/binutils/2003-05/msg00636.html
>
> Maciej increased the n64 TEXT_START_ADDR beyond the 2GB limit:
>
> Setting text segment's start address above 4 GB for 64-bit
> executables aids in finding unportable software -- if a pointer
> is cropped to 32 bits, instead of a possible memory corruption a
> segmentation fault is sent as nothing is mapped below text normally.
>
> That's certainly a useful thing to want to test. However,
> as linux has proved, you can get big size savings using -msym32
> for n64 code. The n64 definition prevents -msym32 working by default.
>
> Of the two, I think allowing -msym32 is the better default choice.
> Anyone wanting to smoke out invalid assumptions could still use
> -Ttext to do so.
>
> Tested on mips64-linux-gnu and mips64el-linux-gnu. OK to install?
Richard, I have no doubt about the usefulness of -msym32, but unlike with
the Linux kernel which uses non-PIC code and where merely shorter
instruction sequences are used omitting references to the %higher() and
%highest() parts of relocations, here this option is an externally visible
change to the ABI. So why don't you simply use a separate set of linker
scripts for this new emulation? For pure n64 binaries there is a clear
benefit from locating text beyond the first 4GB and no negative impact
whatsoever.
Maciej