Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _LINUX_ELF_H |
| 2 | #define _LINUX_ELF_H |
| 3 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | #include <asm/elf.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 5 | #include <uapi/linux/elf.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | |
David Howells | 267aed9 | 2011-12-12 13:54:36 +0000 | [diff] [blame] | 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 |
Al Viro | e72837e | 2013-02-17 17:47:04 -0500 | [diff] [blame] | 13 | #ifndef SET_PERSONALITY |
| 14 | #define SET_PERSONALITY(ex) \ |
| 15 | set_personality(PER_LINUX | (current->personality & (~PER_MASK))) |
| 16 | #endif |
David Howells | 267aed9 | 2011-12-12 13:54:36 +0000 | [diff] [blame] | 17 | |
Paul Burton | 774c105 | 2014-09-11 08:30:16 +0100 | [diff] [blame] | 18 | #ifndef SET_PERSONALITY2 |
| 19 | #define SET_PERSONALITY2(ex, state) \ |
| 20 | SET_PERSONALITY(ex) |
| 21 | #endif |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #if ELF_CLASS == ELFCLASS32 |
| 24 | |
| 25 | extern Elf32_Dyn _DYNAMIC []; |
| 26 | #define elfhdr elf32_hdr |
| 27 | #define elf_phdr elf32_phdr |
Daisuke HATAYAMA | 8d9032b | 2010-03-05 13:44:10 -0800 | [diff] [blame] | 28 | #define elf_shdr elf32_shdr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | #define elf_note elf32_note |
Magnus Damm | 386d9a7 | 2006-12-06 20:37:53 -0800 | [diff] [blame] | 30 | #define elf_addr_t Elf32_Off |
Daisuke HATAYAMA | 1fcccba | 2010-03-05 13:44:07 -0800 | [diff] [blame] | 31 | #define Elf_Half Elf32_Half |
Hari Bathini | 51dbd92 | 2017-05-08 15:56:21 -0700 | [diff] [blame] | 32 | #define Elf_Word Elf32_Word |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 33 | |
| 34 | #else |
| 35 | |
| 36 | extern Elf64_Dyn _DYNAMIC []; |
| 37 | #define elfhdr elf64_hdr |
| 38 | #define elf_phdr elf64_phdr |
Daisuke HATAYAMA | 8d9032b | 2010-03-05 13:44:10 -0800 | [diff] [blame] | 39 | #define elf_shdr elf64_shdr |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | #define elf_note elf64_note |
Magnus Damm | 386d9a7 | 2006-12-06 20:37:53 -0800 | [diff] [blame] | 41 | #define elf_addr_t Elf64_Off |
Daisuke HATAYAMA | 1fcccba | 2010-03-05 13:44:07 -0800 | [diff] [blame] | 42 | #define Elf_Half Elf64_Half |
Hari Bathini | 51dbd92 | 2017-05-08 15:56:21 -0700 | [diff] [blame] | 43 | #define Elf_Word Elf64_Word |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | |
| 45 | #endif |
| 46 | |
Michael Ellerman | e550149 | 2007-09-19 14:38:12 +1000 | [diff] [blame] | 47 | /* Optional callbacks to write extra ELF notes. */ |
David Howells | 267aed9 | 2011-12-12 13:54:36 +0000 | [diff] [blame] | 48 | struct file; |
Al Viro | cdc3d56 | 2013-10-05 22:24:29 -0400 | [diff] [blame] | 49 | struct coredump_params; |
David Howells | 267aed9 | 2011-12-12 13:54:36 +0000 | [diff] [blame] | 50 | |
Dwayne Grant McConnell | bf1ab97 | 2006-11-23 00:46:37 +0100 | [diff] [blame] | 51 | #ifndef ARCH_HAVE_EXTRA_ELF_NOTES |
Michael Ellerman | e550149 | 2007-09-19 14:38:12 +1000 | [diff] [blame] | 52 | static inline int elf_coredump_extra_notes_size(void) { return 0; } |
Al Viro | cdc3d56 | 2013-10-05 22:24:29 -0400 | [diff] [blame] | 53 | static inline int elf_coredump_extra_notes_write(struct coredump_params *cprm) { return 0; } |
Michael Ellerman | e550149 | 2007-09-19 14:38:12 +1000 | [diff] [blame] | 54 | #else |
| 55 | extern int elf_coredump_extra_notes_size(void); |
Al Viro | cdc3d56 | 2013-10-05 22:24:29 -0400 | [diff] [blame] | 56 | extern int elf_coredump_extra_notes_write(struct coredump_params *cprm); |
Michael Ellerman | e550149 | 2007-09-19 14:38:12 +1000 | [diff] [blame] | 57 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | #endif /* _LINUX_ELF_H */ |