Author: emaste
Date: Fri Jan  2 15:36:29 2015
New Revision: 276539
URL: https://svnweb.freebsd.org/changeset/base/276539

Log:
  Update ELF headers to include additional defines
  
  The elftoolchain project includes these additional defines for various
  userland programs. Given that arch-specific defines are still interesting
  in the context of userland programs reading or writing ELF metadata, they
  should be included in top-level ELF headers.
  
  Remove duplicate defines from ARM and MIPS elf headers.
  
  Submitted by: will (initial version)
  Reviewed by:  imp, will
  Sponsored by: The FreeBSD Foundation
  Differential Revision: https://reviews.freebsd.org/D844

Modified:
  head/sys/arm/include/elf.h
  head/sys/mips/include/elf.h
  head/sys/sys/elf32.h
  head/sys/sys/elf64.h
  head/sys/sys/elf_common.h

Modified: head/sys/arm/include/elf.h
==============================================================================
--- head/sys/arm/include/elf.h  Fri Jan  2 14:58:41 2015        (r276538)
+++ head/sys/arm/include/elf.h  Fri Jan  2 15:36:29 2015        (r276539)
@@ -104,7 +104,6 @@ __ElfType(Auxinfo);
 #define        ELF_TARG_VER    1
 
 /* Defines specific for arm headers */
-#define EF_ARM_EABIMASK      0xff000000
 #define EF_ARM_EABI_VERSION(x) (((x) & EF_ARM_EABIMASK) >> 24)
 #define EF_ARM_EABI_VERSION_UNKNOWN 0
 #define EF_ARM_EABI_FREEBSD_MIN 4

Modified: head/sys/mips/include/elf.h
==============================================================================
--- head/sys/mips/include/elf.h Fri Jan  2 14:58:41 2015        (r276538)
+++ head/sys/mips/include/elf.h Fri Jan  2 15:36:29 2015        (r276539)
@@ -238,39 +238,10 @@ __ElfType(Auxinfo);
 #define        R_MIPS_COPY             126
 #define        R_MIPS_JUMP_SLOT        127
 
-/* mips dynamic tags */
-
-#define        DT_MIPS_RLD_VERSION     0x70000001
-#define        DT_MIPS_TIME_STAMP      0x70000002
-#define        DT_MIPS_ICHECKSUM       0x70000003
-#define        DT_MIPS_IVERSION        0x70000004
-#define        DT_MIPS_FLAGS           0x70000005
-#define        DT_MIPS_BASE_ADDRESS    0x70000006
-#define        DT_MIPS_CONFLICT        0x70000008
-#define        DT_MIPS_LIBLIST         0x70000009
-#define        DT_MIPS_CONFLICTNO      0x7000000b
-#define        DT_MIPS_LOCAL_GOTNO     0x7000000a      /* number of local got 
ents */
-#define        DT_MIPS_LIBLISTNO       0x70000010
-#define        DT_MIPS_SYMTABNO        0x70000011      /* number of .dynsym 
entries */
-#define        DT_MIPS_UNREFEXTNO      0x70000012
-#define        DT_MIPS_GOTSYM          0x70000013      /* first dynamic sym in 
got */
-#define        DT_MIPS_HIPAGENO        0x70000014
-#define        DT_MIPS_RLD_MAP         0x70000016      /* address of loader 
map */
-#define        DT_MIPS_PLTGOT          0x70000032
-#define        DT_MIPS_RWPLT           0x70000034
-
 /*
  * ELF Flags
  */
-#define        EF_MIPS_PIC             0x00000002      /* Contains PIC code */
-#define        EF_MIPS_CPIC            0x00000004      /* STD PIC calling 
sequence */
-#define        EF_MIPS_ABI2            0x00000020      /* N32 */
-
-#define        EF_MIPS_ARCH_ASE        0x0f000000      /* Architectural 
extensions */
-#define        EF_MIPS_ARCH_MDMX       0x08000000      /* MDMX multimedia 
extension */
-#define        EF_MIPS_ARCH_M16        0x04000000      /* MIPS-16 ISA 
extensions */
 
