]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - include/elf/common.h
Update year range in copyright notice of binutils files
[thirdparty/binutils-gdb.git] / include / elf / common.h
index 1a940ff7b52c779f07cf69032f33af46c404e1e9..e7d55ae07825dab8adbbda044e7c89e469052427 100644 (file)
@@ -1,5 +1,5 @@
 /* ELF support for BFD.
-   Copyright (C) 1991-2018 Free Software Foundation, Inc.
+   Copyright (C) 1991-2021 Free Software Foundation, Inc.
 
    Written by Fred Fish @ Cygnus Support, from information published
    in "UNIX System V Release 4, Programmers Guide: ANSI C and
@@ -91,8 +91,9 @@
 
 #define ET_NONE                0       /* No file type */
 #define ET_REL         1       /* Relocatable file */
-#define ET_EXEC                2       /* Executable file */
-#define ET_DYN         3       /* Shared object file */
+#define ET_EXEC                2       /* Position-dependent executable file */
+#define ET_DYN         3       /* Position-independent executable or
+                                  shared object file */
 #define ET_CORE                4       /* Core file */
 #define ET_LOOS                0xFE00  /* Operating system-specific */
 #define ET_HIOS                0xFEFF  /* Operating system-specific */
 #define EM_AMDGPU      224     /* AMD GPU architecture */
 #define EM_RISCV       243     /* RISC-V */
 #define EM_LANAI       244     /* Lanai 32-bit processor.  */
+#define EM_CEVA                245     /* CEVA Processor Architecture Family */
+#define EM_CEVA_X2     246     /* CEVA X2 Processor Family */
 #define EM_BPF         247     /* Linux BPF – in-kernel virtual machine.  */
+#define EM_GRAPHCORE_IPU 248   /* Graphcore Intelligent Processing Unit */
+#define EM_IMG1                249     /* Imagination Technologies */
 #define EM_NFP         250     /* Netronome Flow Processor.  */
+#define EM_VE          251     /* NEC Vector Engine */
 #define EM_CSKY                252     /* C-SKY processor family.  */
+#define EM_ARC_COMPACT3_64 253 /* Synopsys ARCv2.3 64-bit */
+#define EM_MCS6502     254     /* MOS Technology MCS 6502 processor */
+#define EM_ARC_COMPACT3        255     /* Synopsys ARCv2.3 32-bit */
+#define EM_KVX         256     /* Kalray VLIW core of the MPPA processor family */
+#define EM_65816       257     /* WDC 65816/65C816 */
+#define EM_LOONGARCH   258     /* Loongson Loongarch */
+#define EM_KF32                259     /* ChipON KungFu32 */
 
 /* If it is necessary to assign new unofficial EM_* values, please pick large
    random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
 #define PT_SUNW_EH_FRAME PT_GNU_EH_FRAME      /* Solaris uses the same value */
 #define PT_GNU_STACK   (PT_LOOS + 0x474e551) /* Stack flags */
 #define PT_GNU_RELRO   (PT_LOOS + 0x474e552) /* Read-only after relocation */
+#define PT_GNU_PROPERTY        (PT_LOOS + 0x474e553) /* GNU property */
+
+/* OpenBSD segment types.  */
+#define PT_OPENBSD_RANDOMIZE (PT_LOOS + 0x5a3dbe6)  /* Fill with random data.  */
+#define PT_OPENBSD_WXNEEDED  (PT_LOOS + 0x5a3dbe7)  /* Program does W^X violations.  */
+#define PT_OPENBSD_BOOTDATA  (PT_LOOS + 0x5a41be6)  /* Section for boot arguments.  */
 
 /* Mbind segments */
 #define PT_GNU_MBIND_NUM 4096
 
 /* #define SHF_MASKOS  0x0F000000    *//* OS-specific semantics */
 #define SHF_MASKOS     0x0FF00000      /* New value, Oct 4, 1999 Draft */
