This is the mail archive of the
libc-ports@sources.redhat.com
mailing list for the libc-ports project.
Re: MIPS crti.S, crtn.S
- From: "Maciej W. Rozycki" <macro at codesourcery dot com>
- To: Richard Henderson <rth at twiddle dot net>
- Cc: "Joseph S. Myers" <joseph at codesourcery dot com>, <libc-ports at sourceware dot org>
- Date: Thu, 13 Sep 2012 23:34:15 +0100
- Subject: Re: MIPS crti.S, crtn.S
- References: <Pine.LNX.4.64.1202101228220.18853@digraph.polyomino.org.uk> <4F35601B.90609@twiddle.net>
Richard,
This fell between the cracks, but I've thought it might be worth
retrieving and posting anyway... :)
On Fri, 10 Feb 2012, Richard Henderson wrote:
> > I've applied this patch to add MIPS crti.S and crtn.S. These are closely
> > based on compiler output and it may be useful to simplify them in future
> > using the sys/asm.h macros.
>
> I think there's a fair amount of cleanup that could be done by simply
> relying on assembler macro-ization. E.g.
>
> jal PREINIT_FUNCTION
>
> letting the assembler load the address into $25 for you. And isn't
> there a pseudo-op that loads the GP?
.cpsetup
> Yes, the compiler likes to avoid these because it can get better
> schedules, but they seem ideal for the purposes here.
FWIW, I agree. Also there's no need to schedule delay slots manually
here that GAS would be happy to do itself, it just obfuscates code (and if
done, then the convention for handcoded MIPS assembly is to indent the
delay-slot instruction by one space to signify its placement).
With some aid from <sys/asm.h> it could even be possible to fold these
files into just a single pair of crti.S and crtn.S used across all the
MIPS ABIs.
I may see if I can get some time to do such a clean-up. And actually
there are a few other places throughout the MIPS port where the nomacro
mode and the manual scheduling of delay slots is an overkill. I'd like to
get through all of them sometime -- well, we shall see...
Maciej