aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/elf.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-sh/elf.h')
-rw-r--r--include/asm-sh/elf.h53
1 files changed, 52 insertions, 1 deletions
diff --git a/include/asm-sh/elf.h b/include/asm-sh/elf.h
index 05092da1aa59..f01449a8d378 100644
--- a/include/asm-sh/elf.h
+++ b/include/asm-sh/elf.h
@@ -1,10 +1,15 @@
1#ifndef __ASM_SH_ELF_H 1#ifndef __ASM_SH_ELF_H
2#define __ASM_SH_ELF_H 2#define __ASM_SH_ELF_H
3 3
4#include <linux/utsname.h>
4#include <asm/auxvec.h> 5#include <asm/auxvec.h>
5#include <asm/ptrace.h> 6#include <asm/ptrace.h>
6#include <asm/user.h> 7#include <asm/user.h>
7 8
9/* ELF header e_flags defines */
10#define EF_SH_PIC 0x100 /* -fpic */
11#define EF_SH_FDPIC 0x8000 /* -mfdpic */
12
8/* SH (particularly SHcompact) relocation types */ 13/* SH (particularly SHcompact) relocation types */
9#define R_SH_NONE 0 14#define R_SH_NONE 0
10#define R_SH_DIR32 1 15#define R_SH_DIR32 1
@@ -43,6 +48,28 @@
43#define R_SH_RELATIVE 165 48#define R_SH_RELATIVE 165
44#define R_SH_GOTOFF 166 49#define R_SH_GOTOFF 166
45#define R_SH_GOTPC 167 50#define R_SH_GOTPC 167
51
52/* FDPIC relocs */
53#define R_SH_GOT20 70
54#define R_SH_GOTOFF20 71
55#define R_SH_GOTFUNCDESC 72
56#define R_SH_GOTFUNCDESC20 73
57#define R_SH_GOTOFFFUNCDESC 74
58#define R_SH_GOTOFFFUNCDESC20 75
59#define R_SH_FUNCDESC 76
60#define R_SH_FUNCDESC_VALUE 77
61
62#if 0 /* XXX - later .. */
63#define R_SH_GOT20 198
64#define R_SH_GOTOFF20 199
65#define R_SH_GOTFUNCDESC 200
66#define R_SH_GOTFUNCDESC20 201
67#define R_SH_GOTOFFFUNCDESC 202
68#define R_SH_GOTOFFFUNCDESC20 203
69#define R_SH_FUNCDESC 204
70#define R_SH_FUNCDESC_VALUE 205
71#endif
72
46/* SHmedia relocs */ 73/* SHmedia relocs */
47#define R_SH_IMM_LOW16 246 74#define R_SH_IMM_LOW16 246
48#define R_SH_IMM_LOW16_PCREL 247 75#define R_SH_IMM_LOW16_PCREL 247
@@ -77,9 +104,12 @@ typedef struct user_fpu_struct elf_fpregset_t;
77/* 104/*
78 * This is used to ensure we don't load something for the wrong architecture. 105 * This is used to ensure we don't load something for the wrong architecture.
79 */ 106 */
80#define elf_check_arch(x) ( (x)->e_machine == EM_SH ) 107#define elf_check_arch(x) ((x)->e_machine == EM_SH)
108#define elf_check_fdpic(x) ((x)->e_flags & EF_SH_FDPIC)
109#define elf_check_const_displacement(x) ((x)->e_flags & EF_SH_PIC)
81 110
82#define USE_ELF_CORE_DUMP 111#define USE_ELF_CORE_DUMP
112#define ELF_FDPIC_CORE_EFLAGS EF_SH_FDPIC
83#define ELF_EXEC_PAGESIZE PAGE_SIZE 113#define ELF_EXEC_PAGESIZE PAGE_SIZE
84 114
85/* This is the location that an ET_DYN program is loaded if exec'ed. Typical 115/* This is the location that an ET_DYN program is loaded if exec'ed. Typical
@@ -136,6 +166,27 @@ typedef struct user_fpu_struct elf_fpregset_t;
136 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \ 166 _r->regs[8]=0; _r->regs[9]=0; _r->regs[10]=0; _r->regs[11]=0; \
137 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \ 167 _r->regs[12]=0; _r->regs[13]=0; _r->regs[14]=0; \
138 _r->sr = SR_FD; } while (0) 168 _r->sr = SR_FD; } while (0)
169
170#define ELF_FDPIC_PLAT_INIT(_r, _exec_map_addr, _interp_map_addr, \
171 _dynamic_addr) \
172do { \
173 _r->regs[0] = 0; \
174 _r->regs[1] = 0; \
175 _r->regs[2] = 0; \
176 _r->regs[3] = 0; \
177 _r->regs[4] = 0; \
178 _r->regs[5] = 0; \
179 _r->regs[6] = 0; \
180 _r->regs[7] = 0; \
181 _r->regs[8] = _exec_map_addr; \
182 _r->regs[9] = _interp_map_addr; \
183 _r->regs[10] = _dynamic_addr; \
184 _r->regs[11] = 0; \
185 _r->regs[12] = 0; \
186 _r->regs[13] = 0; \
187 _r->regs[14] = 0; \
188 _r->sr = SR_FD; \
189} while (0)
139#endif 190#endif
140 191
141#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT) 192#define SET_PERSONALITY(ex, ibcs2) set_personality(PER_LINUX_32BIT)