-#define        EF_MIPS_ARCH            0xf0000000      /* Architecture field */
 #define        EF_MIPS_ARCH_1          0x00000000      /* -mips1 code */
 #define        EF_MIPS_ARCH_2          0x10000000      /* -mips2 code */
 #define        EF_MIPS_ARCH_3          0x20000000      /* -mips3 code */

Modified: head/sys/sys/elf32.h
==============================================================================
--- head/sys/sys/elf32.h        Fri Jan  2 14:58:41 2015        (r276538)
+++ head/sys/sys/elf32.h        Fri Jan  2 15:36:29 2015        (r276539)
@@ -70,6 +70,18 @@ typedef struct {
 } Elf32_Ehdr;
 
 /*
+ * Shared object information, found in SHT_MIPS_LIBLIST.
+ */
+
+typedef struct {
+       Elf32_Word l_name;              /* The name of a shared object. */
+       Elf32_Word l_time_stamp;        /* 32-bit timestamp. */
+       Elf32_Word l_checksum;          /* Checksum of visible symbols, sizes. 
*/
+       Elf32_Word l_version;           /* Interface version string index. */
+       Elf32_Word l_flags;             /* Flags (LL_*). */
+} Elf32_Lib;
+
+/*
  * Section header.
  */
 

Modified: head/sys/sys/elf64.h
==============================================================================
--- head/sys/sys/elf64.h        Fri Jan  2 14:58:41 2015        (r276538)
+++ head/sys/sys/elf64.h        Fri Jan  2 15:36:29 2015        (r276539)
@@ -79,6 +79,18 @@ typedef struct {
 } Elf64_Ehdr;
 
 /*
+ * Shared object information, found in SHT_MIPS_LIBLIST.
+ */
+
+typedef struct {
+       Elf64_Word l_name;              /* The name of a shared object. */
+       Elf64_Word l_time_stamp;        /* 64-bit timestamp. */
+       Elf64_Word l_checksum;          /* Checksum of visible symbols, sizes. 
*/
+       Elf64_Word l_version;           /* Interface version string index. */
+       Elf64_Word l_flags;             /* Flags (LL_*). */
+} Elf64_Lib;
+
+/*
  * Section header.
  */
 

Modified: head/sys/sys/elf_common.h
==============================================================================
--- head/sys/sys/elf_common.h   Fri Jan  2 14:58:41 2015        (r276538)
+++ head/sys/sys/elf_common.h   Fri Jan  2 15:36:29 2015        (r276539)
@@ -50,6 +50,61 @@ typedef struct {
 } Elf_Note;
 
 /*
+ * Option kinds.
+ */
+#define        ODK_NULL        0       /* undefined */
+#define        ODK_REGINFO     1       /* register usage info */
+#define        ODK_EXCEPTIONS  2       /* exception processing info */
+#define        ODK_PAD         3       /* section padding */
+#define        ODK_HWPATCH     4       /* hardware patch applied */
+#define        ODK_FILL        5       /* fill value used by the linker */
+#define        ODK_TAGS        6       /* reserved space for tools */
+#define        ODK_HWAND       7       /* hardware AND patch applied */
+#define        ODK_HWOR        8       /* hardware OR patch applied */
+#define        ODK_GP_GROUP    9       /* GP group for text/data sections */
+#define        ODK_IDENT       10      /* ID information */
+#define        ODK_PAGESIZE    11      /* page size information */
+
+/*
+ * ODK_EXCEPTIONS info field masks.
+ */
+#define        OEX_FPU_MIN     0x0000001f      /* min FPU exception required */
+#define        OEX_FPU_MAX     0x00001f00      /* max FPU exception allowed */
+#define        OEX_PAGE0       0x00010000      /* page zero must be mapped */
+#define        OEX_SMM         0x00020000      /* run in sequential memory 
mode */
+#define        OEX_PRECISEFP   0x00040000      /* run in precise FP exception 
mode */
+#define        OEX_DISMISS     0x00080000      /* dismiss invalid address 
traps */
+
+/*
+ * ODK_PAD info field masks.
+ */
+#define        OPAD_PREFIX     0x0001
+#define        OPAD_POSTFIX    0x0002
+#define        OPAD_SYMBOL     0x0004
+
+/*
+ * ODK_HWPATCH info field masks.
+ */
+#define        OHW_R4KEOP      0x00000001      /* patch for R4000 branch at 
end-of-page bug */
+#define        OHW_R8KPFETCH   0x00000002      /* R8000 prefetch bug may occur 
*/
+#define        OHW_R5KEOP      0x00000004      /* patch for R5000 branch at 
end-of-page bug */
+#define        OHW_R5KCVTL     0x00000008      /* R5000 cvt.[ds].l bug: clean 
== 1 */
+#define        OHW_R10KLDL     0x00000010UL    /* need patch for R10000 
misaligned load */
+
+/*
+ * ODK_HWAND/ODK_HWOR info field and hwp_flags[12] masks.
+ */
+#define        OHWA0_R4KEOP_CHECKED    0x00000001      /* object checked for 
R4000 end-of-page bug */
+#define        OHWA0_R4KEOP_CLEAN      0x00000002      /* object verified 
clean for R4000 end-of-page bug */
+#define        OHWO0_FIXADE            0x00000001      /* object requires call 
to fixade */
+
+/*
+ * ODK_IDENT/ODK_GP_GROUP info field masks.
+ */
+#define        OGP_GROUP       0x0000ffff      /* GP group number */
+#define        OGP_SELF        0x00010000      /* GP group is self-contained */
+
+/*
  * The header for GNU-style hash sections.
  */
 
