Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming
[sfrench/cifs-2.6.git] / arch / csky / include / asm / elf.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 // Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd.
3
4 #ifndef __ASM_CSKY_ELF_H
5 #define __ASM_CSKY_ELF_H
6
7 #include <asm/ptrace.h>
8 #include <abi/regdef.h>
9
10 #define ELF_ARCH 252
11
12 /* CSKY Relocations */
13 #define R_CSKY_NONE               0
14 #define R_CSKY_32                 1
15 #define R_CSKY_PCIMM8BY4          2
16 #define R_CSKY_PCIMM11BY2         3
17 #define R_CSKY_PCIMM4BY2          4
18 #define R_CSKY_PC32               5
19 #define R_CSKY_PCRELJSR_IMM11BY2  6
20 #define R_CSKY_GNU_VTINHERIT      7
21 #define R_CSKY_GNU_VTENTRY        8
22 #define R_CSKY_RELATIVE           9
23 #define R_CSKY_COPY               10
24 #define R_CSKY_GLOB_DAT           11
25 #define R_CSKY_JUMP_SLOT          12
26 #define R_CSKY_ADDR_HI16          24
27 #define R_CSKY_ADDR_LO16          25
28 #define R_CSKY_PCRELJSR_IMM26BY2  40
29
30 typedef unsigned long elf_greg_t;
31
32 typedef struct user_fp elf_fpregset_t;
33
34 #define ELF_NGREG (sizeof(struct pt_regs) / sizeof(elf_greg_t))
35
36 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
37
38 /*
39  * This is used to ensure we don't load something for the wrong architecture.
40  */
41 #define elf_check_arch(x) ((x)->e_machine == ELF_ARCH)
42
43 /*
44  * These are used to set parameters in the core dumps.
45  */
46 #define USE_ELF_CORE_DUMP
47 #define ELF_EXEC_PAGESIZE               4096
48 #define ELF_CLASS                       ELFCLASS32
49 #define ELF_PLAT_INIT(_r, load_addr)    { _r->a0 = 0; }
50
51 #ifdef __cskyBE__
52 #define ELF_DATA        ELFDATA2MSB
53 #else
54 #define ELF_DATA        ELFDATA2LSB
55 #endif
56
57 /*
58  * This is the location that an ET_DYN program is loaded if exec'ed. Typical
59  * use of this is to invoke "./ld.so someprog" to test out a new version of
60  * the loader.  We need to make sure that it is out of the way of the program
61  * that it will "exec", and that there is sufficient room for the brk.
62  */
63 #define ELF_ET_DYN_BASE 0x0UL
64 #include <abi/elf.h>
65
66 /* Similar, but for a thread other than current. */
67 struct task_struct;
68 extern int dump_task_regs(struct task_struct *tsk, elf_gregset_t *elf_regs);
69 #define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
70
71 #define ELF_HWCAP       (0)
72
73 /*
74  * This yields a string that ld.so will use to load implementation specific
75  * libraries for optimization. This is more specific in intent than poking
76  * at uname or /proc/cpuinfo.
77  */
78 #define ELF_PLATFORM            (NULL)
79 #define SET_PERSONALITY(ex)     set_personality(PER_LINUX)
80
81 #define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
82 struct linux_binprm;
83 extern int arch_setup_additional_pages(struct linux_binprm *bprm,
84                                        int uses_interp);
85 #endif /* __ASM_CSKY_ELF_H */