1 
   2 
   3 
   4 
   5 #ifndef __ASM_ELF_H
   6 #define __ASM_ELF_H
   7 
   8 #include <asm/hwcap.h>
   9 
  10 
  11 
  12 
  13 #include <asm/ptrace.h>
  14 #include <asm/user.h>
  15 
  16 
  17 
  18 
  19 
  20 
  21 #define R_ARM_NONE                      0
  22 #define R_AARCH64_NONE                  256
  23 
  24 
  25 #define R_AARCH64_ABS64                 257
  26 #define R_AARCH64_ABS32                 258
  27 #define R_AARCH64_ABS16                 259
  28 #define R_AARCH64_PREL64                260
  29 #define R_AARCH64_PREL32                261
  30 #define R_AARCH64_PREL16                262
  31 
  32 
  33 #define R_AARCH64_MOVW_UABS_G0          263
  34 #define R_AARCH64_MOVW_UABS_G0_NC       264
  35 #define R_AARCH64_MOVW_UABS_G1          265
  36 #define R_AARCH64_MOVW_UABS_G1_NC       266
  37 #define R_AARCH64_MOVW_UABS_G2          267
  38 #define R_AARCH64_MOVW_UABS_G2_NC       268
  39 #define R_AARCH64_MOVW_UABS_G3          269
  40 
  41 #define R_AARCH64_MOVW_SABS_G0          270
  42 #define R_AARCH64_MOVW_SABS_G1          271
  43 #define R_AARCH64_MOVW_SABS_G2          272
  44 
  45 #define R_AARCH64_LD_PREL_LO19          273
  46 #define R_AARCH64_ADR_PREL_LO21         274
  47 #define R_AARCH64_ADR_PREL_PG_HI21      275
  48 #define R_AARCH64_ADR_PREL_PG_HI21_NC   276
  49 #define R_AARCH64_ADD_ABS_LO12_NC       277
  50 #define R_AARCH64_LDST8_ABS_LO12_NC     278
  51 
  52 #define R_AARCH64_TSTBR14               279
  53 #define R_AARCH64_CONDBR19              280
  54 #define R_AARCH64_JUMP26                282
  55 #define R_AARCH64_CALL26                283
  56 #define R_AARCH64_LDST16_ABS_LO12_NC    284
  57 #define R_AARCH64_LDST32_ABS_LO12_NC    285
  58 #define R_AARCH64_LDST64_ABS_LO12_NC    286
  59 #define R_AARCH64_LDST128_ABS_LO12_NC   299
  60 
  61 #define R_AARCH64_MOVW_PREL_G0          287
  62 #define R_AARCH64_MOVW_PREL_G0_NC       288
  63 #define R_AARCH64_MOVW_PREL_G1          289
  64 #define R_AARCH64_MOVW_PREL_G1_NC       290
  65 #define R_AARCH64_MOVW_PREL_G2          291
  66 #define R_AARCH64_MOVW_PREL_G2_NC       292
  67 #define R_AARCH64_MOVW_PREL_G3          293
  68 
  69 #define R_AARCH64_RELATIVE              1027
  70 
  71 
  72 
  73 
  74 #define ELF_CLASS       ELFCLASS64
  75 #ifdef __AARCH64EB__
  76 #define ELF_DATA        ELFDATA2MSB
  77 #else
  78 #define ELF_DATA        ELFDATA2LSB
  79 #endif
  80 #define ELF_ARCH        EM_AARCH64
  81 
  82 
  83 
  84 
  85 
  86 
  87 #define ELF_PLATFORM_SIZE       16
  88 #ifdef __AARCH64EB__
  89 #define ELF_PLATFORM            ("aarch64_be")
  90 #else
  91 #define ELF_PLATFORM            ("aarch64")
  92 #endif
  93 
  94 
  95 
  96 
  97 #define elf_check_arch(x)               ((x)->e_machine == EM_AARCH64)
  98 
  99 #define elf_read_implies_exec(ex,stk)   (stk != EXSTACK_DISABLE_X)
 100 
 101 #define CORE_DUMP_USE_REGSET
 102 #define ELF_EXEC_PAGESIZE       PAGE_SIZE
 103 
 104 
 105 
 106 
 107 
 108 
 109 #ifdef CONFIG_ARM64_FORCE_52BIT
 110 #define ELF_ET_DYN_BASE         (2 * TASK_SIZE_64 / 3)
 111 #else
 112 #define ELF_ET_DYN_BASE         (2 * DEFAULT_MAP_WINDOW_64 / 3)
 113 #endif 
 114 
 115 #ifndef __ASSEMBLY__
 116 
 117 #include <linux/bug.h>
 118 #include <asm/processor.h> 
 119 
 120 typedef unsigned long elf_greg_t;
 121 
 122 #define ELF_NGREG (sizeof(struct user_pt_regs) / sizeof(elf_greg_t))
 123 #define ELF_CORE_COPY_REGS(dest, regs)  \
 124         *(struct user_pt_regs *)&(dest) = (regs)->user_regs;
 125 
 126 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
 127 typedef struct user_fpsimd_state elf_fpregset_t;
 128 
 129 
 130 
 131 
 132 
 133 
 134 #define ELF_PLAT_INIT(_r, load_addr)    (_r)->regs[0] = 0
 135 
 136 #define SET_PERSONALITY(ex)                                             \
 137 ({                                                                      \
 138         clear_thread_flag(TIF_32BIT);                                   \
 139         current->personality &= ~READ_IMPLIES_EXEC;                     \
 140 })
 141 
 142 
 143 #define ARCH_DLINFO                                                     \
 144 do {                                                                    \
 145         NEW_AUX_ENT(AT_SYSINFO_EHDR,                                    \
 146                     (elf_addr_t)current->mm->context.vdso);             \
 147                                                                         \
 148         
 149 
 150 
 151 
 152                                                              \
 153         if (likely(signal_minsigstksz))                                 \
 154                 NEW_AUX_ENT(AT_MINSIGSTKSZ, signal_minsigstksz);        \
 155         else                                                            \
 156                 NEW_AUX_ENT(AT_IGNORE, 0);                              \
 157 } while (0)
 158 
 159 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES
 160 struct linux_binprm;
 161 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
 162                                        int uses_interp);
 163 
 164 
 165 #ifdef CONFIG_COMPAT
 166 #define STACK_RND_MASK                  (test_thread_flag(TIF_32BIT) ? \
 167                                                 0x7ff >> (PAGE_SHIFT - 12) : \
 168                                                 0x3ffff >> (PAGE_SHIFT - 12))
 169 #else
 170 #define STACK_RND_MASK                  (0x3ffff >> (PAGE_SHIFT - 12))
 171 #endif
 172 
 173 #ifdef __AARCH64EB__
 174 #define COMPAT_ELF_PLATFORM             ("v8b")
 175 #else
 176 #define COMPAT_ELF_PLATFORM             ("v8l")
 177 #endif
 178 
 179 #ifdef CONFIG_COMPAT
 180 
 181 
 182 #define COMPAT_ELF_ET_DYN_BASE          0x000400000UL
 183 
 184 
 185 #define COMPAT_ELF_NGREG                18
 186 typedef unsigned int                    compat_elf_greg_t;
 187 typedef compat_elf_greg_t               compat_elf_gregset_t[COMPAT_ELF_NGREG];
 188 
 189 
 190 #define EF_ARM_EABI_MASK                0xff000000
 191 #define compat_elf_check_arch(x)        (system_supports_32bit_el0() && \
 192                                          ((x)->e_machine == EM_ARM) && \
 193                                          ((x)->e_flags & EF_ARM_EABI_MASK))
 194 
 195 #define compat_start_thread             compat_start_thread
 196 
 197 
 198 
 199 
 200 
 201 #define COMPAT_SET_PERSONALITY(ex)                                      \
 202 ({                                                                      \
 203         set_thread_flag(TIF_32BIT);                                     \
 204  })
 205 #ifdef CONFIG_COMPAT_VDSO
 206 #define COMPAT_ARCH_DLINFO                                              \
 207 do {                                                                    \
 208         
 209 
 210 
 211 
 212 
 213                                                              \
 214         NEW_AUX_ENT(AT_SYSINFO_EHDR,                                    \
 215                         (Elf64_Off)current->mm->context.vdso);          \
 216 } while (0)
 217 #else
 218 #define COMPAT_ARCH_DLINFO
 219 #endif
 220 extern int aarch32_setup_additional_pages(struct linux_binprm *bprm,
 221                                           int uses_interp);
 222 #define compat_arch_setup_additional_pages \
 223                                         aarch32_setup_additional_pages
 224 
 225 #endif 
 226 
 227 #endif 
 228 
 229 #endif