Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2019 14:29:14 -0600
From:      Ian Lepore <ian@freebsd.org>
To:        adr <adr@SDF.ORG>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: FreeBSD arm EABI5 documentation?
Message-ID:  <1788e13e706b9fdaf610e4ddd671a5ed715f9dfe.camel@freebsd.org>
In-Reply-To: <alpine.NEB.2.21.1907101904570.15468@sdf.lonestar.org>
References:  <alpine.NEB.2.21.1907101508370.22895@sdf.lonestar.org> <f2967859f68f1d40f260661791126956f48f4d12.camel@freebsd.org> <alpine.NEB.2.21.1907101735020.3201@sdf.lonestar.org> <da6a8f7e596da9bf9015f76798a5575908ad1be4.camel@freebsd.org> <alpine.NEB.2.21.1907101904570.15468@sdf.lonestar.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 2019-07-10 at 20:00 +0000, adr wrote:
> > 
[...]
> > The good news is that freebsd is in sync with pretty much the entire
> > rest of the world in this regard.  EABI (aka gnueabihf) is the standard
> > used by all major OSes and toolchains these days for armv7.  And clang
> > is very gcc-compatible; if you have code that compiles with modern gcc,
> > it should compile with no changes using clang; even command-line
> > options and flags are compatible.
> 
> In NetBSD (and Linux by the way) the C stack aligment of 32bit arm code 
> doesn't have to be 8 bytes. The last version I tested of gcc was 8.3.
> I'm talking about assembler, of course, using gcc to link the runtime
> c code without going crazy. I have not used OpenBSD for years, so I don't
> know how things are there today.
> 

That's... odd.  The arm spec requires the stack to be 8-byte aligned at
any public interface.  It's hard to imagine how anything could work
properly if it were not, given that the toolchains will assume that 64-
bit values are aligned at 64-bit boundaries and will thus generate
instructions that require that alignment (require it even if strict
alignment checking for most instructions is disabled in the control
register).  If you could enter a function with the stack only 4-byte
aligned, how would the compiler know it's safe to use something like an
LDREXD instruction on a local variable allocated on the stack?

-- Ian




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1788e13e706b9fdaf610e4ddd671a5ed715f9dfe.camel>