This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM setjmp and r12


Hi Konrad,

(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.

True.


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).

Right, but that is the supplement for the i386 and not the ARM. The only information I could find regarding the size of the setjmp array for the ARM was in the "C Library ABI for the ARM Architecture":


www.arm.com/miscPDFs/8032.pdf

Where in section 5.11 it says:

  "The type and size of jmp_buf are defined by setjmp.h.  Its contents
   are opaque, so setjmp and longjmp must be from the same library, and
   called out of line.

   In deference to VFP, XScale Wireless MMX, and other co-processors
   manipulating 8-byte aligned types, a jmp_buf must be 8-byte aligned.
   A minimum size to accommodate ARM + VFPv2 is 8 + 16 = 24 double-words
   (but implementation requirements will vary and can be more than this
   minimum).

   The link-time constant __aeabi_JMP_BUF_SIZE gives the actual size of
   a target system jmp_buf measured in 8-byte double-words.

   When _AEABI_PORTABILITY_LEVEL != 0, the required definition of
   jmp_buf cannot be used to create jmp_buf objects. Instead, a jmp_buf
   must be passed as a parameter or allocated dynamically.

There is more - a table of values for jmp_buf and __aeabi_JMP_BUF_SIZE.

So I was mistaken when I said that the buffer had to be at least 8 words in size. It actually has to be at least 24 double-words in size and aligned on an 8 byte boundary.

Cheers
  Nick



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]