-#define SHF_GNU_BUILD_NOTE    (1 << 20)        /* Section contains GNU BUILD ATTRIBUTE notes.  */
+#define SHF_GNU_RETAIN       (1 << 21) /* Section should not be garbage collected by the linker.  */
 #define SHF_MASKPROC   0xF0000000      /* Processor-specific semantics */
 
 /* This used to be implemented as a processor specific section flag.
                                        /*   note name must be "LINUX".  */
 #define NT_X86_XSTATE  0x202           /* x86 XSAVE extended state */
                                        /*   note name must be "LINUX".  */
+#define NT_X86_CET     0x203           /* x86 CET state.  */
+                                       /*   note name must be "LINUX".  */
 #define NT_S390_HIGH_GPRS 0x300                /* S/390 upper halves of GPRs  */
                                        /*   note name must be "LINUX".  */
 #define NT_S390_TIMER  0x301           /* S390 timer */
                                        /*   note name must be "LINUX".  */
 #define NT_ARM_SVE     0x405           /* AArch SVE registers.  */
                                        /*   note name must be "LINUX".  */
+#define NT_ARM_PAC_MASK        0x406           /* AArch pointer authentication code masks */
+                                       /*   note name must be "LINUX".  */
+#define NT_ARC_V2      0x600           /* ARC HS accumulator/extra registers.  */
+                                       /*   note name must be "LINUX".  */
 #define NT_SIGINFO     0x53494749      /* Fields of siginfo_t.  */
 #define NT_FILE                0x46494c45      /* Description of mapped files.  */
 
    must start with "NetBSD-CORE".  */
 
 #define NT_NETBSDCORE_PROCINFO 1       /* Has a struct procinfo */
+#define NT_NETBSDCORE_AUXV     2       /* Has auxv data */
+#define NT_NETBSDCORE_LWPSTATUS        24      /* Has LWPSTATUS data */
 #define NT_NETBSDCORE_FIRSTMACH        32      /* start of machdep note types */
 
 
 /* Application-specific semantics, hi */
 #define GNU_PROPERTY_HIUSER  0xffffffff
 
