Subject: Re: The ELF ABI issue
To: None <thorpej@wasabisystems.com>
From: Richard Earnshaw <rearnsha@arm.com>
List: port-arm
Date: 03/26/2002 10:01:45
> On Mon, Mar 25, 2002 at 03:36:04PM -0800, Jason R Thorpe wrote:
>
> > If we do decide to go this way, the only thing to do is pick the thread
> > local storage register... sounded like ARM was thinking of r9 or r10.
> > I say we just pick r10.
>
> ...and re-reading the thread, since r10 is the PIC register (and r9 is
> a fallback), then how about r8 as the thread-local register? (We can
> sweep the libraries later, since a libc update is going to be required
> for the forthcoming pthread library anyhow...)
>
No, disastrous.
The ABI doesn't mandate any particular register for the PIC register -- it
can be any register you like; it can even be different in each function
you have. GCC only uses a fixed register because there are "bugs" in the
compiler which mean that it can allocate a different register in each
function properly for this purpose (it would be better if this could be
fixed, but I'm not sure precisely where the problems are).
The TLS register, on the other hand must be fixed (since the value is
persistent across the whole thread). If you pick r8 then you will
fragment the register ranges, particularly when not inside a shared
library. There are different reasons why r9 or r10 might be the best
choice, but r8 certainly would be a bad choice.
R.