1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include <linux/elfcore-compat.h>
21#include <linux/time.h>
22
23
24
25
26#undef ELF_CLASS
27#define ELF_CLASS ELFCLASS32
28
29#undef elfhdr
30#undef elf_phdr
31#undef elf_note
32#undef elf_addr_t
33#define elfhdr elf32_hdr
34#define elf_phdr elf32_phdr
35#define elf_note elf32_note
36#define elf_addr_t Elf32_Addr
37
38
39
40
41
42#define elf_prstatus compat_elf_prstatus
43#define elf_prpsinfo compat_elf_prpsinfo
44
45
46
47
48
49static void cputime_to_compat_timeval(const cputime_t cputime,
50 struct compat_timeval *value)
51{
52 struct timeval tv;
53 cputime_to_timeval(cputime, &tv);
54 value->tv_sec = tv.tv_sec;
55 value->tv_usec = tv.tv_usec;
56}
57
58#undef cputime_to_timeval
59#define cputime_to_timeval cputime_to_compat_timeval
60
61
62
63
64
65
66
67
68#undef ELF_ARCH
69#undef elf_check_arch
70#define elf_check_arch compat_elf_check_arch
71
72#ifdef COMPAT_ELF_PLATFORM
73#undef ELF_PLATFORM
74#define ELF_PLATFORM COMPAT_ELF_PLATFORM
75#endif
76
77#ifdef COMPAT_ELF_HWCAP
78#undef ELF_HWCAP
79#define ELF_HWCAP COMPAT_ELF_HWCAP
80#endif
81
82#ifdef COMPAT_ARCH_DLINFO
83#undef ARCH_DLINFO
84#define ARCH_DLINFO COMPAT_ARCH_DLINFO
85#endif
86
87#ifdef COMPAT_ELF_ET_DYN_BASE
88#undef ELF_ET_DYN_BASE
89#define ELF_ET_DYN_BASE COMPAT_ELF_ET_DYN_BASE
90#endif
91
92#ifdef COMPAT_ELF_EXEC_PAGESIZE
93#undef ELF_EXEC_PAGESIZE
94#define ELF_EXEC_PAGESIZE COMPAT_ELF_EXEC_PAGESIZE
95#endif
96
97#ifdef COMPAT_ELF_PLAT_INIT
98#undef ELF_PLAT_INIT
99#define ELF_PLAT_INIT COMPAT_ELF_PLAT_INIT
100#endif
101
102#ifdef COMPAT_SET_PERSONALITY
103#undef SET_PERSONALITY
104#define SET_PERSONALITY COMPAT_SET_PERSONALITY
105#endif
106
107#ifdef compat_start_thread
108#undef start_thread
109#define start_thread compat_start_thread
110#endif
111
112#ifdef compat_arch_setup_additional_pages
113#undef ARCH_HAS_SETUP_ADDITIONAL_PAGES
114#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
115#undef arch_setup_additional_pages
116#define arch_setup_additional_pages compat_arch_setup_additional_pages
117#endif
118
119
120
121
122
123
124#define elf_format compat_elf_format
125#define init_elf_binfmt init_compat_elf_binfmt
126#define exit_elf_binfmt exit_compat_elf_binfmt
127
128
129
130
131#include "binfmt_elf.c"