-#define GNU_PROPERTY_X86_ISA_1_USED            0xc0000000
-#define GNU_PROPERTY_X86_ISA_1_NEEDED          0xc0000001
-#define GNU_PROPERTY_X86_FEATURE_1_AND         0xc0000002
-
-#define GNU_PROPERTY_X86_ISA_1_486           (1U << 0)
-#define GNU_PROPERTY_X86_ISA_1_586           (1U << 1)
-#define GNU_PROPERTY_X86_ISA_1_686           (1U << 2)
-#define GNU_PROPERTY_X86_ISA_1_SSE           (1U << 3)
-#define GNU_PROPERTY_X86_ISA_1_SSE2          (1U << 4)
-#define GNU_PROPERTY_X86_ISA_1_SSE3          (1U << 5)
-#define GNU_PROPERTY_X86_ISA_1_SSSE3         (1U << 6)
-#define GNU_PROPERTY_X86_ISA_1_SSE4_1        (1U << 7)
-#define GNU_PROPERTY_X86_ISA_1_SSE4_2        (1U << 8)
-#define GNU_PROPERTY_X86_ISA_1_AVX           (1U << 9)
-#define GNU_PROPERTY_X86_ISA_1_AVX2          (1U << 10)
-#define GNU_PROPERTY_X86_ISA_1_AVX512F       (1U << 11)
-#define GNU_PROPERTY_X86_ISA_1_AVX512CD      (1U << 12)
-#define GNU_PROPERTY_X86_ISA_1_AVX512ER      (1U << 13)
-#define GNU_PROPERTY_X86_ISA_1_AVX512PF      (1U << 14)
-#define GNU_PROPERTY_X86_ISA_1_AVX512VL      (1U << 15)
-#define GNU_PROPERTY_X86_ISA_1_AVX512DQ      (1U << 16)
-#define GNU_PROPERTY_X86_ISA_1_AVX512BW      (1U << 17)
-
-#define GNU_PROPERTY_X86_FEATURE_1_IBT       (1U << 0)
-#define GNU_PROPERTY_X86_FEATURE_1_SHSTK     (1U << 1)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_USED     0xc0000000
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED   0xc0000001
+
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_486      (1U << 0)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_586      (1U << 1)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_686      (1U << 2)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSE      (1U << 3)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSE2     (1U << 4)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSE3     (1U << 5)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSSE3    (1U << 6)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSE4_1   (1U << 7)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_SSE4_2   (1U << 8)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX      (1U << 9)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX2     (1U << 10)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512F  (1U << 11)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512CD (1U << 12)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512ER (1U << 13)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512PF (1U << 14)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512VL (1U << 15)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512DQ (1U << 16)
+#define GNU_PROPERTY_X86_COMPAT_ISA_1_AVX512BW (1U << 17)
+
+/* A 4-byte unsigned integer property: A bit is set if it is set in all
+   relocatable inputs.  */
+#define GNU_PROPERTY_X86_UINT32_AND_LO         0xc0000002
+#define GNU_PROPERTY_X86_UINT32_AND_HI         0xc0007fff
+
+/* A 4-byte unsigned integer property: A bit is set if it is set in any
+   relocatable inputs.  */
+#define GNU_PROPERTY_X86_UINT32_OR_LO          0xc0008000
+#define GNU_PROPERTY_X86_UINT32_OR_HI          0xc000ffff
+
+/* A 4-byte unsigned integer property: A bit is set if it is set in any
+   relocatable inputs and the property is present in all relocatable
+   inputs.  */
+#define GNU_PROPERTY_X86_UINT32_OR_AND_LO      0xc0010000
+#define GNU_PROPERTY_X86_UINT32_OR_AND_HI      0xc0017fff
+
+#define GNU_PROPERTY_X86_FEATURE_1_AND \
+  (GNU_PROPERTY_X86_UINT32_AND_LO + 0)
+
+#define GNU_PROPERTY_X86_ISA_1_NEEDED \
+  (GNU_PROPERTY_X86_UINT32_OR_LO + 2)
+#define GNU_PROPERTY_X86_FEATURE_2_NEEDED \
+  (GNU_PROPERTY_X86_UINT32_OR_LO + 1)
+
+#define GNU_PROPERTY_X86_ISA_1_USED \
+  (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 2)
+#define GNU_PROPERTY_X86_FEATURE_2_USED \
+  (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1)
+
+/* GNU_PROPERTY_X86_ISA_1_BASELINE: CMOV, CX8 (cmpxchg8b), FPU (fld),
+   MMX, OSFXSR (fxsave), SCE (syscall), SSE and SSE2.  */
+#define GNU_PROPERTY_X86_ISA_1_BASELINE                (1U << 0)
+/* GNU_PROPERTY_X86_ISA_1_V2: GNU_PROPERTY_X86_ISA_1_BASELINE,
+   CMPXCHG16B (cmpxchg16b), LAHF-SAHF (lahf), POPCNT (popcnt), SSE3,
+   SSSE3, SSE4.1 and SSE4.2.  */
+#define GNU_PROPERTY_X86_ISA_1_V2              (1U << 1)
+/* GNU_PROPERTY_X86_ISA_1_V3: GNU_PROPERTY_X86_ISA_1_V2, AVX, AVX2, BMI1,
+   BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE.  */
+#define GNU_PROPERTY_X86_ISA_1_V3              (1U << 2)
+/* GNU_PROPERTY_X86_ISA_1_V4: GNU_PROPERTY_X86_ISA_1_V3, AVX512F,
+   AVX512BW, AVX512CD, AVX512DQ and AVX512VL.  */
+#define GNU_PROPERTY_X86_ISA_1_V4              (1U << 3)
+
+#define GNU_PROPERTY_X86_FEATURE_1_IBT         (1U << 0)
+#define GNU_PROPERTY_X86_FEATURE_1_SHSTK       (1U << 1)
+#define GNU_PROPERTY_X86_FEATURE_1_LAM_U48     (1U << 2)
+#define GNU_PROPERTY_X86_FEATURE_1_LAM_U57     (1U << 3)
+
+#define GNU_PROPERTY_X86_FEATURE_2_X86         (1U << 0)
+#define GNU_PROPERTY_X86_FEATURE_2_X87         (1U << 1)
+#define GNU_PROPERTY_X86_FEATURE_2_MMX         (1U << 2)
+#define GNU_PROPERTY_X86_FEATURE_2_XMM         (1U << 3)
+#define GNU_PROPERTY_X86_FEATURE_2_YMM         (1U << 4)
+#define GNU_PROPERTY_X86_FEATURE_2_ZMM         (1U << 5)
+#define GNU_PROPERTY_X86_FEATURE_2_FXSR                (1U << 6)
+#define GNU_PROPERTY_X86_FEATURE_2_XSAVE       (1U << 7)
+#define GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT    (1U << 8)
+#define GNU_PROPERTY_X86_FEATURE_2_XSAVEC      (1U << 9)
+#define GNU_PROPERTY_X86_FEATURE_2_TMM         (1U << 10)
+#define GNU_PROPERTY_X86_FEATURE_2_MASK                (1U << 11)
+
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_NEEDED \
+  (GNU_PROPERTY_X86_UINT32_OR_LO + 0)
+
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_USED \
+  (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0)
+
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_CMOV           (1U << 0)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE            (1U << 1)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE2           (1U << 2)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE3           (1U << 3)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSSE3          (1U << 4)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE4_1         (1U << 5)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_SSE4_2         (1U << 6)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX            (1U << 7)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX2           (1U << 8)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_FMA            (1U << 9)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512F                (1U << 10)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512CD       (1U << 11)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512ER       (1U << 12)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512PF       (1U << 13)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512VL       (1U << 14)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512DQ       (1U << 15)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512BW       (1U << 16)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_4FMAPS  (1U << 17)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_4VNNIW  (1U << 18)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_BITALG  (1U << 19)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_IFMA    (1U << 20)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VBMI    (1U << 21)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VBMI2   (1U << 22)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_VNNI    (1U << 23)
+#define GNU_PROPERTY_X86_COMPAT_2_ISA_1_AVX512_BF16    (1U << 24)
+
+/* AArch64 specific GNU PROPERTY.  */
+#define GNU_PROPERTY_AARCH64_FEATURE_1_AND     0xc0000000
+
+#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI     (1U << 0)
+#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC     (1U << 1)
 
 /* Values used in GNU .note.ABI-tag notes (NT_GNU_ABI_TAG).  */
 #define GNU_ABI_TAG_LINUX      0
 
 #define ELF32_R_SYM(i)         ((i) >> 8)
 #define ELF32_R_TYPE(i)                ((i) & 0xff)
