This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
RE: ARM setjmp and r12
- From: "Schwarz, Konrad" <konrad dot schwarz at siemens dot com>
- To: "Nick Clifton" <nickc at redhat dot com>
- Cc: "Shaun Jackman" <sjackman at gmail dot com>, <newlib at sources dot redhat dot com>
- Date: Tue, 2 May 2006 09:30:19 +0200
- Subject: RE: ARM setjmp and r12
> >>> On the ARM, why does setjmp preserve r12 (ip)? I believe r12 is
> >>> caller-preserved, not callee-preserved.
>
> >> I *think* that this is because GCC uses it as the static chain
> >> register for nested functions (when operating in ARM mode).
>
> > Would that even be legal?
>
> Yes...
Hi Nick,
thanks for the very good explanation.
> (1) Why on earth would you want to use two different C
> libraries anyway?
> This is just asking for trouble.
Because I have libraries delivered by different vendors who compiled
against different implementations of the C library. The whole point of
an Application _Binary_ Interface is (at least for me) to be able to
link together relocatable (or shared) object (i.e., binary) files,
without regard to the header (i.e., non binary) files they were compiled
with.
Note that the architecture-specific supplement to the SysV ABI defines
the layout of every structure (and also the name of every external)
provided by the standard libraries. See e.g.,
http://www.stanford.edu/class/cs140/projects/pintos/specs/sysv-abi-i386-
4.pdf, figure 6-76 (pg 157): <setjmp.h>. (I agree that the information
there is ambiguous, since the location of each register is not defined
within the array holding the registers, but it is with regards to the
size of that array).
Thanks again,
Konrad