@@ -119,6 +174,7 @@ typedef struct {
 
 #define        ELFOSABI_SYSV           ELFOSABI_NONE   /* symbol used in old 
spec */
 #define        ELFOSABI_MONTEREY       ELFOSABI_AIX    /* Monterey */
+#define        ELFOSABI_GNU            ELFOSABI_LINUX
 
 /* e_ident */
 #define        IS_ELF(ehdr)    ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
@@ -245,6 +301,60 @@ typedef struct {
 #define        EM_ALPHA_STD    41      /* Digital Alpha (standard value). */
 #define        EM_ALPHA        0x9026  /* Alpha (written in the absence of an 
ABI) */
 
+/**
+ * e_flags
+ */
+#define        EF_ARM_RELEXEC  0x1
+#define        EF_ARM_HASENTRY 0x2
+#define        EF_ARM_SYMSARESORTED    0x4
+#define        EF_ARM_DYNSYMSUSESEGIDX 0x8
+#define        EF_ARM_MAPSYMSFIRST     0x10
+#define        EF_ARM_LE8              0x00400000
+#define        EF_ARM_BE8              0x00800000
+#define        EF_ARM_EABIMASK         0xFF000000
+#define        EF_ARM_EABI_UNKNOWN     0x00000000
+#define        EF_ARM_EABI_VER1        0x01000000
+#define        EF_ARM_EABI_VER2        0x02000000
+#define        EF_ARM_EABI_VER3        0x03000000
+#define        EF_ARM_EABI_VER4        0x04000000
+#define        EF_ARM_EABI_VER5        0x05000000
+#define        EF_ARM_INTERWORK        0x00000004
+#define        EF_ARM_APCS_26          0x00000008
+#define        EF_ARM_APCS_FLOAT       0x00000010
+#define        EF_ARM_PIC              0x00000020
+#define        EF_ARM_ALIGN8           0x00000040
+#define        EF_ARM_NEW_ABI          0x00000080
+#define        EF_ARM_OLD_ABI          0x00000100
+#define        EF_ARM_SOFT_FLOAT       0x00000200
+#define        EF_ARM_VFP_FLOAT        0x00000400
+#define        EF_ARM_MAVERICK_FLOAT   0x00000800
+
+#define        EF_MIPS_NOREORDER       0x00000001
+#define        EF_MIPS_PIC             0x00000002      /* Contains PIC code */
+#define        EF_MIPS_CPIC            0x00000004      /* STD PIC calling 
sequence */
+#define        EF_MIPS_UCODE           0x00000010
+#define        EF_MIPS_ABI2            0x00000020      /* N32 */
+#define        EF_MIPS_OPTIONS_FIRST   0x00000080
+#define        EF_MIPS_ARCH_ASE        0x0F000000      /* Architectural 
extensions */
+#define        EF_MIPS_ARCH_ASE_MDMX   0x08000000      /* MDMX multimedia 
extension */
+#define        EF_MIPS_ARCH_ASE_M16    0x04000000      /* MIPS-16 ISA 
extensions */
+#define        EF_MIPS_ARCH            0xF0000000      /* Architecture field */
+
+#define        EF_PPC_EMB              0x80000000
+#define        EF_PPC_RELOCATABLE      0x00010000
+#define        EF_PPC_RELOCATABLE_LIB  0x00008000
+
+#define        EF_SPARC_EXT_MASK       0x00ffff00
+#define        EF_SPARC_32PLUS         0x00000100
+#define        EF_SPARC_SUN_US1        0x00000200
+#define        EF_SPARC_HAL_R1         0x00000200
+#define        EF_SPARC_SUN_US3        0x00000800
+
+#define        EF_SPARCV9_MM           0x00000003
+#define        EF_SPARCV9_TSO          0x00000000
+#define        EF_SPARCV9_PSO          0x00000001
+#define        EF_SPARCV9_RMO          0x00000002
+
 /* Special section indexes. */
 #define        SHN_UNDEF            0          /* Undefined, missing, 
irrelevant. */
 #define        SHN_LORESERVE   0xff00          /* First of reserved range. */
@@ -279,6 +389,7 @@ typedef struct {
 #define        SHT_LOSUNW              0x6ffffff4
 #define        SHT_SUNW_dof            0x6ffffff4
 #define        SHT_SUNW_cap            0x6ffffff5
+#define        SHT_GNU_ATTRIBUTES      0x6ffffff5
 #define        SHT_SUNW_SIGNATURE      0x6ffffff6
 #define        SHT_GNU_HASH            0x6ffffff6
 #define        SHT_GNU_LIBLIST         0x6ffffff7
@@ -298,6 +409,7 @@ typedef struct {
 #define        SHT_HIOS                0x6fffffff      /* Last of OS specific 
semantics */
 #define        SHT_LOPROC              0x70000000      /* reserved range for 
processor */
 #define        SHT_AMD64_UNWIND        0x70000001      /* unwind information */
+
 #define        SHT_ARM_EXIDX           0x70000001      /* Exception index 
table. */
 #define        SHT_ARM_PREEMPTMAP      0x70000002      /* BPABI DLL dynamic 
linking 
                                                   pre-emption map. */
@@ -305,9 +417,38 @@ typedef struct {
                                                   attributes. */
 #define        SHT_ARM_DEBUGOVERLAY    0x70000004      /* See DBGOVL for 
details. */
 #define        SHT_ARM_OVERLAYSECTION  0x70000005      /* See DBGOVL for 
details. */
+#define        SHT_MIPS_LIBLIST        0x70000000
+#define        SHT_MIPS_MSYM           0x70000001
+#define        SHT_MIPS_CONFLICT       0x70000002
+#define        SHT_MIPS_GPTAB          0x70000003
+#define        SHT_MIPS_UCODE          0x70000004
+#define        SHT_MIPS_DEBUG          0x70000005
 #define        SHT_MIPS_REGINFO        0x70000006
+#define        SHT_MIPS_PACKAGE        0x70000007
+#define        SHT_MIPS_PACKSYM        0x70000008
+#define        SHT_MIPS_RELD           0x70000009
+#define        SHT_MIPS_IFACE          0x7000000b
+#define        SHT_MIPS_CONTENT        0x7000000c
 #define        SHT_MIPS_OPTIONS        0x7000000d
+#define        SHT_MIPS_DELTASYM       0x7000001b
+#define        SHT_MIPS_DELTAINST      0x7000001c
+#define        SHT_MIPS_DELTACLASS     0x7000001d
 #define        SHT_MIPS_DWARF          0x7000001e      /* MIPS gcc uses 
MIPS_DWARF */
+#define        SHT_MIPS_DELTADECL      0x7000001f
+#define        SHT_MIPS_SYMBOL_LIB     0x70000020
+#define        SHT_MIPS_EVENTS         0x70000021
+#define        SHT_MIPS_TRANSLATE      0x70000022
+#define        SHT_MIPS_PIXIE          0x70000023
+#define        SHT_MIPS_XLATE          0x70000024
+#define        SHT_MIPS_XLATE_DEBUG    0x70000025
+#define        SHT_MIPS_WHIRL          0x70000026
+#define        SHT_MIPS_EH_REGION      0x70000027
+#define        SHT_MIPS_XLATE_OLD      0x70000028
+#define        SHT_MIPS_PDR_EXCEPTION  0x70000029
+
+#define        SHT_SPARC_GOTDATA       0x70000000
+
+#define        SHTORDERED
 #define        SHT_HIPROC              0x7fffffff      /* specific section 
header types */
 #define        SHT_LOUSER              0x80000000      /* reserved range for 
application */
 #define        SHT_HIUSER              0xffffffff      /* specific indexes */
@@ -424,11 +565,15 @@ typedef struct {
  * Dyn.d_un.d_val field of the Elf*_Dyn structure.
  */
 #define        DT_VALRNGLO     0x6ffffd00
+#define        DT_GNU_PRELINKED        0x6ffffdf5 /* prelinking timestamp */
+#define        DT_GNU_CONFLICTSZ       0x6ffffdf6 /* size of conflict section 
*/
+#define        DT_GNU_LIBLISTSZ        0x6ffffdf7 /* size of library list */
 #define        DT_CHECKSUM     0x6ffffdf8      /* elf checksum */
 #define        DT_PLTPADSZ     0x6ffffdf9      /* pltpadding size */
 #define        DT_MOVEENT      0x6ffffdfa      /* move table entry size */
 #define        DT_MOVESZ       0x6ffffdfb      /* move table size */
 #define        DT_FEATURE      0x6ffffdfc      /* feature holder */
+#define        DT_FEATURE_1    DT_FEATURE
 #define        DT_POSFLAG_1    0x6ffffdfd      /* flags for DT_* entries, 
effecting */
                                        /*      the following DT_* entry. */
                                        /*      See DF_P1_* definitions */
@@ -445,6 +590,8 @@ typedef struct {
  */
 #define        DT_ADDRRNGLO    0x6ffffe00
 #define        DT_GNU_HASH     0x6ffffef5      /* GNU-style hash table */
+#define        DT_GNU_CONFLICT 0x6ffffef8      /* address of conflict section 
*/
+#define        DT_GNU_LIBLIST  0x6ffffef9      /* address of library list */
 #define        DT_CONFIG       0x6ffffefa      /* configuration information */
 #define        DT_DEPAUDIT     0x6ffffefb      /* dependency auditing */
 #define        DT_AUDIT        0x6ffffefc      /* object auditing */
@@ -463,7 +610,67 @@ typedef struct {
 #define        DT_VERNEEDNUM   0x6fffffff      /* Number of elems in verneed 
section */
 
 #define        DT_LOPROC       0x70000000      /* First processor-specific 
type. */
+
+#define        DT_ARM_SYMTABSZ                 0x70000001
+#define        DT_ARM_PREEMPTMAP               0x70000002
+
+#define        DT_SPARC_REGISTER               0x70000001
 #define        DT_DEPRECATED_SPARC_REGISTER    0x7000001
+
+#define        DT_MIPS_RLD_VERSION             0x70000001
+#define        DT_MIPS_TIME_STAMP              0x70000002
+#define        DT_MIPS_ICHECKSUM               0x70000003
+#define        DT_MIPS_IVERSION                0x70000004
+#define        DT_MIPS_FLAGS                   0x70000005
+#define        DT_MIPS_BASE_ADDRESS            0x70000006
+#define        DT_MIPS_CONFLICT                0x70000008
+#define        DT_MIPS_LIBLIST                 0x70000009
+#define        DT_MIPS_LOCAL_GOTNO             0x7000000a
+#define        DT_MIPS_CONFLICTNO              0x7000000b
+#define        DT_MIPS_LIBLISTNO               0x70000010
+#define        DT_MIPS_SYMTABNO                0x70000011
+#define        DT_MIPS_UNREFEXTNO              0x70000012
+#define        DT_MIPS_GOTSYM                  0x70000013
+#define        DT_MIPS_HIPAGENO                0x70000014
+#define        DT_MIPS_RLD_MAP                 0x70000016
+#define        DT_MIPS_DELTA_CLASS             0x70000017
+#define        DT_MIPS_DELTA_CLASS_NO          0x70000018
+#define        DT_MIPS_DELTA_INSTANCE          0x70000019
+#define        DT_MIPS_DELTA_INSTANCE_NO       0x7000001A
+#define        DT_MIPS_DELTA_RELOC             0x7000001B
+#define        DT_MIPS_DELTA_RELOC_NO          0x7000001C
+#define        DT_MIPS_DELTA_SYM               0x7000001D
+#define        DT_MIPS_DELTA_SYM_NO            0x7000001E
+#define        DT_MIPS_DELTA_CLASSSYM          0x70000020
+#define        DT_MIPS_DELTA_CLASSSYM_NO       0x70000021
+#define        DT_MIPS_CXX_FLAGS               0x70000022
+#define        DT_MIPS_PIXIE_INIT              0x70000023
+#define        DT_MIPS_SYMBOL_LIB              0x70000024
+#define        DT_MIPS_LOCALPAGE_GOTIDX        0x70000025
+#define        DT_MIPS_LOCAL_GOTIDX            0x70000026
+#define        DT_MIPS_HIDDEN_GOTIDX           0x70000027
+#define        DT_MIPS_PROTECTED_GOTIDX        0x70000028
+#define        DT_MIPS_OPTIONS                 0x70000029
+#define        DT_MIPS_INTERFACE               0x7000002A
+#define        DT_MIPS_DYNSTR_ALIGN            0x7000002B
+#define        DT_MIPS_INTERFACE_SIZE          0x7000002C
+#define        DT_MIPS_RLD_TEXT_RESOLVE_ADDR   0x7000002D
+#define        DT_MIPS_PERF_SUFFIX             0x7000002E
+#define        DT_MIPS_COMPACT_SIZE            0x7000002F
+#define        DT_MIPS_GP_VALUE                0x70000030
+#define        DT_MIPS_AUX_DYNAMIC             0x70000031
+#define        DT_MIPS_PLTGOT                  0x70000032
+#define        DT_MIPS_RLD_OBJ_UPDATE          0x70000033
+#define        DT_MIPS_RWPLT                   0x70000034
+
+#define        DT_PPC_GOT                      0x70000000
+#define        DT_PPC_TLSOPT                   0x70000001
+
+#define        DT_PPC64_GLINK                  0x70000000
+#define        DT_PPC64_OPD                    0x70000001
+#define        DT_PPC64_OPDSZ                  0x70000002
+#define        DT_PPC64_TLSOPT                 0x70000003
+
 #define        DT_AUXILIARY    0x7ffffffd      /* shared library auxiliary 
name */
 #define        DT_USED         0x7ffffffe      /* ignored - same as needed */
 #define        DT_FILTER       0x7fffffff      /* shared library filter name */
@@ -494,6 +701,15 @@ typedef struct {
 #define        DF_1_INTERPOSE  0x00000400      /* Interpose all objects but 
main */
 #define        DF_1_NODEFLIB   0x00000800      /* Do not search default paths 
*/
 
+/* Values for l_flags. */
+#define        LL_NONE                 0x0     /* no flags */
+#define        LL_EXACT_MATCH          0x1     /* require an exact match */
+#define        LL_IGNORE_INT_VER       0x2     /* ignore version 
incompatibilities */
+#define        LL_REQUIRE_MINOR        0x4
+#define        LL_EXPORTS              0x8
+#define        LL_DELAY_LOAD           0x10
+#define        LL_DELTA                0x20
+
 /* Values for n_type.  Used in core files. */
 #define        NT_PRSTATUS     1       /* Process status. */
 #define        NT_FPREGSET     2       /* Floating point registers. */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to