-#define ELF32_R_INFO(s,t)      (((s) << 8) + ((t) & 0xff))
+#define ELF32_R_INFO(s,t)      (((unsigned) (s) << 8) + ((t) & 0xff))
 
 #define ELF64_R_SYM(i)         ((i) >> 32)
 #define ELF64_R_TYPE(i)                ((i) & 0xffffffff)
    deliberate special case and we maintain it for backwards compatability.
  */
 #define DT_VALRNGLO    0x6ffffd00
+#define DT_GNU_FLAGS_1  0x6ffffdf4
 #define DT_GNU_PRELINKED 0x6ffffdf5
 #define DT_GNU_CONFLICTSZ 0x6ffffdf6
 #define DT_GNU_LIBLISTSZ 0x6ffffdf7
 #define DF_P1_LAZYLOAD 0x00000001
 #define DF_P1_GROUPPERM        0x00000002
 
+/* Flag value in the DT_GNU_FLAGS_1 /dynamic entry.  */
+#define DF_GNU_1_UNIQUE 0x00000001
+
 /* Flag value in in the DT_FLAGS_1 .dynamic entry.  */
 #define DF_1_NOW       0x00000001
 #define DF_1_GLOBAL    0x00000002
 #define AT_L2_CACHESHAPE  36
 #define AT_L3_CACHESHAPE  37
 
