Re: git: 34784d17eb2b - main - elf: Catch up with defining EF_ARM_EABI_VERSION in elf_common.h

From: Jessica Clarke <jrtc27_at_freebsd.org>
Date: Sat, 21 Jan 2023 02:21:59 UTC
On 21 Jan 2023, at 02:20, Warner Losh <imp@FreeBSD.org> wrote:
> 
> The branch main has been updated by imp:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=34784d17eb2bcdcfaee39f570bff613b4055912d
> 
> commit 34784d17eb2bcdcfaee39f570bff613b4055912d
> Author:     Warner Losh <imp@FreeBSD.org>
> AuthorDate: 2023-01-21 02:15:52 +0000
> Commit:     Warner Losh <imp@FreeBSD.org>
> CommitDate: 2023-01-21 02:18:15 +0000
> 
>    elf: Catch up with defining EF_ARM_EABI_VERSION in elf_common.h
> 
>    FreeBSD defines EF_ARM_EABI_VERSION in a non-standard way (at least
>    differently than everybody else). We use this only in elf*machdep.c to
>    make sure the image is new enough. Switch to the more standard way of
>    defining this and adjust other constants to match.
> 
>    Fixes:                  c52c98e69a2e
>    Sponsored by:           Netflix
> ---
> sys/arm/include/elf.h           | 3 +--
> sys/arm64/arm64/elf32_machdep.c | 3 +--
> 2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/sys/arm/include/elf.h b/sys/arm/include/elf.h
> index 35d0fa55ca1a..2ea60e8f10ee 100644
> --- a/sys/arm/include/elf.h
> +++ b/sys/arm/include/elf.h
> @@ -74,9 +74,8 @@ __ElfType(Auxinfo);
> #define	ELF_TARG_VER	1
> 
> /* Defines specific for arm headers */
> -#define	EF_ARM_EABI_VERSION(x) (((x) & EF_ARM_EABIMASK) >> 24)
> #define	EF_ARM_EABI_VERSION_UNKNOWN 0

Can also use EF_ARM_EABI_UNKNOWN in its place?

Jess

> -#define	EF_ARM_EABI_FREEBSD_MIN 4
> +#define	EF_ARM_EABI_FREEBSD_MIN EF_ARM_EABI_VER4
> 
> #define	ET_DYN_LOAD_ADDR 0x01001000
> 
> diff --git a/sys/arm64/arm64/elf32_machdep.c b/sys/arm64/arm64/elf32_machdep.c
> index f637c5a65c05..627973ecfd3d 100644
> --- a/sys/arm64/arm64/elf32_machdep.c
> +++ b/sys/arm64/arm64/elf32_machdep.c
> @@ -152,8 +152,7 @@ elf32_arm_abi_supported(struct image_params *imgp, int32_t *osrel __unused,
> 	    ID_AA64PFR0_EL0_64_32)
> 		return (FALSE);
> 
> -#define	EF_ARM_EABI_VERSION(x)	(((x) & EF_ARM_EABIMASK) >> 24)
> -#define	EF_ARM_EABI_FREEBSD_MIN	4
> +#define	EF_ARM_EABI_FREEBSD_MIN	EF_ARM_EABI_VER4
> 	hdr = (const Elf32_Ehdr *)imgp->image_header;
> 	if (EF_ARM_EABI_VERSION(hdr->e_flags) < EF_ARM_EABI_FREEBSD_MIN) {
> 		if (bootverbose)