Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASMARM_ELF_H
0003 #define __ASMARM_ELF_H
0004 
0005 #include <asm/auxvec.h>
0006 #include <asm/hwcap.h>
0007 #include <asm/vdso_datapage.h>
0008 
0009 /*
0010  * ELF register definitions..
0011  */
0012 #include <asm/ptrace.h>
0013 #include <asm/user.h>
0014 
0015 struct task_struct;
0016 
0017 typedef unsigned long elf_greg_t;
0018 typedef unsigned long elf_freg_t[3];
0019 
0020 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
0021 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
0022 
0023 typedef struct user_fp elf_fpregset_t;
0024 
0025 #define EF_ARM_EABI_MASK    0xff000000
0026 #define EF_ARM_EABI_UNKNOWN 0x00000000
0027 #define EF_ARM_EABI_VER1    0x01000000
0028 #define EF_ARM_EABI_VER2    0x02000000
0029 #define EF_ARM_EABI_VER3    0x03000000
0030 #define EF_ARM_EABI_VER4    0x04000000
0031 #define EF_ARM_EABI_VER5    0x05000000
0032 
0033 #define EF_ARM_BE8      0x00800000  /* ABI 4,5 */
0034 #define EF_ARM_LE8      0x00400000  /* ABI 4,5 */
0035 #define EF_ARM_MAVERICK_FLOAT   0x00000800  /* ABI 0 */
0036 #define EF_ARM_VFP_FLOAT    0x00000400  /* ABI 0 */
0037 #define EF_ARM_SOFT_FLOAT   0x00000200  /* ABI 0 */
0038 #define EF_ARM_OLD_ABI      0x00000100  /* ABI 0 */
0039 #define EF_ARM_NEW_ABI      0x00000080  /* ABI 0 */
0040 #define EF_ARM_ALIGN8       0x00000040  /* ABI 0 */
0041 #define EF_ARM_PIC      0x00000020  /* ABI 0 */
0042 #define EF_ARM_MAPSYMSFIRST 0x00000010  /* ABI 2 */
0043 #define EF_ARM_APCS_FLOAT   0x00000010  /* ABI 0, floats in fp regs */
0044 #define EF_ARM_DYNSYMSUSESEGIDX 0x00000008  /* ABI 2 */
0045 #define EF_ARM_APCS_26      0x00000008  /* ABI 0 */
0046 #define EF_ARM_SYMSARESORTED    0x00000004  /* ABI 1,2 */
0047 #define EF_ARM_INTERWORK    0x00000004  /* ABI 0 */
0048 #define EF_ARM_HASENTRY     0x00000002  /* All */
0049 #define EF_ARM_RELEXEC      0x00000001  /* All */
0050 
0051 #define R_ARM_NONE      0
0052 #define R_ARM_PC24      1
0053 #define R_ARM_ABS32     2
0054 #define R_ARM_REL32     3
0055 #define R_ARM_CALL      28
0056 #define R_ARM_JUMP24        29
0057 #define R_ARM_TARGET1       38
0058 #define R_ARM_V4BX      40
0059 #define R_ARM_PREL31        42
0060 #define R_ARM_MOVW_ABS_NC   43
0061 #define R_ARM_MOVT_ABS      44
0062 #define R_ARM_MOVW_PREL_NC  45
0063 #define R_ARM_MOVT_PREL     46
0064 #define R_ARM_ALU_PC_G0_NC  57
0065 #define R_ARM_ALU_PC_G1_NC  59
0066 #define R_ARM_LDR_PC_G2     63
0067 
0068 #define R_ARM_THM_CALL      10
0069 #define R_ARM_THM_JUMP24    30
0070 #define R_ARM_THM_MOVW_ABS_NC   47
0071 #define R_ARM_THM_MOVT_ABS  48
0072 #define R_ARM_THM_MOVW_PREL_NC  49
0073 #define R_ARM_THM_MOVT_PREL 50
0074 
0075 /*
0076  * These are used to set parameters in the core dumps.
0077  */
0078 #define ELF_CLASS   ELFCLASS32
0079 #ifdef __ARMEB__
0080 #define ELF_DATA    ELFDATA2MSB
0081 #else
0082 #define ELF_DATA    ELFDATA2LSB
0083 #endif
0084 #define ELF_ARCH    EM_ARM
0085 
0086 /*
0087  * This yields a string that ld.so will use to load implementation
0088  * specific libraries for optimization.  This is more specific in
0089  * intent than poking at uname or /proc/cpuinfo.
0090  *
0091  * For now we just provide a fairly general string that describes the
0092  * processor family.  This could be made more specific later if someone
0093  * implemented optimisations that require it.  26-bit CPUs give you
0094  * "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't
0095  * supported).  32-bit CPUs give you "v3[lb]" for anything based on an
0096  * ARM6 or ARM7 core and "armv4[lb]" for anything based on a StrongARM-1
0097  * core.
0098  */
0099 #define ELF_PLATFORM_SIZE 8
0100 #define ELF_PLATFORM    (elf_platform)
0101 
0102 extern char elf_platform[];
0103 
0104 struct elf32_hdr;
0105 
0106 /*
0107  * This is used to ensure we don't load something for the wrong architecture.
0108  */
0109 extern int elf_check_arch(const struct elf32_hdr *);
0110 #define elf_check_arch elf_check_arch
0111 
0112 #define ELFOSABI_ARM_FDPIC  65  /* ARM FDPIC platform */
0113 #define elf_check_fdpic(x)  ((x)->e_ident[EI_OSABI] == ELFOSABI_ARM_FDPIC)
0114 #define elf_check_const_displacement(x)  ((x)->e_flags & EF_ARM_PIC)
0115 #define ELF_FDPIC_CORE_EFLAGS  0
0116 
0117 #define vmcore_elf64_check_arch(x) (0)
0118 
0119 extern int arm_elf_read_implies_exec(int);
0120 #define elf_read_implies_exec(ex,stk) arm_elf_read_implies_exec(stk)
0121 
0122 #define CORE_DUMP_USE_REGSET
0123 #define ELF_EXEC_PAGESIZE   4096
0124 
0125 /* This is the base location for PIE (ET_DYN with INTERP) loads. */
0126 #define ELF_ET_DYN_BASE     0x400000UL
0127 
0128 /* When the program starts, a1 contains a pointer to a function to be 
0129    registered with atexit, as per the SVR4 ABI.  A value of 0 means we 
0130    have no such handler.  */
0131 #define ELF_PLAT_INIT(_r, load_addr)    (_r)->ARM_r0 = 0
0132 
0133 #define ELF_FDPIC_PLAT_INIT(_r, _exec_map_addr, _interp_map_addr, dynamic_addr) \
0134     do { \
0135         (_r)->ARM_r7 = _exec_map_addr; \
0136         (_r)->ARM_r8 = _interp_map_addr; \
0137         (_r)->ARM_r9 = dynamic_addr; \
0138     } while(0)
0139 
0140 extern void elf_set_personality(const struct elf32_hdr *);
0141 #define SET_PERSONALITY(ex) elf_set_personality(&(ex))
0142 
0143 #ifdef CONFIG_MMU
0144 #ifdef CONFIG_VDSO
0145 #define ARCH_DLINFO                     \
0146 do {                                \
0147     NEW_AUX_ENT(AT_SYSINFO_EHDR,                \
0148             (elf_addr_t)current->mm->context.vdso); \
0149 } while (0)
0150 #endif
0151 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
0152 struct linux_binprm;
0153 int arch_setup_additional_pages(struct linux_binprm *, int);
0154 #endif
0155 
0156 #endif