+/* Shapes of the caches, with more room to describe them.
+   *GEOMETRY are comprised of cache line size in bytes in the bottom 16 bits
+   and the cache associativity in the next 16 bits.  */
+#define AT_L1I_CACHESIZE       40
+#define AT_L1I_CACHEGEOMETRY   41
+#define AT_L1D_CACHESIZE       42
+#define AT_L1D_CACHEGEOMETRY   43
+#define AT_L2_CACHESIZE                44
+#define AT_L2_CACHEGEOMETRY    45
+#define AT_L3_CACHESIZE                46
+#define AT_L3_CACHEGEOMETRY    47
+
+#define AT_MINSIGSTKSZ         51 /* Stack needed for signal delivery
+                                     (AArch64).  */
+
 #define AT_FREEBSD_EXECPATH     15      /* Path to the executable. */
 #define AT_FREEBSD_CANARY       16      /* Canary for SSP. */
 #define AT_FREEBSD_CANARYLEN    17      /* Length of the canary. */
 #define AT_FREEBSD_STACKPROT    23      /* Initial stack protection. */
 #define AT_FREEBSD_EHDRFLAGS    24      /* e_flags field from ELF header. */
 #define AT_FREEBSD_HWCAP        25      /* CPU feature flags. */
+#define AT_FREEBSD_HWCAP2       26      /* CPU feature flags 2. */
+#define AT_FREEBSD_BSDFLAGS     27      /* ELF BSD Flags. */
+#define AT_FREEBSD_ARGC         28      /* Argument count. */
+#define AT_FREEBSD_ARGV         29      /* Argument vector. */
+#define AT_FREEBSD_ENVC         30      /* Environment count. */
+#define AT_FREEBSD_ENVV         31      /* Environment vvector. */
+#define AT_FREEBSD_PS_STRINGS   32      /* struct ps_strings. */
 
 #define AT_SUN_UID      2000    /* Effective user ID.  */
 #define AT_SUN_RUID     2001    /* Real user ID.  */
 #define AT_SUN_LDNAME   2006    /* String giving name of dynamic linker.  */
 #define AT_SUN_LPAGESZ  2007    /* Large pagesize.   */
 #define AT_SUN_PLATFORM 2008    /* Platform name string.  */
-#undef AT_SUN_HWCAP
-#define AT_SUN_HWCAP    2009   /* Machine dependent hints about
+#define AT_SUN_CAP_HW1 2009    /* Machine dependent hints about
                                   processor capabilities.  */
+#define AT_SUN_HWCAP   AT_SUN_CAP_HW1 /* For backward compat only.  */
 #define AT_SUN_IFLUSH   2010    /* Should flush icache? */
 #define AT_SUN_CPU      2011    /* CPU name string.  */
 #define AT_SUN_EMUL_ENTRY 2012 /* COFF entry point address.  */
 #define AT_SUN_MMU      2015    /* String for name of MMU module.   */
 #define AT_SUN_LDDATA   2016    /* Dynamic linker's data segment address.  */
 #define AT_SUN_AUXFLAGS        2017    /* AF_SUN_ flags passed from the kernel.  */
-
+#define        AT_SUN_EMULATOR 2018    /* Name of emulation binary for runtime
+                                  linker.  */
+#define        AT_SUN_BRANDNAME 2019   /* Name of brand library.  */
+#define        AT_SUN_BRAND_AUX1 2020  /* Aux vectors for brand modules.  */
+#define        AT_SUN_BRAND_AUX2 2021
+#define        AT_SUN_BRAND_AUX3 2022
+#define        AT_SUN_CAP_HW2  2023    /* Extension of AT_SUN_CAP_HW1.  */
 
 #endif /* _ELF_COMMON_H */