Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Jul 2013 21:02:51 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Andrew Turner <andrew@fubar.geek.nz>
Cc:        freebsd-arch@freebsd.org
Subject:   Re: Adding a MACHINE_ARCH note
Message-ID:  <95B55330-1AC8-467C-942C-50795F168E49@bsdimp.com>
In-Reply-To: <20130709234837.559e3769@bender.Home>
References:  <20130709090744.0e497e7e@bender.Home> <32F979BD-FB5C-4111-9586-4C5E7C6DFA71@bsdimp.com> <20130709234837.559e3769@bender.Home>

next in thread | previous in thread | raw e-mail | index | archive | help

On Jul 9, 2013, at 4:48 PM, Andrew Turner wrote:

> On Tue, 9 Jul 2013 08:19:46 -0600
> Warner Losh <imp@bsdimp.com> wrote:
>> I thought that the ELF headers gave us all the data we needed to know
>> how things were built...
>=20
> It will tell us if it was for e.g. an ARM or MIPS ELF file, but I'm =
not
> sure how we can tell the difference between an arm and an armv6 ELF.
>=20
> With armv6 there are a few changes in the userland/kernel
> interface, e.g. reading the thread local storage pointer is different
> such that an armv6 static binary would not run on an ARMv5 core as it
> uses newer instructions.

On MIPS I know all that is encoded in the ELF headers for sure, so I =
went looking for ARM.

OK. Found the ARM elf spec.
=
http://infocenter.arm.com/help/topic/com.arm.doc.dui0101a/DUI0101A_Elf.pdf=
 which is updated by =
http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044e/IHI0044E_aaelf.p=
df

For big endian vs little endian: ei_data is set to ELFDATA2LSB or =
ELFDATA2MSB.

EABI is denoted by setting EI_OSABI to ELFOSABI_ARM_AEABI.

e_flags will have some info as well:
EF_ARM_ABIMASK 0xFF000000 (value of 5 for EABI for armv6)
EF_ARM_BE8 0x00800000 - The ELF file contains BE-8 code, suitable for =
execution on an ARM=20
Architecture v6 processor
EF_ARM_ABI_FLOAT_HARD 0x00000400 - Set in executable file headers =
(e_type =3D ET_EXEC or ET_DYN) to note that=20
the executable file was built to conform to the hardware floating-point=20=

procedure-call standard.
Compatible with legacy (pre version 5) gcc use as EF_ARM_VFP_FLOAT.
EF_ARM_ABI_FLOAT_SOFT 0x00000200 - Set in executable file headers =
(e_type =3D ET_EXEC or ET_DYN) to note=20
explicitly that the executable file was built to conform to the software=20=

floating-point procedure-call standard (the base standard). If both=20
EF_ARM_ABI_FLOAT_XXXX bits are clear, conformance to the base=20
procedure-call standard is implied.
Compatible with legacy (pre version 5) gcc use as EF_ARM_SOFT_FLOAT

What else is needed?

Warner





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95B55330-1AC8-467C-942C-50795F168E49>