From owner-svn-src-head@FreeBSD.ORG Tue Dec 16 20:07:47 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86DD2106564A; Tue, 16 Dec 2008 20:07:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 78F088FC25; Tue, 16 Dec 2008 20:07:47 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBGK7lOu046451; Tue, 16 Dec 2008 20:07:47 GMT (envelope-from imp@svn.freebsd.org) Received: (from imp@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBGK7lSO046450; Tue, 16 Dec 2008 20:07:47 GMT (envelope-from imp@svn.freebsd.org) Message-Id: <200812162007.mBGK7lSO046450@svn.freebsd.org> From: Warner Losh Date: Tue, 16 Dec 2008 20:07:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186191 - head/sys/mips/include X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 20:07:47 -0000 Author: imp Date: Tue Dec 16 20:07:47 2008 New Revision: 186191 URL: http://svn.freebsd.org/changeset/base/186191 Log: Start to clean up the MIPS elf machine dependent file. o Add support for compiling elf64 for this file (the rest of the changes are coming later) o Fill in some misssing relocation types. We need to support these in elf_machdep.c's relocation routines eventually, but that's future work too. Modified: head/sys/mips/include/elf.h Modified: head/sys/mips/include/elf.h ============================================================================== --- head/sys/mips/include/elf.h Tue Dec 16 20:04:02 2008 (r186190) +++ head/sys/mips/include/elf.h Tue Dec 16 20:07:47 2008 (r186191) @@ -40,9 +40,11 @@ /* Information taken from MIPS ABI supplemental */ -#include /* Definitions common to all 32 bit architectures. */ - +#ifndef __ELF_WORD_SIZE #define __ELF_WORD_SIZE 32 /* Used by */ +#endif +#include /* Definitions common to all 32 bit architectures. */ +#include /* Definitions common to all 64 bit architectures. */ #include #define ELF_ARCH EM_MIPS @@ -114,6 +116,16 @@ typedef union { Elf32_Word gt_bytes; /* This many bytes would be used */ } gt_entry; /* Subsequent entries in section */ } Elf32_gptab; +typedef union { + struct { + Elf64_Word gt_current_g_value; /* -G val used in compilation */ + Elf64_Word gt_unused; /* Not used */ + } gt_header; /* First entry in section */ + struct { + Elf64_Word gt_g_value; /* If this val were used for -G */ + Elf64_Word gt_bytes; /* This many bytes would be used */ + } gt_entry; /* Subsequent entries in section */ +} Elf64_gptab; /* * Entry found in sections of type SHT_MIPS_REGINFO. @@ -123,6 +135,11 @@ typedef struct { Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */ Elf32_Sword ri_gp_value; /* $gp register value */ } Elf32_RegInfo; +typedef struct { + Elf64_Word ri_gprmask; /* General registers used */ + Elf64_Word ri_cprmask[4]; /* Coprocessor registers used */ + Elf64_Sword ri_gp_value; /* $gp register value */ +} Elf64_RegInfo; /* @@ -147,10 +164,38 @@ typedef struct { #define R_MIPS_CALLHI16 30 /* upper 16 bit GOT entry for function */ #define R_MIPS_CALLLO16 31 /* lower 16 bit GOT entry for function */ -#define R_TYPE(name) __CONCAT(R_MIPS_,name) +/* + * These are from the 64-bit Irix ELF ABI + */ +#define R_MIPS_SHIFT5 16 +#define R_MIPS_SHIFT6 17 +#define R_MIPS_64 18 +#define R_MIPS_GOT_DISP 19 +#define R_MIPS_GOT_PAGE 20 +#define R_MIPS_GOT_OFST 21 +#define R_MIPS_GOT_HI16 22 +#define R_MIPS_GOT_LO16 23 +#define R_MIPS_SUB 24 +#define R_MIPS_INSERT_A 25 +#define R_MIPS_INSERT_B 26 +#define R_MIPS_DELETE 27 +#define R_MIPS_HIGHER 28 +#define R_MIPS_HIGHEST 29 +#define R_MIPS_SCN_DISP 32 +#define R_MIPS_REL16 33 +#define R_MIPS_ADD_IMMEDIATE 34 +#define R_MIPS_PJUMP 35 +#define R_MIPS_ERLGOT 36 + +#define R_MIPS_max 37 +#define R_TYPE(name) __CONCAT(R_MIPS_,name) /* Define "machine" characteristics */ +#if __ELF_WORD_SIZE == 32 #define ELF_TARG_CLASS ELFCLASS32 +#else +#define ELF_TARG_CLASS ELFCLASS64 +#endif #ifdef __MIPSEB__ #define ELF_TARG_DATA ELFDATA2MSB #else @@ -159,23 +204,30 @@ typedef struct { #define ELF_TARG_MACH EM_MIPS #define ELF_TARG_VER 1 - /* * Auxiliary vector entries for passing information to the interpreter. * * The i386 supplement to the SVR4 ABI specification names this "auxv_t", * but POSIX lays claim to all symbols ending with "_t". */ - typedef struct { /* Auxiliary vector entry on initial stack */ int a_type; /* Entry type. */ union { - long a_val; /* Integer value. */ + int a_val; /* Integer value. */ void *a_ptr; /* Address. */ void (*a_fcn)(void); /* Function pointer (not used). */ } a_un; } Elf32_Auxinfo; +typedef struct { /* Auxiliary vector entry on initial stack */ + long a_type; /* Entry type. */ + union { + long a_val; /* Integer value. */ + void *a_ptr; /* Address. */ + void (*a_fcn)(void); /* Function pointer (not used). */ + } a_un; +} Elf64_Auxinfo; + __ElfType(Auxinfo); /* Values for a_type. */