| .. | .. |
|---|
| 2 | 2 | #ifndef _LINUX_ELF_H |
|---|
| 3 | 3 | #define _LINUX_ELF_H |
|---|
| 4 | 4 | |
|---|
| 5 | +#include <linux/types.h> |
|---|
| 5 | 6 | #include <asm/elf.h> |
|---|
| 6 | 7 | #include <uapi/linux/elf.h> |
|---|
| 7 | 8 | |
|---|
| .. | .. |
|---|
| 21 | 22 | SET_PERSONALITY(ex) |
|---|
| 22 | 23 | #endif |
|---|
| 23 | 24 | |
|---|
| 25 | +#define ELF32_GNU_PROPERTY_ALIGN 4 |
|---|
| 26 | +#define ELF64_GNU_PROPERTY_ALIGN 8 |
|---|
| 27 | + |
|---|
| 24 | 28 | #if ELF_CLASS == ELFCLASS32 |
|---|
| 25 | 29 | |
|---|
| 26 | 30 | extern Elf32_Dyn _DYNAMIC []; |
|---|
| .. | .. |
|---|
| 31 | 35 | #define elf_addr_t Elf32_Off |
|---|
| 32 | 36 | #define Elf_Half Elf32_Half |
|---|
| 33 | 37 | #define Elf_Word Elf32_Word |
|---|
| 38 | +#define ELF_GNU_PROPERTY_ALIGN ELF32_GNU_PROPERTY_ALIGN |
|---|
| 34 | 39 | |
|---|
| 35 | 40 | #else |
|---|
| 36 | 41 | |
|---|
| .. | .. |
|---|
| 42 | 47 | #define elf_addr_t Elf64_Off |
|---|
| 43 | 48 | #define Elf_Half Elf64_Half |
|---|
| 44 | 49 | #define Elf_Word Elf64_Word |
|---|
| 50 | +#define ELF_GNU_PROPERTY_ALIGN ELF64_GNU_PROPERTY_ALIGN |
|---|
| 45 | 51 | |
|---|
| 46 | 52 | #endif |
|---|
| 47 | 53 | |
|---|
| .. | .. |
|---|
| 56 | 62 | extern int elf_coredump_extra_notes_size(void); |
|---|
| 57 | 63 | extern int elf_coredump_extra_notes_write(struct coredump_params *cprm); |
|---|
| 58 | 64 | #endif |
|---|
| 65 | + |
|---|
| 66 | +/* |
|---|
| 67 | + * NT_GNU_PROPERTY_TYPE_0 header: |
|---|
| 68 | + * Keep this internal until/unless there is an agreed UAPI definition. |
|---|
| 69 | + * pr_type values (GNU_PROPERTY_*) are public and defined in the UAPI header. |
|---|
| 70 | + */ |
|---|
| 71 | +struct gnu_property { |
|---|
| 72 | + u32 pr_type; |
|---|
| 73 | + u32 pr_datasz; |
|---|
| 74 | +}; |
|---|
| 75 | + |
|---|
| 76 | +struct arch_elf_state; |
|---|
| 77 | + |
|---|
| 78 | +#ifndef CONFIG_ARCH_USE_GNU_PROPERTY |
|---|
| 79 | +static inline int arch_parse_elf_property(u32 type, const void *data, |
|---|
| 80 | + size_t datasz, bool compat, |
|---|
| 81 | + struct arch_elf_state *arch) |
|---|
| 82 | +{ |
|---|
| 83 | + return 0; |
|---|
| 84 | +} |
|---|
| 85 | +#else |
|---|
| 86 | +extern int arch_parse_elf_property(u32 type, const void *data, size_t datasz, |
|---|
| 87 | + bool compat, struct arch_elf_state *arch); |
|---|
| 88 | +#endif |
|---|
| 89 | + |
|---|
| 90 | +#ifdef CONFIG_ARCH_HAVE_ELF_PROT |
|---|
| 91 | +int arch_elf_adjust_prot(int prot, const struct arch_elf_state *state, |
|---|
| 92 | + bool has_interp, bool is_interp); |
|---|
| 93 | +#else |
|---|
| 94 | +static inline int arch_elf_adjust_prot(int prot, |
|---|
| 95 | + const struct arch_elf_state *state, |
|---|
| 96 | + bool has_interp, bool is_interp) |
|---|
| 97 | +{ |
|---|
| 98 | + return prot; |
|---|
| 99 | +} |
|---|
| 100 | +#endif |
|---|
| 101 | + |
|---|
| 59 | 102 | #endif /* _LINUX_ELF_H */ |
|---|