Subject: Re: ELF toolchain?
To: Ben Harris <>
From: Richard Earnshaw <>
List: port-arm
Date: 03/23/2001 20:58:30
> On Fri, 23 Mar 2001, Matt Thomas wrote:
> > What exactly is needed to build ELF toolchain for arm?
> At present, a copy of src/gnu/dist/toolchain from NetBSD-current and my
> patch to teach it about arm-unknown-netbsdelf, which is at
> <URL:
> arm-elf-toolchain-20010222.diff>.
> At the moment, this still has structure padding set up like Linux,
> whereas it should be set up line NetBSD/a.out.  This needs changing by
> adding "#define STRUCTURE_SIZE_BOUNDARY 8" to
> gnu/dist/toolchain/gcc/config/arm/netbsd-elf.h.  I haven't yet tested
> this.

Assuming we want ABI compatibility with ARM's ADS product, the following 
need to be checked (and if required corrected).

ATPCS variant.
Floating point variant.
structure layout.
argument passing.
register saving.
result returning.
stack alignment.
Other alignments.

Unless I've mis-understood the consenus here, I think we have decided on:

- ATPCS variant for shared libs is still not determined.

- VFP floating point, but with soft-float calling conventions.
Structures to use natural alignment of largest type contained (8-bit 
boundary rule)

- Arguments passed in r0-r3 then on stack

- Traditional model for register saving (r0-r3,ip,lr) clobbered over a 
call (if using fpa then f0-f3 are call clobbered; vfp still to be 

- Results returned in r0 (+r1 for long long or double).  Structs less than 
32-bits and not containing floats to be returned in r0 otherwise in memory 
passed as invisible first arg to function.  FP structs TBD (copy ADS).

- Stack alignment: will be 64-bit aligned on entry to any C function.  
Functions are not required to maintain alignment at other times (though 
stack must at all times be word aligned).

- Other alignments: I believe that ADS aligns no objects to more than a 
word boundary.

Nailing down one or two of the final items (and implementing them in the 
compiler if required) is a requirement before we can start building ELF 
shared libs.  The requirement for 64-bit stack alignment may require some 
assembler routines to be revised.