Add a elf note to describe the ARM ABI in use. If encounters on arm,

set EXEC_ARM_AAPCS bit in exec_package's ep_flags.
XXX kind of gross but it there's isn't a MD hook for notes so ...
This commit is contained in:
matt 2012-08-03 07:54:14 +00:00
parent 0745a95c9d
commit 2051fb7586
3 changed files with 36 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf.c,v 1.41 2012/06/02 18:32:27 christos Exp $ */
/* $NetBSD: exec_elf.c,v 1.42 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1994, 2000, 2005 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.41 2012/06/02 18:32:27 christos Exp $");
__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.42 2012/08/03 07:54:14 matt Exp $");
#ifdef _KERNEL_OPT
#include "opt_pax.h"
@ -948,6 +948,23 @@ bad:
sizeof(epp->ep_pax_flags));
break;
#ifdef __arm__
case ELF_NOTE_TYPE_ARMEABI_TAG:
if (np->n_namesz != ELF_NOTE_NETBSD_NAMESZ ||
np->n_descsz != ELF_NOTE_ARMEABI_DESCSZ ||
memcmp(ndata, ELF_NOTE_NETBSD_NAME,
ELF_NOTE_NETBSD_NAMESZ))
goto bad;
{
int tmp = *(int *)(ndata +
roundup(ELF_NOTE_NETBSD_NAMESZ,
sizeof(int)));
if (tmp == ELF_NOTE_ARMEABI_AAPCS)
epp->ep_flags |= EXEC_ARM_AAPCS;
}
break;
#endif
case ELF_NOTE_TYPE_SUSE_VERSION_TAG:
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec.h,v 1.137 2012/05/02 23:33:11 rmind Exp $ */
/* $NetBSD: exec.h,v 1.138 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -225,6 +225,8 @@ struct exec_package {
#define EXEC_32 0x0020 /* 32-bit binary emulation */
#define EXEC_FORCEAUX 0x0040 /* always use ELF AUX vector */
#define EXEC_ARM_AAPCS 0x8000 /* ARM MD flag: uses AAPCS ABI */
struct exec_vmcmd {
int (*ev_proc)(struct lwp *, struct exec_vmcmd *);
/* procedure to run for region of vmspace */

View File

@ -1,4 +1,4 @@
/* $NetBSD: exec_elf.h,v 1.123 2012/05/22 02:40:06 christos Exp $ */
/* $NetBSD: exec_elf.h,v 1.124 2012/08/03 07:54:14 matt Exp $ */
/*-
* Copyright (c) 1994 The NetBSD Foundation, Inc.
@ -894,6 +894,19 @@ typedef struct {
#define ELF_NOTE_PAX_NAME "PaX\0"
#define ELF_NOTE_PAX_DESCSZ 4
/*
* NetBSD-specific note type: aeabi.
* There should be 1 NOTE per executable.
* name: NetBSD\0
* namesz: 6
* desc:
* word[0]: ABI bitmask
* descsz: 4
*/
#define ELF_NOTE_TYPE_ARMEABI_TAG 4
#define ELF_NOTE_ARMEABI_DESCSZ 4
#define ELF_NOTE_ARMEABI_AAPCS 0x01
/*
* NetBSD-specific core file information.
*