xref: /openbmc/linux/include/linux/elf.h (revision b78412b8)
1 #ifndef _LINUX_ELF_H
2 #define _LINUX_ELF_H
3 
4 #include <asm/elf.h>
5 #include <uapi/linux/elf.h>
6 
7 #ifndef elf_read_implies_exec
8   /* Executables for which elf_read_implies_exec() returns TRUE will
9      have the READ_IMPLIES_EXEC personality flag set automatically.
10      Override in asm/elf.h as needed.  */
11 # define elf_read_implies_exec(ex, have_pt_gnu_stack)	0
12 #endif
13 #ifndef SET_PERSONALITY
14 #define SET_PERSONALITY(ex) \
15 	set_personality(PER_LINUX | (current->personality & (~PER_MASK)))
16 #endif
17 
18 #ifndef SET_PERSONALITY2
19 #define SET_PERSONALITY2(ex, state) \
20 	SET_PERSONALITY(ex)
21 #endif
22 
23 #if ELF_CLASS == ELFCLASS32
24 
25 extern Elf32_Dyn _DYNAMIC [];
26 #define elfhdr		elf32_hdr
27 #define elf_phdr	elf32_phdr
28 #define elf_shdr	elf32_shdr
29 #define elf_note	elf32_note
30 #define elf_addr_t	Elf32_Off
31 #define Elf_Half	Elf32_Half
32 #define Elf_Word	Elf32_Word
33 
34 #else
35 
36 extern Elf64_Dyn _DYNAMIC [];
37 #define elfhdr		elf64_hdr
38 #define elf_phdr	elf64_phdr
39 #define elf_shdr	elf64_shdr
40 #define elf_note	elf64_note
41 #define elf_addr_t	Elf64_Off
42 #define Elf_Half	Elf64_Half
43 #define Elf_Word	Elf64_Word
44 
45 #endif
46 
47 /* Optional callbacks to write extra ELF notes. */
48 struct file;
49 struct coredump_params;
50 
51 #ifndef ARCH_HAVE_EXTRA_ELF_NOTES
52 static inline int elf_coredump_extra_notes_size(void) { return 0; }
53 static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; }
54 #else
55 extern int elf_coredump_extra_notes_size(void);
56 extern int elf_coredump_extra_notes_write(struct coredump_params *cprm);
57 #endif
58 #endif /* _LINUX_ELF_H */
59