History

Use _WIN32 for a windows hosted tcc and define it for the PE target.

grischka committed 18 years ago

Commit 34140dd1 parent b0d40c14 files · +1534 −1530Browse files

Unified · Split

4 files
  1. alloca86-bt.S +2 −2
  2. elf.h +957 −957
  3. tcc.c +52 −48
  4. tccpe.c +523 −523
alloca86-bt.S+2−2
@@ -1,9 +1,9 @@
11 /* ---------------------------------------------- */
22 /* alloca86b.S */
33
4−.globl __bound___alloca
4+.globl __bound__alloca
55
6−__bound___alloca:
6+__bound__alloca:
77 pop %edx
88 pop %eax
99 mov %eax, %ecx
elf.h+957−957
@@ -19,23 +19,23 @@ · 18 unmodified lines
1919 Boston, MA 02111-1307, USA. */
2020
2121 #ifndef _ELF_H
22−#define _ELF_H 1
22+#define _ELF_H 1
2323
24−#ifndef WIN32
24+#ifndef _WIN32
2525 #include <inttypes.h>
2626 #else
2727 #ifndef __int8_t_defined
2828 #define __int8_t_defined
2929 typedef signed char int8_t;
30−typedef short int int16_t;
31−typedef int int32_t;
30+typedef short int int16_t;
31+typedef int int32_t;
3232 typedef long long int int64_t;
3333 #endif
3434
35−typedef unsigned char uint8_t;
36−typedef unsigned short int uint16_t;
37−typedef unsigned int uint32_t;
38−typedef unsigned long long int uint64_t;
35+typedef unsigned char uint8_t;
36+typedef unsigned short int uint16_t;
37+typedef unsigned int uint32_t;
38+typedef unsigned long long int uint64_t;
3939 #endif
4040
4141 /* Standard ELF types. */
@@ -46,15 +46,15 @@ typedef uint16_t Elf64_Half; · 4 unmodified lines
4646
4747 /* Types for signed and unsigned 32-bit quantities. */
4848 typedef uint32_t Elf32_Word;
49−typedef int32_t Elf32_Sword;
49+typedef int32_t Elf32_Sword;
5050 typedef uint32_t Elf64_Word;
51−typedef int32_t Elf64_Sword;
51+typedef int32_t Elf64_Sword;
5252
5353 /* Types for signed and unsigned 64-bit quantities. */
5454 typedef uint64_t Elf32_Xword;
55−typedef int64_t Elf32_Sxword;
55+typedef int64_t Elf32_Sxword;
5656 typedef uint64_t Elf64_Xword;
57−typedef int64_t Elf64_Sxword;
57+typedef int64_t Elf64_Sxword;
5858
5959 /* Type of addresses. */
6060 typedef uint32_t Elf32_Addr;
@@ -79,251 +79,251 @@ typedef uint64_t Elf64_Symndx; · 18 unmodified lines
7979
8080 typedef struct
8181 {
82− unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
83− Elf32_Half e_type; /* Object file type */
84− Elf32_Half e_machine; /* Architecture */
85− Elf32_Word e_version; /* Object file version */
86− Elf32_Addr e_entry; /* Entry point virtual address */
87− Elf32_Off e_phoff; /* Program header table file offset */
88− Elf32_Off e_shoff; /* Section header table file offset */
89− Elf32_Word e_flags; /* Processor-specific flags */
90− Elf32_Half e_ehsize; /* ELF header size in bytes */
91− Elf32_Half e_phentsize; /* Program header table entry size */
92− Elf32_Half e_phnum; /* Program header table entry count */
93− Elf32_Half e_shentsize; /* Section header table entry size */
94− Elf32_Half e_shnum; /* Section header table entry count */
95− Elf32_Half e_shstrndx; /* Section header string table index */
82+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
83+ Elf32_Half e_type; /* Object file type */
84+ Elf32_Half e_machine; /* Architecture */
85+ Elf32_Word e_version; /* Object file version */
86+ Elf32_Addr e_entry; /* Entry point virtual address */
87+ Elf32_Off e_phoff; /* Program header table file offset */
88+ Elf32_Off e_shoff; /* Section header table file offset */
89+ Elf32_Word e_flags; /* Processor-specific flags */
90+ Elf32_Half e_ehsize; /* ELF header size in bytes */
91+ Elf32_Half e_phentsize; /* Program header table entry size */
92+ Elf32_Half e_phnum; /* Program header table entry count */
93+ Elf32_Half e_shentsize; /* Section header table entry size */
94+ Elf32_Half e_shnum; /* Section header table entry count */
95+ Elf32_Half e_shstrndx; /* Section header string table index */
9696 } Elf32_Ehdr;
9797
9898 typedef struct
9999 {
100− unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
101− Elf64_Half e_type; /* Object file type */
102− Elf64_Half e_machine; /* Architecture */
103− Elf64_Word e_version; /* Object file version */
104− Elf64_Addr e_entry; /* Entry point virtual address */
105− Elf64_Off e_phoff; /* Program header table file offset */
106− Elf64_Off e_shoff; /* Section header table file offset */
107− Elf64_Word e_flags; /* Processor-specific flags */
108− Elf64_Half e_ehsize; /* ELF header size in bytes */
109− Elf64_Half e_phentsize; /* Program header table entry size */
110− Elf64_Half e_phnum; /* Program header table entry count */
111− Elf64_Half e_shentsize; /* Section header table entry size */
112− Elf64_Half e_shnum; /* Section header table entry count */
113− Elf64_Half e_shstrndx; /* Section header string table index */
100+ unsigned char e_ident[EI_NIDENT]; /* Magic number and other info */
101+ Elf64_Half e_type; /* Object file type */
102+ Elf64_Half e_machine; /* Architecture */
103+ Elf64_Word e_version; /* Object file version */
104+ Elf64_Addr e_entry; /* Entry point virtual address */
105+ Elf64_Off e_phoff; /* Program header table file offset */
106+ Elf64_Off e_shoff; /* Section header table file offset */
107+ Elf64_Word e_flags; /* Processor-specific flags */
108+ Elf64_Half e_ehsize; /* ELF header size in bytes */
109+ Elf64_Half e_phentsize; /* Program header table entry size */
110+ Elf64_Half e_phnum; /* Program header table entry count */
111+ Elf64_Half e_shentsize; /* Section header table entry size */
112+ Elf64_Half e_shnum; /* Section header table entry count */
113+ Elf64_Half e_shstrndx; /* Section header string table index */
114114 } Elf64_Ehdr;
115115
116116 /* Fields in the e_ident array. The EI_* macros are indices into the
117117 array. The macros under each EI_* macro are the values the byte
118118 may have. */
119119
120−#define EI_MAG0 0 /* File identification byte 0 index */
121−#define ELFMAG0 0x7f /* Magic number byte 0 */
120+#define EI_MAG0 0 /* File identification byte 0 index */
121+#define ELFMAG0 0x7f /* Magic number byte 0 */
122122
123−#define EI_MAG1 1 /* File identification byte 1 index */
124−#define ELFMAG1 'E' /* Magic number byte 1 */
123+#define EI_MAG1 1 /* File identification byte 1 index */
124+#define ELFMAG1 'E' /* Magic number byte 1 */
125125
126−#define EI_MAG2 2 /* File identification byte 2 index */
127−#define ELFMAG2 'L' /* Magic number byte 2 */
126+#define EI_MAG2 2 /* File identification byte 2 index */
127+#define ELFMAG2 'L' /* Magic number byte 2 */
128128
129−#define EI_MAG3 3 /* File identification byte 3 index */
130−#define ELFMAG3 'F' /* Magic number byte 3 */
129+#define EI_MAG3 3 /* File identification byte 3 index */
130+#define ELFMAG3 'F' /* Magic number byte 3 */
131131
132132 /* Conglomeration of the identification bytes, for easy testing as a word. */
133−#define ELFMAG "\177ELF"
134−#define SELFMAG 4
135−
136−#define EI_CLASS 4 /* File class byte index */
137−#define ELFCLASSNONE 0 /* Invalid class */
138−#define ELFCLASS32 1 /* 32-bit objects */
139−#define ELFCLASS64 2 /* 64-bit objects */
140−#define ELFCLASSNUM 3
141−
142−#define EI_DATA 5 /* Data encoding byte index */
143−#define ELFDATANONE 0 /* Invalid data encoding */
144−#define ELFDATA2LSB 1 /* 2's complement, little endian */
145−#define ELFDATA2MSB 2 /* 2's complement, big endian */
146−#define ELFDATANUM 3
147−
148−#define EI_VERSION 6 /* File version byte index */
149− /* Value must be EV_CURRENT */
150−
151−#define EI_OSABI 7 /* OS ABI identification */
152−#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
153−#define ELFOSABI_HPUX 1 /* HP-UX */
133+#define ELFMAG "\177ELF"
134+#define SELFMAG 4
135+
136+#define EI_CLASS 4 /* File class byte index */
137+#define ELFCLASSNONE 0 /* Invalid class */
138+#define ELFCLASS32 1 /* 32-bit objects */
139+#define ELFCLASS64 2 /* 64-bit objects */
140+#define ELFCLASSNUM 3
141+
142+#define EI_DATA 5 /* Data encoding byte index */
143+#define ELFDATANONE 0 /* Invalid data encoding */
144+#define ELFDATA2LSB 1 /* 2's complement, little endian */
145+#define ELFDATA2MSB 2 /* 2's complement, big endian */
146+#define ELFDATANUM 3
147+
148+#define EI_VERSION 6 /* File version byte index */
149+ /* Value must be EV_CURRENT */
150+
151+#define EI_OSABI 7 /* OS ABI identification */
152+#define ELFOSABI_SYSV 0 /* UNIX System V ABI */
153+#define ELFOSABI_HPUX 1 /* HP-UX */
154154 #define ELFOSABI_FREEBSD 9 /* Free BSD */
155−#define ELFOSABI_ARM 97 /* ARM */
156−#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
155+#define ELFOSABI_ARM 97 /* ARM */
156+#define ELFOSABI_STANDALONE 255 /* Standalone (embedded) application */
157157
158−#define EI_ABIVERSION 8 /* ABI version */
158+#define EI_ABIVERSION 8 /* ABI version */
159159
160−#define EI_PAD 9 /* Byte index of padding bytes */
160+#define EI_PAD 9 /* Byte index of padding bytes */
161161
162162 /* Legal values for e_type (object file type). */
163163
164−#define ET_NONE 0 /* No file type */
165−#define ET_REL 1 /* Relocatable file */
166−#define ET_EXEC 2 /* Executable file */
167−#define ET_DYN 3 /* Shared object file */
168−#define ET_CORE 4 /* Core file */
169−#define ET_NUM 5 /* Number of defined types */
170−#define ET_LOPROC 0xff00 /* Processor-specific */
171−#define ET_HIPROC 0xffff /* Processor-specific */
164+#define ET_NONE 0 /* No file type */
165+#define ET_REL 1 /* Relocatable file */
166+#define ET_EXEC 2 /* Executable file */
167+#define ET_DYN 3 /* Shared object file */
168+#define ET_CORE 4 /* Core file */
169+#define ET_NUM 5 /* Number of defined types */
170+#define ET_LOPROC 0xff00 /* Processor-specific */
171+#define ET_HIPROC 0xffff /* Processor-specific */
172172
173173 /* Legal values for e_machine (architecture). */
174174
175−#define EM_NONE 0 /* No machine */
176−#define EM_M32 1 /* AT&T WE 32100 */
177−#define EM_SPARC 2 /* SUN SPARC */
178−#define EM_386 3 /* Intel 80386 */
179−#define EM_68K 4 /* Motorola m68k family */
180−#define EM_88K 5 /* Motorola m88k family */
181−#define EM_486 6 /* Intel 80486 */
182−#define EM_860 7 /* Intel 80860 */
183−#define EM_MIPS 8 /* MIPS R3000 big-endian */
184−#define EM_S370 9 /* Amdahl */
185−#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
186−#define EM_RS6000 11 /* RS6000 */
187−
188−#define EM_PARISC 15 /* HPPA */
189−#define EM_nCUBE 16 /* nCUBE */
190−#define EM_VPP500 17 /* Fujitsu VPP500 */
191−#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
192−#define EM_960 19 /* Intel 80960 */
193−#define EM_PPC 20 /* PowerPC */
194−
195−#define EM_V800 36 /* NEC V800 series */
196−#define EM_FR20 37 /* Fujitsu FR20 */
197−#define EM_RH32 38 /* TRW RH32 */
198−#define EM_MMA 39 /* Fujitsu MMA */
199−#define EM_ARM 40 /* ARM */
200−#define EM_FAKE_ALPHA 41 /* Digital Alpha */
201−#define EM_SH 42 /* Hitachi SH */
202−#define EM_SPARCV9 43 /* SPARC v9 64-bit */
203−#define EM_TRICORE 44 /* Siemens Tricore */
204−#define EM_ARC 45 /* Argonaut RISC Core */
205−#define EM_H8_300 46 /* Hitachi H8/300 */
206−#define EM_H8_300H 47 /* Hitachi H8/300H */
207−#define EM_H8S 48 /* Hitachi H8S */
208−#define EM_H8_500 49 /* Hitachi H8/500 */
209−#define EM_IA_64 50 /* Intel Merced */
210−#define EM_MIPS_X 51 /* Stanford MIPS-X */
211−#define EM_COLDFIRE 52 /* Motorola Coldfire */
212−#define EM_68HC12 53 /* Motorola M68HC12 */
213−#define EM_NUM 54
175+#define EM_NONE 0 /* No machine */
176+#define EM_M32 1 /* AT&T WE 32100 */
177+#define EM_SPARC 2 /* SUN SPARC */
178+#define EM_386 3 /* Intel 80386 */
179+#define EM_68K 4 /* Motorola m68k family */
180+#define EM_88K 5 /* Motorola m88k family */
181+#define EM_486 6 /* Intel 80486 */
182+#define EM_860 7 /* Intel 80860 */
183+#define EM_MIPS 8 /* MIPS R3000 big-endian */
184+#define EM_S370 9 /* Amdahl */
185+#define EM_MIPS_RS4_BE 10 /* MIPS R4000 big-endian */
186+#define EM_RS6000 11 /* RS6000 */
187+
188+#define EM_PARISC 15 /* HPPA */
189+#define EM_nCUBE 16 /* nCUBE */
190+#define EM_VPP500 17 /* Fujitsu VPP500 */
191+#define EM_SPARC32PLUS 18 /* Sun's "v8plus" */
192+#define EM_960 19 /* Intel 80960 */
193+#define EM_PPC 20 /* PowerPC */
194+
195+#define EM_V800 36 /* NEC V800 series */
196+#define EM_FR20 37 /* Fujitsu FR20 */
197+#define EM_RH32 38 /* TRW RH32 */
198+#define EM_MMA 39 /* Fujitsu MMA */
199+#define EM_ARM 40 /* ARM */
200+#define EM_FAKE_ALPHA 41 /* Digital Alpha */
201+#define EM_SH 42 /* Hitachi SH */
202+#define EM_SPARCV9 43 /* SPARC v9 64-bit */
203+#define EM_TRICORE 44 /* Siemens Tricore */
204+#define EM_ARC 45 /* Argonaut RISC Core */
205+#define EM_H8_300 46 /* Hitachi H8/300 */
206+#define EM_H8_300H 47 /* Hitachi H8/300H */
207+#define EM_H8S 48 /* Hitachi H8S */
208+#define EM_H8_500 49 /* Hitachi H8/500 */
209+#define EM_IA_64 50 /* Intel Merced */
210+#define EM_MIPS_X 51 /* Stanford MIPS-X */
211+#define EM_COLDFIRE 52 /* Motorola Coldfire */
212+#define EM_68HC12 53 /* Motorola M68HC12 */
213+#define EM_NUM 54
214214
215215 /* If it is necessary to assign new unofficial EM_* values, please
216216 pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
217217 chances of collision with official or non-GNU unofficial values. */
218218
219−#define EM_ALPHA 0x9026
219+#define EM_ALPHA 0x9026
220220 #define EM_C60 0x9c60
221221
222222 /* Legal values for e_version (version). */
223223
224−#define EV_NONE 0 /* Invalid ELF version */
225−#define EV_CURRENT 1 /* Current version */
226−#define EV_NUM 2
224+#define EV_NONE 0 /* Invalid ELF version */
225+#define EV_CURRENT 1 /* Current version */
226+#define EV_NUM 2
227227
228228 /* Section header. */
229229
230230 typedef struct
231231 {
232− Elf32_Word sh_name; /* Section name (string tbl index) */
233− Elf32_Word sh_type; /* Section type */
234− Elf32_Word sh_flags; /* Section flags */
235− Elf32_Addr sh_addr; /* Section virtual addr at execution */
236− Elf32_Off sh_offset; /* Section file offset */
237− Elf32_Word sh_size; /* Section size in bytes */
238− Elf32_Word sh_link; /* Link to another section */
239− Elf32_Word sh_info; /* Additional section information */
240− Elf32_Word sh_addralign; /* Section alignment */
241− Elf32_Word sh_entsize; /* Entry size if section holds table */
232+ Elf32_Word sh_name; /* Section name (string tbl index) */
233+ Elf32_Word sh_type; /* Section type */
234+ Elf32_Word sh_flags; /* Section flags */
235+ Elf32_Addr sh_addr; /* Section virtual addr at execution */
236+ Elf32_Off sh_offset; /* Section file offset */
237+ Elf32_Word sh_size; /* Section size in bytes */
238+ Elf32_Word sh_link; /* Link to another section */
239+ Elf32_Word sh_info; /* Additional section information */
240+ Elf32_Word sh_addralign; /* Section alignment */
241+ Elf32_Word sh_entsize; /* Entry size if section holds table */
242242 } Elf32_Shdr;
243243
244244 typedef struct
245245 {
246− Elf64_Word sh_name; /* Section name (string tbl index) */
247− Elf64_Word sh_type; /* Section type */
248− Elf64_Xword sh_flags; /* Section flags */
249− Elf64_Addr sh_addr; /* Section virtual addr at execution */
250− Elf64_Off sh_offset; /* Section file offset */
251− Elf64_Xword sh_size; /* Section size in bytes */
252− Elf64_Word sh_link; /* Link to another section */
253− Elf64_Word sh_info; /* Additional section information */
254− Elf64_Xword sh_addralign; /* Section alignment */
255− Elf64_Xword sh_entsize; /* Entry size if section holds table */
246+ Elf64_Word sh_name; /* Section name (string tbl index) */
247+ Elf64_Word sh_type; /* Section type */
248+ Elf64_Xword sh_flags; /* Section flags */
249+ Elf64_Addr sh_addr; /* Section virtual addr at execution */
250+ Elf64_Off sh_offset; /* Section file offset */
251+ Elf64_Xword sh_size; /* Section size in bytes */
252+ Elf64_Word sh_link; /* Link to another section */
253+ Elf64_Word sh_info; /* Additional section information */
254+ Elf64_Xword sh_addralign; /* Section alignment */
255+ Elf64_Xword sh_entsize; /* Entry size if section holds table */
256256 } Elf64_Shdr;
257257
258258 /* Special section indices. */
259259
260−#define SHN_UNDEF 0 /* Undefined section */
261−#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
262−#define SHN_LOPROC 0xff00 /* Start of processor-specific */
263−#define SHN_HIPROC 0xff1f /* End of processor-specific */
264−#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
265−#define SHN_COMMON 0xfff2 /* Associated symbol is common */
266−#define SHN_HIRESERVE 0xffff /* End of reserved indices */
260+#define SHN_UNDEF 0 /* Undefined section */
261+#define SHN_LORESERVE 0xff00 /* Start of reserved indices */
262+#define SHN_LOPROC 0xff00 /* Start of processor-specific */
263+#define SHN_HIPROC 0xff1f /* End of processor-specific */
264+#define SHN_ABS 0xfff1 /* Associated symbol is absolute */
265+#define SHN_COMMON 0xfff2 /* Associated symbol is common */
266+#define SHN_HIRESERVE 0xffff /* End of reserved indices */
267267
268268 /* Legal values for sh_type (section type). */
269269
270−#define SHT_NULL 0 /* Section header table entry unused */
271−#define SHT_PROGBITS 1 /* Program data */
272−#define SHT_SYMTAB 2 /* Symbol table */
273−#define SHT_STRTAB 3 /* String table */
274−#define SHT_RELA 4 /* Relocation entries with addends */
275−#define SHT_HASH 5 /* Symbol hash table */
276−#define SHT_DYNAMIC 6 /* Dynamic linking information */
277−#define SHT_NOTE 7 /* Notes */
278−#define SHT_NOBITS 8 /* Program space with no data (bss) */
279−#define SHT_REL 9 /* Relocation entries, no addends */
280−#define SHT_SHLIB 10 /* Reserved */
281−#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
282−#define SHT_NUM 12 /* Number of defined types. */
283−#define SHT_LOOS 0x60000000 /* Start OS-specific */
284−#define SHT_LOSUNW 0x6ffffffb /* Sun-specific low bound. */
270+#define SHT_NULL 0 /* Section header table entry unused */
271+#define SHT_PROGBITS 1 /* Program data */
272+#define SHT_SYMTAB 2 /* Symbol table */
273+#define SHT_STRTAB 3 /* String table */
274+#define SHT_RELA 4 /* Relocation entries with addends */
275+#define SHT_HASH 5 /* Symbol hash table */
276+#define SHT_DYNAMIC 6 /* Dynamic linking information */
277+#define SHT_NOTE 7 /* Notes */
278+#define SHT_NOBITS 8 /* Program space with no data (bss) */
279+#define SHT_REL 9 /* Relocation entries, no addends */
280+#define SHT_SHLIB 10 /* Reserved */
281+#define SHT_DYNSYM 11 /* Dynamic linker symbol table */
282+#define SHT_NUM 12 /* Number of defined types. */
283+#define SHT_LOOS 0x60000000 /* Start OS-specific */
284+#define SHT_LOSUNW 0x6ffffffb /* Sun-specific low bound. */
285285 #define SHT_SUNW_COMDAT 0x6ffffffb
286286 #define SHT_SUNW_syminfo 0x6ffffffc
287−#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
288−#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
289−#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
290−#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
291−#define SHT_HIOS 0x6fffffff /* End OS-specific type */
292−#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
287+#define SHT_GNU_verdef 0x6ffffffd /* Version definition section. */
288+#define SHT_GNU_verneed 0x6ffffffe /* Version needs section. */
289+#define SHT_GNU_versym 0x6fffffff /* Version symbol table. */
290+#define SHT_HISUNW 0x6fffffff /* Sun-specific high bound. */
291+#define SHT_HIOS 0x6fffffff /* End OS-specific type */
292+#define SHT_LOPROC 0x70000000 /* Start of processor-specific */
293293 #define SHT_ARM_EXIDX 0x70000001 /* Exception Index table */
294294 #define SHT_ARM_PREEMPTMAP 0x70000002 /* dynamic linking pre-emption map */
295295 #define SHT_ARM_ATTRIBUTES 0x70000003 /* Object file compatibility attrs */
296−#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
297−#define SHT_LOUSER 0x80000000 /* Start of application-specific */
298−#define SHT_HIUSER 0x8fffffff /* End of application-specific */
296+#define SHT_HIPROC 0x7fffffff /* End of processor-specific */
297+#define SHT_LOUSER 0x80000000 /* Start of application-specific */
298+#define SHT_HIUSER 0x8fffffff /* End of application-specific */
299299
300300 /* Legal values for sh_flags (section flags). */
301301
302−#define SHF_WRITE (1 << 0) /* Writable */
303−#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
304−#define SHF_EXECINSTR (1 << 2) /* Executable */
305−#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
302+#define SHF_WRITE (1 << 0) /* Writable */
303+#define SHF_ALLOC (1 << 1) /* Occupies memory during execution */
304+#define SHF_EXECINSTR (1 << 2) /* Executable */
305+#define SHF_MASKPROC 0xf0000000 /* Processor-specific */
306306
307307 /* Symbol table entry. */
308308
309309 typedef struct
310310 {
311− Elf32_Word st_name; /* Symbol name (string tbl index) */
312− Elf32_Addr st_value; /* Symbol value */
313− Elf32_Word st_size; /* Symbol size */
314− unsigned char st_info; /* Symbol type and binding */
315− unsigned char st_other; /* No defined meaning, 0 */
316− Elf32_Section st_shndx; /* Section index */
311+ Elf32_Word st_name; /* Symbol name (string tbl index) */
312+ Elf32_Addr st_value; /* Symbol value */
313+ Elf32_Word st_size; /* Symbol size */
314+ unsigned char st_info; /* Symbol type and binding */
315+ unsigned char st_other; /* No defined meaning, 0 */
316+ Elf32_Section st_shndx; /* Section index */
317317 } Elf32_Sym;
318318
319319 typedef struct
320320 {
321− Elf64_Word st_name; /* Symbol name (string tbl index) */
322− unsigned char st_info; /* Symbol type and binding */
323− unsigned char st_other; /* No defined meaning, 0 */
324− Elf64_Section st_shndx; /* Section index */
325− Elf64_Addr st_value; /* Symbol value */
326− Elf64_Xword st_size; /* Symbol size */
321+ Elf64_Word st_name; /* Symbol name (string tbl index) */
322+ unsigned char st_info; /* Symbol type and binding */
323+ unsigned char st_other; /* No defined meaning, 0 */
324+ Elf64_Section st_shndx; /* Section index */
325+ Elf64_Addr st_value; /* Symbol value */
326+ Elf64_Xword st_size; /* Symbol size */
327327 } Elf64_Sym;
328328
329329 /* The syminfo section if available contains additional information about
@@ -331,100 +331,100 @@ typedef struct · 1 unmodified line
331331
332332 typedef struct
333333 {
334− Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
335− Elf32_Half si_flags; /* Per symbol flags */
334+ Elf32_Half si_boundto; /* Direct bindings, symbol bound to */
335+ Elf32_Half si_flags; /* Per symbol flags */
336336 } Elf32_Syminfo;
337337
338338 typedef struct
339339 {
340− Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
341− Elf64_Half si_flags; /* Per symbol flags */
340+ Elf64_Half si_boundto; /* Direct bindings, symbol bound to */
341+ Elf64_Half si_flags; /* Per symbol flags */
342342 } Elf64_Syminfo;
343343
344344 /* Possible values for si_boundto. */
345−#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
346−#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
347−#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
345+#define SYMINFO_BT_SELF 0xffff /* Symbol bound to self */
346+#define SYMINFO_BT_PARENT 0xfffe /* Symbol bound to parent */
347+#define SYMINFO_BT_LOWRESERVE 0xff00 /* Beginning of reserved entries */
348348
349349 /* Possible bitmasks for si_flags. */
350−#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
351−#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
352−#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
353−#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
354− loaded */
350+#define SYMINFO_FLG_DIRECT 0x0001 /* Direct bound symbol */
351+#define SYMINFO_FLG_PASSTHRU 0x0002 /* Pass-thru symbol for translator */
352+#define SYMINFO_FLG_COPY 0x0004 /* Symbol is a copy-reloc */
353+#define SYMINFO_FLG_LAZYLOAD 0x0008 /* Symbol bound to object to be lazy
354+ loaded */
355355 /* Syminfo version values. */
356−#define SYMINFO_NONE 0
357−#define SYMINFO_CURRENT 1
358−#define SYMINFO_NUM 2
356+#define SYMINFO_NONE 0
357+#define SYMINFO_CURRENT 1
358+#define SYMINFO_NUM 2
359359
360360
361361 /* Special section index. */
362362
363−#define SHN_UNDEF 0 /* No section, undefined symbol. */
363+#define SHN_UNDEF 0 /* No section, undefined symbol. */
364364
365365 /* How to extract and insert information held in the st_info field. */
366366
367−#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
368−#define ELF32_ST_TYPE(val) ((val) & 0xf)
369−#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
367+#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
368+#define ELF32_ST_TYPE(val) ((val) & 0xf)
369+#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
370370
371371 /* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
372−#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
373−#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
374−#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
372+#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
373+#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
374+#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
375375
376376 /* Legal values for ST_BIND subfield of st_info (symbol binding). */
377377
378−#define STB_LOCAL 0 /* Local symbol */
379−#define STB_GLOBAL 1 /* Global symbol */
380−#define STB_WEAK 2 /* Weak symbol */
381−#define STB_NUM 3 /* Number of defined types. */
382−#define STB_LOOS 10 /* Start of OS-specific */
383−#define STB_HIOS 12 /* End of OS-specific */
384−#define STB_LOPROC 13 /* Start of processor-specific */
385−#define STB_HIPROC 15 /* End of processor-specific */
378+#define STB_LOCAL 0 /* Local symbol */
379+#define STB_GLOBAL 1 /* Global symbol */
380+#define STB_WEAK 2 /* Weak symbol */
381+#define STB_NUM 3 /* Number of defined types. */
382+#define STB_LOOS 10 /* Start of OS-specific */
383+#define STB_HIOS 12 /* End of OS-specific */
384+#define STB_LOPROC 13 /* Start of processor-specific */
385+#define STB_HIPROC 15 /* End of processor-specific */
386386
387387 /* Legal values for ST_TYPE subfield of st_info (symbol type). */
388388
389−#define STT_NOTYPE 0 /* Symbol type is unspecified */
390−#define STT_OBJECT 1 /* Symbol is a data object */
391−#define STT_FUNC 2 /* Symbol is a code object */
392−#define STT_SECTION 3 /* Symbol associated with a section */
393−#define STT_FILE 4 /* Symbol's name is file name */
394−#define STT_NUM 5 /* Number of defined types. */
395−#define STT_LOOS 11 /* Start of OS-specific */
396−#define STT_HIOS 12 /* End of OS-specific */
397−#define STT_LOPROC 13 /* Start of processor-specific */
398−#define STT_HIPROC 15 /* End of processor-specific */
389+#define STT_NOTYPE 0 /* Symbol type is unspecified */
390+#define STT_OBJECT 1 /* Symbol is a data object */
391+#define STT_FUNC 2 /* Symbol is a code object */
392+#define STT_SECTION 3 /* Symbol associated with a section */
393+#define STT_FILE 4 /* Symbol's name is file name */
394+#define STT_NUM 5 /* Number of defined types. */
395+#define STT_LOOS 11 /* Start of OS-specific */
396+#define STT_HIOS 12 /* End of OS-specific */
397+#define STT_LOPROC 13 /* Start of processor-specific */
398+#define STT_HIPROC 15 /* End of processor-specific */
399399
400400
401401 /* Symbol table indices are found in the hash buckets and chain table
402402 of a symbol hash table section. This special index value indicates
403403 the end of a chain, meaning no further symbols are found in that bucket. */
404404
405−#define STN_UNDEF 0 /* End of a chain. */
405+#define STN_UNDEF 0 /* End of a chain. */
406406
407407
408408 /* How to extract and insert information held in the st_other field. */
409409
410−#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
410+#define ELF32_ST_VISIBILITY(o) ((o) & 0x03)
411411
412412 /* For ELF64 the definitions are the same. */
413−#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
413+#define ELF64_ST_VISIBILITY(o) ELF32_ST_VISIBILITY (o)
414414
415415 /* Symbol visibility specification encoded in the st_other field. */
416−#define STV_DEFAULT 0 /* Default symbol visibility rules */
417−#define STV_INTERNAL 1 /* Processor specific hidden class */
418−#define STV_HIDDEN 2 /* Sym unavailable in other modules */
419−#define STV_PROTECTED 3 /* Not preemptible, not exported */
416+#define STV_DEFAULT 0 /* Default symbol visibility rules */
417+#define STV_INTERNAL 1 /* Processor specific hidden class */
418+#define STV_HIDDEN 2 /* Sym unavailable in other modules */
419+#define STV_PROTECTED 3 /* Not preemptible, not exported */
420420
421421
422422 /* Relocation table entry without addend (in section of type SHT_REL). */
423423
424424 typedef struct
425425 {
426− Elf32_Addr r_offset; /* Address */
427− Elf32_Word r_info; /* Relocation type and symbol index */
426+ Elf32_Addr r_offset; /* Address */
427+ Elf32_Word r_info; /* Relocation type and symbol index */
428428 } Elf32_Rel;
429429
430430 /* I have seen two different definitions of the Elf64_Rel and
@@ -434,266 +434,266 @@ typedef struct · 3 unmodified lines
434434
435435 typedef struct
436436 {
437− Elf64_Addr r_offset; /* Address */
438− Elf64_Xword r_info; /* Relocation type and symbol index */
437+ Elf64_Addr r_offset; /* Address */
438+ Elf64_Xword r_info; /* Relocation type and symbol index */
439439 } Elf64_Rel;
440440
441441 /* Relocation table entry with addend (in section of type SHT_RELA). */
442442
443443 typedef struct
444444 {
445− Elf32_Addr r_offset; /* Address */
446− Elf32_Word r_info; /* Relocation type and symbol index */
447− Elf32_Sword r_addend; /* Addend */
445+ Elf32_Addr r_offset; /* Address */
446+ Elf32_Word r_info; /* Relocation type and symbol index */
447+ Elf32_Sword r_addend; /* Addend */
448448 } Elf32_Rela;
449449
450450 typedef struct
451451 {
452− Elf64_Addr r_offset; /* Address */
453− Elf64_Xword r_info; /* Relocation type and symbol index */
454− Elf64_Sxword r_addend; /* Addend */
452+ Elf64_Addr r_offset; /* Address */
453+ Elf64_Xword r_info; /* Relocation type and symbol index */
454+ Elf64_Sxword r_addend; /* Addend */
455455 } Elf64_Rela;
456456
457457 /* How to extract and insert information held in the r_info field. */
458458
459−#define ELF32_R_SYM(val) ((val) >> 8)
460−#define ELF32_R_TYPE(val) ((val) & 0xff)
461−#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
459+#define ELF32_R_SYM(val) ((val) >> 8)
460+#define ELF32_R_TYPE(val) ((val) & 0xff)
461+#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
462462
463−#define ELF64_R_SYM(i) ((i) >> 32)
464−#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
465−#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
463+#define ELF64_R_SYM(i) ((i) >> 32)
464+#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
465+#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
466466
467467 /* Program segment header. */
468468
469469 typedef struct
470470 {
471− Elf32_Word p_type; /* Segment type */
472− Elf32_Off p_offset; /* Segment file offset */
473− Elf32_Addr p_vaddr; /* Segment virtual address */
474− Elf32_Addr p_paddr; /* Segment physical address */
475− Elf32_Word p_filesz; /* Segment size in file */
476− Elf32_Word p_memsz; /* Segment size in memory */
477− Elf32_Word p_flags; /* Segment flags */
478− Elf32_Word p_align; /* Segment alignment */
471+ Elf32_Word p_type; /* Segment type */
472+ Elf32_Off p_offset; /* Segment file offset */
473+ Elf32_Addr p_vaddr; /* Segment virtual address */
474+ Elf32_Addr p_paddr; /* Segment physical address */
475+ Elf32_Word p_filesz; /* Segment size in file */
476+ Elf32_Word p_memsz; /* Segment size in memory */
477+ Elf32_Word p_flags; /* Segment flags */
478+ Elf32_Word p_align; /* Segment alignment */
479479 } Elf32_Phdr;
480480
481481 typedef struct
482482 {
483− Elf64_Word p_type; /* Segment type */
484− Elf64_Word p_flags; /* Segment flags */
485− Elf64_Off p_offset; /* Segment file offset */
486− Elf64_Addr p_vaddr; /* Segment virtual address */
487− Elf64_Addr p_paddr; /* Segment physical address */
488− Elf64_Xword p_filesz; /* Segment size in file */
489− Elf64_Xword p_memsz; /* Segment size in memory */
490− Elf64_Xword p_align; /* Segment alignment */
483+ Elf64_Word p_type; /* Segment type */
484+ Elf64_Word p_flags; /* Segment flags */
485+ Elf64_Off p_offset; /* Segment file offset */
486+ Elf64_Addr p_vaddr; /* Segment virtual address */
487+ Elf64_Addr p_paddr; /* Segment physical address */
488+ Elf64_Xword p_filesz; /* Segment size in file */
489+ Elf64_Xword p_memsz; /* Segment size in memory */
490+ Elf64_Xword p_align; /* Segment alignment */
491491 } Elf64_Phdr;
492492
493493 /* Legal values for p_type (segment type). */
494494
495−#define PT_NULL 0 /* Program header table entry unused */
496−#define PT_LOAD 1 /* Loadable program segment */
497−#define PT_DYNAMIC 2 /* Dynamic linking information */
498−#define PT_INTERP 3 /* Program interpreter */
499−#define PT_NOTE 4 /* Auxiliary information */
500−#define PT_SHLIB 5 /* Reserved */
501−#define PT_PHDR 6 /* Entry for header table itself */
502−#define PT_NUM 7 /* Number of defined types. */
503−#define PT_LOOS 0x60000000 /* Start of OS-specific */
504−#define PT_HIOS 0x6fffffff /* End of OS-specific */
505−#define PT_LOPROC 0x70000000 /* Start of processor-specific */
506−#define PT_HIPROC 0x7fffffff /* End of processor-specific */
495+#define PT_NULL 0 /* Program header table entry unused */
496+#define PT_LOAD 1 /* Loadable program segment */
497+#define PT_DYNAMIC 2 /* Dynamic linking information */
498+#define PT_INTERP 3 /* Program interpreter */
499+#define PT_NOTE 4 /* Auxiliary information */
500+#define PT_SHLIB 5 /* Reserved */
501+#define PT_PHDR 6 /* Entry for header table itself */
502+#define PT_NUM 7 /* Number of defined types. */
503+#define PT_LOOS 0x60000000 /* Start of OS-specific */
504+#define PT_HIOS 0x6fffffff /* End of OS-specific */
505+#define PT_LOPROC 0x70000000 /* Start of processor-specific */
506+#define PT_HIPROC 0x7fffffff /* End of processor-specific */
507507
508508 /* Legal values for p_flags (segment flags). */
509509
510−#define PF_X (1 << 0) /* Segment is executable */
511−#define PF_W (1 << 1) /* Segment is writable */
512−#define PF_R (1 << 2) /* Segment is readable */
513−#define PF_MASKPROC 0xf0000000 /* Processor-specific */
510+#define PF_X (1 << 0) /* Segment is executable */
511+#define PF_W (1 << 1) /* Segment is writable */
512+#define PF_R (1 << 2) /* Segment is readable */
513+#define PF_MASKPROC 0xf0000000 /* Processor-specific */
514514
515515 /* Legal values for note segment descriptor types for core files. */
516516
517−#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
518−#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
519−#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
520−#define NT_PRXREG 4 /* Contains copy of prxregset struct */
521−#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
522−#define NT_AUXV 6 /* Contains copy of auxv array */
523−#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
524−#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
525−#define NT_PSINFO 13 /* Contains copy of psinfo struct */
526−#define NT_PRCRED 14 /* Contains copy of prcred struct */
527−#define NT_UTSNAME 15 /* Contains copy of utsname struct */
528−#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
529−#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
517+#define NT_PRSTATUS 1 /* Contains copy of prstatus struct */
518+#define NT_FPREGSET 2 /* Contains copy of fpregset struct */
519+#define NT_PRPSINFO 3 /* Contains copy of prpsinfo struct */
520+#define NT_PRXREG 4 /* Contains copy of prxregset struct */
521+#define NT_PLATFORM 5 /* String from sysinfo(SI_PLATFORM) */
522+#define NT_AUXV 6 /* Contains copy of auxv array */
523+#define NT_GWINDOWS 7 /* Contains copy of gwindows struct */
524+#define NT_PSTATUS 10 /* Contains copy of pstatus struct */
525+#define NT_PSINFO 13 /* Contains copy of psinfo struct */
526+#define NT_PRCRED 14 /* Contains copy of prcred struct */
527+#define NT_UTSNAME 15 /* Contains copy of utsname struct */
528+#define NT_LWPSTATUS 16 /* Contains copy of lwpstatus struct */
529+#define NT_LWPSINFO 17 /* Contains copy of lwpinfo struct */
530530
531531 /* Legal values for the note segment descriptor types for object files. */
532532
533−#define NT_VERSION 1 /* Contains a version string. */
533+#define NT_VERSION 1 /* Contains a version string. */
534534
535535
536536 /* Dynamic section entry. */
537537
538538 typedef struct
539539 {
540− Elf32_Sword d_tag; /* Dynamic entry type */
540+ Elf32_Sword d_tag; /* Dynamic entry type */
541541 union
542542 {
543− Elf32_Word d_val; /* Integer value */
544− Elf32_Addr d_ptr; /* Address value */
543+ Elf32_Word d_val; /* Integer value */
544+ Elf32_Addr d_ptr; /* Address value */
545545 } d_un;
546546 } Elf32_Dyn;
547547
548548 typedef struct
549549 {
550− Elf64_Sxword d_tag; /* Dynamic entry type */
550+ Elf64_Sxword d_tag; /* Dynamic entry type */
551551 union
552552 {
553− Elf64_Xword d_val; /* Integer value */
554− Elf64_Addr d_ptr; /* Address value */
553+ Elf64_Xword d_val; /* Integer value */
554+ Elf64_Addr d_ptr; /* Address value */
555555 } d_un;
556556 } Elf64_Dyn;
557557
558558 /* Legal values for d_tag (dynamic entry type). */
559559
560−#define DT_NULL 0 /* Marks end of dynamic section */
561−#define DT_NEEDED 1 /* Name of needed library */
562−#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
563−#define DT_PLTGOT 3 /* Processor defined value */
564−#define DT_HASH 4 /* Address of symbol hash table */
565−#define DT_STRTAB 5 /* Address of string table */
566−#define DT_SYMTAB 6 /* Address of symbol table */
567−#define DT_RELA 7 /* Address of Rela relocs */
568−#define DT_RELASZ 8 /* Total size of Rela relocs */
569−#define DT_RELAENT 9 /* Size of one Rela reloc */
570−#define DT_STRSZ 10 /* Size of string table */
571−#define DT_SYMENT 11 /* Size of one symbol table entry */
572−#define DT_INIT 12 /* Address of init function */
573−#define DT_FINI 13 /* Address of termination function */
574−#define DT_SONAME 14 /* Name of shared object */
575−#define DT_RPATH 15 /* Library search path */
576−#define DT_SYMBOLIC 16 /* Start symbol search here */
577−#define DT_REL 17 /* Address of Rel relocs */
578−#define DT_RELSZ 18 /* Total size of Rel relocs */
579−#define DT_RELENT 19 /* Size of one Rel reloc */
580−#define DT_PLTREL 20 /* Type of reloc in PLT */
581−#define DT_DEBUG 21 /* For debugging; unspecified */
582−#define DT_TEXTREL 22 /* Reloc might modify .text */
583−#define DT_JMPREL 23 /* Address of PLT relocs */
584−#define DT_BIND_NOW 24 /* Process relocations of object */
585−#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
586−#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
587−#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
588−#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
589−#define DT_NUM 29 /* Number used */
590−#define DT_LOOS 0x60000000 /* Start of OS-specific */
591−#define DT_HIOS 0x6fffffff /* End of OS-specific */
592−#define DT_LOPROC 0x70000000 /* Start of processor-specific */
593−#define DT_HIPROC 0x7fffffff /* End of processor-specific */
594−#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
560+#define DT_NULL 0 /* Marks end of dynamic section */
561+#define DT_NEEDED 1 /* Name of needed library */
562+#define DT_PLTRELSZ 2 /* Size in bytes of PLT relocs */
563+#define DT_PLTGOT 3 /* Processor defined value */
564+#define DT_HASH 4 /* Address of symbol hash table */
565+#define DT_STRTAB 5 /* Address of string table */
566+#define DT_SYMTAB 6 /* Address of symbol table */
567+#define DT_RELA 7 /* Address of Rela relocs */
568+#define DT_RELASZ 8 /* Total size of Rela relocs */
569+#define DT_RELAENT 9 /* Size of one Rela reloc */
570+#define DT_STRSZ 10 /* Size of string table */
571+#define DT_SYMENT 11 /* Size of one symbol table entry */
572+#define DT_INIT 12 /* Address of init function */
573+#define DT_FINI 13 /* Address of termination function */
574+#define DT_SONAME 14 /* Name of shared object */
575+#define DT_RPATH 15 /* Library search path */
576+#define DT_SYMBOLIC 16 /* Start symbol search here */
577+#define DT_REL 17 /* Address of Rel relocs */
578+#define DT_RELSZ 18 /* Total size of Rel relocs */
579+#define DT_RELENT 19 /* Size of one Rel reloc */
580+#define DT_PLTREL 20 /* Type of reloc in PLT */
581+#define DT_DEBUG 21 /* For debugging; unspecified */
582+#define DT_TEXTREL 22 /* Reloc might modify .text */
583+#define DT_JMPREL 23 /* Address of PLT relocs */
584+#define DT_BIND_NOW 24 /* Process relocations of object */
585+#define DT_INIT_ARRAY 25 /* Array with addresses of init fct */
586+#define DT_FINI_ARRAY 26 /* Array with addresses of fini fct */
587+#define DT_INIT_ARRAYSZ 27 /* Size in bytes of DT_INIT_ARRAY */
588+#define DT_FINI_ARRAYSZ 28 /* Size in bytes of DT_FINI_ARRAY */
589+#define DT_NUM 29 /* Number used */
590+#define DT_LOOS 0x60000000 /* Start of OS-specific */
591+#define DT_HIOS 0x6fffffff /* End of OS-specific */
592+#define DT_LOPROC 0x70000000 /* Start of processor-specific */
593+#define DT_HIPROC 0x7fffffff /* End of processor-specific */
594+#define DT_PROCNUM DT_MIPS_NUM /* Most used by any processor */
595595
596596 /* DT_* entries which fall between DT_VALRNGHI & DT_VALRNGLO use the
597597 Dyn.d_un.d_val field of the Elf*_Dyn structure. This follows Sun's
598598 approach. */
599−#define DT_VALRNGLO 0x6ffffd00
600−#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
601− the following DT_* entry. */
602−#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
603−#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
604−#define DT_VALRNGHI 0x6ffffdff
599+#define DT_VALRNGLO 0x6ffffd00
600+#define DT_POSFLAG_1 0x6ffffdfd /* Flags for DT_* entries, effecting
601+ the following DT_* entry. */
602+#define DT_SYMINSZ 0x6ffffdfe /* Size of syminfo table (in bytes) */
603+#define DT_SYMINENT 0x6ffffdff /* Entry size of syminfo */
604+#define DT_VALRNGHI 0x6ffffdff
605605
606606 /* DT_* entries which fall between DT_ADDRRNGHI & DT_ADDRRNGLO use the
607607 Dyn.d_un.d_ptr field of the Elf*_Dyn structure.
608608
609609 If any adjustment is made to the ELF object after it has been
610610 built these entries will need to be adjusted. */
611−#define DT_ADDRRNGLO 0x6ffffe00
612−#define DT_SYMINFO 0x6ffffeff /* syminfo table */
613−#define DT_ADDRRNGHI 0x6ffffeff
611+#define DT_ADDRRNGLO 0x6ffffe00
612+#define DT_SYMINFO 0x6ffffeff /* syminfo table */
613+#define DT_ADDRRNGHI 0x6ffffeff
614614
615615 /* The versioning entry types. The next are defined as part of the
616616 GNU extension. */
617−#define DT_VERSYM 0x6ffffff0
617+#define DT_VERSYM 0x6ffffff0
618618
619619 /* These were chosen by Sun. */
620−#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
621−#define DT_VERDEF 0x6ffffffc /* Address of version definition
622− table */
623−#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
624−#define DT_VERNEED 0x6ffffffe /* Address of table with needed
625− versions */
626−#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
627−#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
620+#define DT_FLAGS_1 0x6ffffffb /* State flags, see DF_1_* below. */
621+#define DT_VERDEF 0x6ffffffc /* Address of version definition
622+ table */
623+#define DT_VERDEFNUM 0x6ffffffd /* Number of version definitions */
624+#define DT_VERNEED 0x6ffffffe /* Address of table with needed
625+ versions */
626+#define DT_VERNEEDNUM 0x6fffffff /* Number of needed versions */
627+#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag)) /* Reverse order! */
628628 #define DT_VERSIONTAGNUM 16
629629
630630 /* Sun added these machine-independent extensions in the "processor-specific"
631631 range. Be compatible. */
632632 #define DT_AUXILIARY 0x7ffffffd /* Shared object to load before self */
633633 #define DT_FILTER 0x7fffffff /* Shared object to get values from */
634−#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
635−#define DT_EXTRANUM 3
634+#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
635+#define DT_EXTRANUM 3
636636
637637 /* State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1
638638 entry in the dynamic section. */
639−#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
640−#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
641−#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
642−#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
643−#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
644−#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
645−#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
639+#define DF_1_NOW 0x00000001 /* Set RTLD_NOW for this object. */
640+#define DF_1_GLOBAL 0x00000002 /* Set RTLD_GLOBAL for this object. */
641+#define DF_1_GROUP 0x00000004 /* Set RTLD_GROUP for this object. */
642+#define DF_1_NODELETE 0x00000008 /* Set RTLD_NODELETE for this object.*/
643+#define DF_1_LOADFLTR 0x00000010 /* Trigger filtee loading at runtime.*/
644+#define DF_1_INITFIRST 0x00000020 /* Set RTLD_INITFIRST for this object*/
645+#define DF_1_NOOPEN 0x00000040 /* Set RTLD_NOOPEN for this object. */
646646
647647 /* Version definition sections. */
648648
649649 typedef struct
650650 {
651− Elf32_Half vd_version; /* Version revision */
652− Elf32_Half vd_flags; /* Version information */
653− Elf32_Half vd_ndx; /* Version Index */
654− Elf32_Half vd_cnt; /* Number of associated aux entries */
655− Elf32_Word vd_hash; /* Version name hash value */
656− Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
657− Elf32_Word vd_next; /* Offset in bytes to next verdef
658− entry */
651+ Elf32_Half vd_version; /* Version revision */
652+ Elf32_Half vd_flags; /* Version information */
653+ Elf32_Half vd_ndx; /* Version Index */
654+ Elf32_Half vd_cnt; /* Number of associated aux entries */
655+ Elf32_Word vd_hash; /* Version name hash value */
656+ Elf32_Word vd_aux; /* Offset in bytes to verdaux array */
657+ Elf32_Word vd_next; /* Offset in bytes to next verdef
658+ entry */
659659 } Elf32_Verdef;
660660
661661 typedef struct
662662 {
663− Elf64_Half vd_version; /* Version revision */
664− Elf64_Half vd_flags; /* Version information */
665− Elf64_Half vd_ndx; /* Version Index */
666− Elf64_Half vd_cnt; /* Number of associated aux entries */
667− Elf64_Word vd_hash; /* Version name hash value */
668− Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
669− Elf64_Word vd_next; /* Offset in bytes to next verdef
670− entry */
663+ Elf64_Half vd_version; /* Version revision */
664+ Elf64_Half vd_flags; /* Version information */
665+ Elf64_Half vd_ndx; /* Version Index */
666+ Elf64_Half vd_cnt; /* Number of associated aux entries */
667+ Elf64_Word vd_hash; /* Version name hash value */
668+ Elf64_Word vd_aux; /* Offset in bytes to verdaux array */
669+ Elf64_Word vd_next; /* Offset in bytes to next verdef
670+ entry */
671671 } Elf64_Verdef;
672672
673673
674674 /* Legal values for vd_version (version revision). */
675−#define VER_DEF_NONE 0 /* No version */
676−#define VER_DEF_CURRENT 1 /* Current version */
677−#define VER_DEF_NUM 2 /* Given version number */
675+#define VER_DEF_NONE 0 /* No version */
676+#define VER_DEF_CURRENT 1 /* Current version */
677+#define VER_DEF_NUM 2 /* Given version number */
678678
679679 /* Legal values for vd_flags (version information flags). */
680−#define VER_FLG_BASE 0x1 /* Version definition of file itself */
681−#define VER_FLG_WEAK 0x2 /* Weak version identifier */
680+#define VER_FLG_BASE 0x1 /* Version definition of file itself */
681+#define VER_FLG_WEAK 0x2 /* Weak version identifier */
682682
683683 /* Auxialiary version information. */
684684
685685 typedef struct
686686 {
687− Elf32_Word vda_name; /* Version or dependency names */
688− Elf32_Word vda_next; /* Offset in bytes to next verdaux
689− entry */
687+ Elf32_Word vda_name; /* Version or dependency names */
688+ Elf32_Word vda_next; /* Offset in bytes to next verdaux
689+ entry */
690690 } Elf32_Verdaux;
691691
692692 typedef struct
693693 {
694− Elf64_Word vda_name; /* Version or dependency names */
695− Elf64_Word vda_next; /* Offset in bytes to next verdaux
696− entry */
694+ Elf64_Word vda_name; /* Version or dependency names */
695+ Elf64_Word vda_next; /* Offset in bytes to next verdaux
696+ entry */
697697 } Elf64_Verdaux;
698698
699699
@@ -701,57 +701,57 @@ typedef struct · 1 unmodified line
701701
702702 typedef struct
703703 {
704− Elf32_Half vn_version; /* Version of structure */
705− Elf32_Half vn_cnt; /* Number of associated aux entries */
706− Elf32_Word vn_file; /* Offset of filename for this
707− dependency */
708− Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
709− Elf32_Word vn_next; /* Offset in bytes to next verneed
710− entry */
704+ Elf32_Half vn_version; /* Version of structure */
705+ Elf32_Half vn_cnt; /* Number of associated aux entries */
706+ Elf32_Word vn_file; /* Offset of filename for this
707+ dependency */
708+ Elf32_Word vn_aux; /* Offset in bytes to vernaux array */
709+ Elf32_Word vn_next; /* Offset in bytes to next verneed
710+ entry */
711711 } Elf32_Verneed;
712712
713713 typedef struct
714714 {
715− Elf64_Half vn_version; /* Version of structure */
716− Elf64_Half vn_cnt; /* Number of associated aux entries */
717− Elf64_Word vn_file; /* Offset of filename for this
718− dependency */
719− Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
720− Elf64_Word vn_next; /* Offset in bytes to next verneed
721− entry */
715+ Elf64_Half vn_version; /* Version of structure */
716+ Elf64_Half vn_cnt; /* Number of associated aux entries */
717+ Elf64_Word vn_file; /* Offset of filename for this
718+ dependency */
719+ Elf64_Word vn_aux; /* Offset in bytes to vernaux array */
720+ Elf64_Word vn_next; /* Offset in bytes to next verneed
721+ entry */
722722 } Elf64_Verneed;
723723
724724
725725 /* Legal values for vn_version (version revision). */
726−#define VER_NEED_NONE 0 /* No version */
727−#define VER_NEED_CURRENT 1 /* Current version */
728−#define VER_NEED_NUM 2 /* Given version number */
726+#define VER_NEED_NONE 0 /* No version */
727+#define VER_NEED_CURRENT 1 /* Current version */
728+#define VER_NEED_NUM 2 /* Given version number */
729729
730730 /* Auxiliary needed version information. */
731731
732732 typedef struct
733733 {
734− Elf32_Word vna_hash; /* Hash value of dependency name */
735− Elf32_Half vna_flags; /* Dependency specific information */
736− Elf32_Half vna_other; /* Unused */
737− Elf32_Word vna_name; /* Dependency name string offset */
738− Elf32_Word vna_next; /* Offset in bytes to next vernaux
739− entry */
734+ Elf32_Word vna_hash; /* Hash value of dependency name */
735+ Elf32_Half vna_flags; /* Dependency specific information */
736+ Elf32_Half vna_other; /* Unused */
737+ Elf32_Word vna_name; /* Dependency name string offset */
738+ Elf32_Word vna_next; /* Offset in bytes to next vernaux
739+ entry */
740740 } Elf32_Vernaux;
741741
742742 typedef struct
743743 {
744− Elf64_Word vna_hash; /* Hash value of dependency name */
745− Elf64_Half vna_flags; /* Dependency specific information */
746− Elf64_Half vna_other; /* Unused */
747− Elf64_Word vna_name; /* Dependency name string offset */
748− Elf64_Word vna_next; /* Offset in bytes to next vernaux
749− entry */
744+ Elf64_Word vna_hash; /* Hash value of dependency name */
745+ Elf64_Half vna_flags; /* Dependency specific information */
746+ Elf64_Half vna_other; /* Unused */
747+ Elf64_Word vna_name; /* Dependency name string offset */
748+ Elf64_Word vna_next; /* Offset in bytes to next vernaux
749+ entry */
750750 } Elf64_Vernaux;
751751
752752
753753 /* Legal values for vna_flags. */
754−#define VER_FLG_WEAK 0x2 /* Weak version identifier */
754+#define VER_FLG_WEAK 0x2 /* Weak version identifier */
755755
756756
757757 /* Auxiliary vector. */
@@ -765,52 +765,52 @@ typedef struct · 7 unmodified lines
765765
766766 typedef struct
767767 {
768− int a_type; /* Entry type */
768+ int a_type; /* Entry type */
769769 union
770770 {
771− long int a_val; /* Integer value */
772− void *a_ptr; /* Pointer value */
773− void (*a_fcn) (void); /* Function pointer value */
771+ long int a_val; /* Integer value */
772+ void *a_ptr; /* Pointer value */
773+ void (*a_fcn) (void); /* Function pointer value */
774774 } a_un;
775775 } Elf32_auxv_t;
776776
777777 typedef struct
778778 {
779− long int a_type; /* Entry type */
779+ long int a_type; /* Entry type */
780780 union
781781 {
782− long int a_val; /* Integer value */
783− void *a_ptr; /* Pointer value */
784− void (*a_fcn) (void); /* Function pointer value */
782+ long int a_val; /* Integer value */
783+ void *a_ptr; /* Pointer value */
784+ void (*a_fcn) (void); /* Function pointer value */
785785 } a_un;
786786 } Elf64_auxv_t;
787787
788788 /* Legal values for a_type (entry type). */
789789
790−#define AT_NULL 0 /* End of vector */
791−#define AT_IGNORE 1 /* Entry should be ignored */
792−#define AT_EXECFD 2 /* File descriptor of program */
793−#define AT_PHDR 3 /* Program headers for program */
794−#define AT_PHENT 4 /* Size of program header entry */
795−#define AT_PHNUM 5 /* Number of program headers */
796−#define AT_PAGESZ 6 /* System page size */
797−#define AT_BASE 7 /* Base address of interpreter */
798−#define AT_FLAGS 8 /* Flags */
799−#define AT_ENTRY 9 /* Entry point of program */
800−#define AT_NOTELF 10 /* Program is not ELF */
801−#define AT_UID 11 /* Real uid */
802−#define AT_EUID 12 /* Effective uid */
803−#define AT_GID 13 /* Real gid */
804−#define AT_EGID 14 /* Effective gid */
790+#define AT_NULL 0 /* End of vector */
791+#define AT_IGNORE 1 /* Entry should be ignored */
792+#define AT_EXECFD 2 /* File descriptor of program */
793+#define AT_PHDR 3 /* Program headers for program */
794+#define AT_PHENT 4 /* Size of program header entry */
795+#define AT_PHNUM 5 /* Number of program headers */
796+#define AT_PAGESZ 6 /* System page size */
797+#define AT_BASE 7 /* Base address of interpreter */
798+#define AT_FLAGS 8 /* Flags */
799+#define AT_ENTRY 9 /* Entry point of program */
800+#define AT_NOTELF 10 /* Program is not ELF */
801+#define AT_UID 11 /* Real uid */
802+#define AT_EUID 12 /* Effective uid */
803+#define AT_GID 13 /* Real gid */
804+#define AT_EGID 14 /* Effective gid */
805805
806806 /* Some more special a_type values describing the hardware. */
807−#define AT_PLATFORM 15 /* String identifying platform. */
808−#define AT_HWCAP 16 /* Machine dependent hints about
809− processor capabilities. */
807+#define AT_PLATFORM 15 /* String identifying platform. */
808+#define AT_HWCAP 16 /* Machine dependent hints about
809+ processor capabilities. */
810810
811811 /* This entry gives some information about the FPU initialization
812812 performed by the kernel. */
813−#define AT_FPUCW 17 /* Used FPU control word. */
813+#define AT_FPUCW 17 /* Used FPU control word. */
814814
815815
816816 /* Note section contents. Each entry in the note section begins with
@@ -818,31 +818,31 @@ typedef struct · 1 unmodified line
818818
819819 typedef struct
820820 {
821− Elf32_Word n_namesz; /* Length of the note's name. */
822− Elf32_Word n_descsz; /* Length of the note's descriptor. */
823− Elf32_Word n_type; /* Type of the note. */
821+ Elf32_Word n_namesz; /* Length of the note's name. */
822+ Elf32_Word n_descsz; /* Length of the note's descriptor. */
823+ Elf32_Word n_type; /* Type of the note. */
824824 } Elf32_Nhdr;
825825
826826 typedef struct
827827 {
828− Elf64_Word n_namesz; /* Length of the note's name. */
829− Elf64_Word n_descsz; /* Length of the note's descriptor. */
830− Elf64_Word n_type; /* Type of the note. */
828+ Elf64_Word n_namesz; /* Length of the note's name. */
829+ Elf64_Word n_descsz; /* Length of the note's descriptor. */
830+ Elf64_Word n_type; /* Type of the note. */
831831 } Elf64_Nhdr;
832832
833833 /* Known names of notes. */
834834
835835 /* Solaris entries in the note section have this name. */
836−#define ELF_NOTE_SOLARIS "SUNW Solaris"
836+#define ELF_NOTE_SOLARIS "SUNW Solaris"
837837
838838 /* Note entries for GNU systems have this name. */
839−#define ELF_NOTE_GNU "GNU"
839+#define ELF_NOTE_GNU "GNU"
840840
841841
842842 /* Defined types of notes for Solaris. */
843843
844844 /* Value of descriptor (one word) is desired pagesize for the binary. */
845−#define ELF_NOTE_PAGESIZE_HINT 1
845+#define ELF_NOTE_PAGESIZE_HINT 1
846846
847847
848848 /* Defined note types for GNU systems. */
@@ -853,253 +853,253 @@ typedef struct · 4 unmodified lines
853853 word 2: minor version of the ABI
854854 word 3: subminor version of the ABI
855855 */
856−#define ELF_NOTE_ABI 1
856+#define ELF_NOTE_ABI 1
857857
858858 /* Known OSes. These value can appear in word 0 of an ELF_NOTE_ABI
859859 note section entry. */
860−#define ELF_NOTE_OS_LINUX 0
861−#define ELF_NOTE_OS_GNU 1
862−#define ELF_NOTE_OS_SOLARIS2 2
860+#define ELF_NOTE_OS_LINUX 0
861+#define ELF_NOTE_OS_GNU 1
862+#define ELF_NOTE_OS_SOLARIS2 2
863863
864864
865865 /* Motorola 68k specific definitions. */
866866
867867 /* m68k relocs. */
868868
869−#define R_68K_NONE 0 /* No reloc */
870−#define R_68K_32 1 /* Direct 32 bit */
871−#define R_68K_16 2 /* Direct 16 bit */
872−#define R_68K_8 3 /* Direct 8 bit */
873−#define R_68K_PC32 4 /* PC relative 32 bit */
874−#define R_68K_PC16 5 /* PC relative 16 bit */
875−#define R_68K_PC8 6 /* PC relative 8 bit */
876−#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
877−#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
878−#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
879−#define R_68K_GOT32O 10 /* 32 bit GOT offset */
880−#define R_68K_GOT16O 11 /* 16 bit GOT offset */
881−#define R_68K_GOT8O 12 /* 8 bit GOT offset */
882−#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
883−#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
884−#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
885−#define R_68K_PLT32O 16 /* 32 bit PLT offset */
886−#define R_68K_PLT16O 17 /* 16 bit PLT offset */
887−#define R_68K_PLT8O 18 /* 8 bit PLT offset */
888−#define R_68K_COPY 19 /* Copy symbol at runtime */
889−#define R_68K_GLOB_DAT 20 /* Create GOT entry */
890−#define R_68K_JMP_SLOT 21 /* Create PLT entry */
891−#define R_68K_RELATIVE 22 /* Adjust by program base */
869+#define R_68K_NONE 0 /* No reloc */
870+#define R_68K_32 1 /* Direct 32 bit */
871+#define R_68K_16 2 /* Direct 16 bit */
872+#define R_68K_8 3 /* Direct 8 bit */
873+#define R_68K_PC32 4 /* PC relative 32 bit */
874+#define R_68K_PC16 5 /* PC relative 16 bit */
875+#define R_68K_PC8 6 /* PC relative 8 bit */
876+#define R_68K_GOT32 7 /* 32 bit PC relative GOT entry */
877+#define R_68K_GOT16 8 /* 16 bit PC relative GOT entry */
878+#define R_68K_GOT8 9 /* 8 bit PC relative GOT entry */
879+#define R_68K_GOT32O 10 /* 32 bit GOT offset */
880+#define R_68K_GOT16O 11 /* 16 bit GOT offset */
881+#define R_68K_GOT8O 12 /* 8 bit GOT offset */
882+#define R_68K_PLT32 13 /* 32 bit PC relative PLT address */
883+#define R_68K_PLT16 14 /* 16 bit PC relative PLT address */
884+#define R_68K_PLT8 15 /* 8 bit PC relative PLT address */
885+#define R_68K_PLT32O 16 /* 32 bit PLT offset */
886+#define R_68K_PLT16O 17 /* 16 bit PLT offset */
887+#define R_68K_PLT8O 18 /* 8 bit PLT offset */
888+#define R_68K_COPY 19 /* Copy symbol at runtime */
889+#define R_68K_GLOB_DAT 20 /* Create GOT entry */
890+#define R_68K_JMP_SLOT 21 /* Create PLT entry */
891+#define R_68K_RELATIVE 22 /* Adjust by program base */
892892 /* Keep this the last entry. */
893−#define R_68K_NUM 23
893+#define R_68K_NUM 23
894894
895895 /* Intel 80386 specific definitions. */
896896
897897 /* i386 relocs. */
898898
899−#define R_386_NONE 0 /* No reloc */
900−#define R_386_32 1 /* Direct 32 bit */
901−#define R_386_PC32 2 /* PC relative 32 bit */
902−#define R_386_GOT32 3 /* 32 bit GOT entry */
903−#define R_386_PLT32 4 /* 32 bit PLT address */
904−#define R_386_COPY 5 /* Copy symbol at runtime */
905−#define R_386_GLOB_DAT 6 /* Create GOT entry */
906−#define R_386_JMP_SLOT 7 /* Create PLT entry */
907−#define R_386_RELATIVE 8 /* Adjust by program base */
908−#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
909−#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
899+#define R_386_NONE 0 /* No reloc */
900+#define R_386_32 1 /* Direct 32 bit */
901+#define R_386_PC32 2 /* PC relative 32 bit */
902+#define R_386_GOT32 3 /* 32 bit GOT entry */
903+#define R_386_PLT32 4 /* 32 bit PLT address */
904+#define R_386_COPY 5 /* Copy symbol at runtime */
905+#define R_386_GLOB_DAT 6 /* Create GOT entry */
906+#define R_386_JMP_SLOT 7 /* Create PLT entry */
907+#define R_386_RELATIVE 8 /* Adjust by program base */
908+#define R_386_GOTOFF 9 /* 32 bit offset to GOT */
909+#define R_386_GOTPC 10 /* 32 bit PC relative offset to GOT */
910910 /* Keep this the last entry. */
911−#define R_386_NUM 11
911+#define R_386_NUM 11
912912
913913 /* SUN SPARC specific definitions. */
914914
915915 /* Values for Elf64_Ehdr.e_flags. */
916916
917−#define EF_SPARCV9_MM 3
918−#define EF_SPARCV9_TSO 0
919−#define EF_SPARCV9_PSO 1
920−#define EF_SPARCV9_RMO 2
921−#define EF_SPARC_EXT_MASK 0xFFFF00
922−#define EF_SPARC_SUN_US1 0x000200
923−#define EF_SPARC_HAL_R1 0x000400
917+#define EF_SPARCV9_MM 3
918+#define EF_SPARCV9_TSO 0
919+#define EF_SPARCV9_PSO 1
920+#define EF_SPARCV9_RMO 2
921+#define EF_SPARC_EXT_MASK 0xFFFF00
922+#define EF_SPARC_SUN_US1 0x000200
923+#define EF_SPARC_HAL_R1 0x000400
924924
925925 /* SPARC relocs. */
926926
927−#define R_SPARC_NONE 0 /* No reloc */
928−#define R_SPARC_8 1 /* Direct 8 bit */
929−#define R_SPARC_16 2 /* Direct 16 bit */
930−#define R_SPARC_32 3 /* Direct 32 bit */
931−#define R_SPARC_DISP8 4 /* PC relative 8 bit */
932−#define R_SPARC_DISP16 5 /* PC relative 16 bit */
933−#define R_SPARC_DISP32 6 /* PC relative 32 bit */
934−#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
935−#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
936−#define R_SPARC_HI22 9 /* High 22 bit */
937−#define R_SPARC_22 10 /* Direct 22 bit */
938−#define R_SPARC_13 11 /* Direct 13 bit */
939−#define R_SPARC_LO10 12 /* Truncated 10 bit */
940−#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
941−#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
942−#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
943−#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
944−#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
945−#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
946−#define R_SPARC_COPY 19 /* Copy symbol at runtime */
947−#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
948−#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
949−#define R_SPARC_RELATIVE 22 /* Adjust by program base */
950−#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
927+#define R_SPARC_NONE 0 /* No reloc */
928+#define R_SPARC_8 1 /* Direct 8 bit */
929+#define R_SPARC_16 2 /* Direct 16 bit */
930+#define R_SPARC_32 3 /* Direct 32 bit */
931+#define R_SPARC_DISP8 4 /* PC relative 8 bit */
932+#define R_SPARC_DISP16 5 /* PC relative 16 bit */
933+#define R_SPARC_DISP32 6 /* PC relative 32 bit */
934+#define R_SPARC_WDISP30 7 /* PC relative 30 bit shifted */
935+#define R_SPARC_WDISP22 8 /* PC relative 22 bit shifted */
936+#define R_SPARC_HI22 9 /* High 22 bit */
937+#define R_SPARC_22 10 /* Direct 22 bit */
938+#define R_SPARC_13 11 /* Direct 13 bit */
939+#define R_SPARC_LO10 12 /* Truncated 10 bit */
940+#define R_SPARC_GOT10 13 /* Truncated 10 bit GOT entry */
941+#define R_SPARC_GOT13 14 /* 13 bit GOT entry */
942+#define R_SPARC_GOT22 15 /* 22 bit GOT entry shifted */
943+#define R_SPARC_PC10 16 /* PC relative 10 bit truncated */
944+#define R_SPARC_PC22 17 /* PC relative 22 bit shifted */
945+#define R_SPARC_WPLT30 18 /* 30 bit PC relative PLT address */
946+#define R_SPARC_COPY 19 /* Copy symbol at runtime */
947+#define R_SPARC_GLOB_DAT 20 /* Create GOT entry */
948+#define R_SPARC_JMP_SLOT 21 /* Create PLT entry */
949+#define R_SPARC_RELATIVE 22 /* Adjust by program base */
950+#define R_SPARC_UA32 23 /* Direct 32 bit unaligned */
951951
952952 /* Additional Sparc64 relocs. */
953953
954−#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
955−#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
956−#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
957−#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
958−#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
959−#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
960−#define R_SPARC_10 30 /* Direct 10 bit */
961−#define R_SPARC_11 31 /* Direct 11 bit */
962−#define R_SPARC_64 32 /* Direct 64 bit */
963−#define R_SPARC_OLO10 33 /* ?? */
964−#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
965−#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
966−#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
967−#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
968−#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
969−#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
970−#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
971−#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
972−#define R_SPARC_7 43 /* Direct 7 bit */
973−#define R_SPARC_5 44 /* Direct 5 bit */
974−#define R_SPARC_6 45 /* Direct 6 bit */
975−#define R_SPARC_DISP64 46 /* PC relative 64 bit */
976−#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
977−#define R_SPARC_HIX22 48 /* High 22 bit complemented */
978−#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
979−#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
980−#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
981−#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
982−#define R_SPARC_REGISTER 53 /* Global register usage */
983−#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
984−#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
954+#define R_SPARC_PLT32 24 /* Direct 32 bit ref to PLT entry */
955+#define R_SPARC_HIPLT22 25 /* High 22 bit PLT entry */
956+#define R_SPARC_LOPLT10 26 /* Truncated 10 bit PLT entry */
957+#define R_SPARC_PCPLT32 27 /* PC rel 32 bit ref to PLT entry */
958+#define R_SPARC_PCPLT22 28 /* PC rel high 22 bit PLT entry */
959+#define R_SPARC_PCPLT10 29 /* PC rel trunc 10 bit PLT entry */
960+#define R_SPARC_10 30 /* Direct 10 bit */
961+#define R_SPARC_11 31 /* Direct 11 bit */
962+#define R_SPARC_64 32 /* Direct 64 bit */
963+#define R_SPARC_OLO10 33 /* ?? */
964+#define R_SPARC_HH22 34 /* Top 22 bits of direct 64 bit */
965+#define R_SPARC_HM10 35 /* High middle 10 bits of ... */
966+#define R_SPARC_LM22 36 /* Low middle 22 bits of ... */
967+#define R_SPARC_PC_HH22 37 /* Top 22 bits of pc rel 64 bit */
968+#define R_SPARC_PC_HM10 38 /* High middle 10 bit of ... */
969+#define R_SPARC_PC_LM22 39 /* Low miggle 22 bits of ... */
970+#define R_SPARC_WDISP16 40 /* PC relative 16 bit shifted */
971+#define R_SPARC_WDISP19 41 /* PC relative 19 bit shifted */
972+#define R_SPARC_7 43 /* Direct 7 bit */
973+#define R_SPARC_5 44 /* Direct 5 bit */
974+#define R_SPARC_6 45 /* Direct 6 bit */
975+#define R_SPARC_DISP64 46 /* PC relative 64 bit */
976+#define R_SPARC_PLT64 47 /* Direct 64 bit ref to PLT entry */
977+#define R_SPARC_HIX22 48 /* High 22 bit complemented */
978+#define R_SPARC_LOX10 49 /* Truncated 11 bit complemented */
979+#define R_SPARC_H44 50 /* Direct high 12 of 44 bit */
980+#define R_SPARC_M44 51 /* Direct mid 22 of 44 bit */
981+#define R_SPARC_L44 52 /* Direct low 10 of 44 bit */
982+#define R_SPARC_REGISTER 53 /* Global register usage */
983+#define R_SPARC_UA64 54 /* Direct 64 bit unaligned */
984+#define R_SPARC_UA16 55 /* Direct 16 bit unaligned */
985985 /* Keep this the last entry. */
986−#define R_SPARC_NUM 56
986+#define R_SPARC_NUM 56
987987
988988 /* For Sparc64, legal values for d_tag of Elf64_Dyn. */
989989
990990 #define DT_SPARC_REGISTER 0x70000001
991−#define DT_SPARC_NUM 2
991+#define DT_SPARC_NUM 2
992992
993993 /* Bits present in AT_HWCAP, primarily for Sparc32. */
994994
995−#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */
996−#define HWCAP_SPARC_STBAR 2
997−#define HWCAP_SPARC_SWAP 4
998−#define HWCAP_SPARC_MULDIV 8
999−#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */
995+#define HWCAP_SPARC_FLUSH 1 /* The cpu supports flush insn. */
996+#define HWCAP_SPARC_STBAR 2
997+#define HWCAP_SPARC_SWAP 4
998+#define HWCAP_SPARC_MULDIV 8
999+#define HWCAP_SPARC_V9 16 /* The cpu is v9, so v8plus is ok. */
10001000
10011001 /* MIPS R3000 specific definitions. */
10021002
10031003 /* Legal values for e_flags field of Elf32_Ehdr. */
10041004
1005−#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
1006−#define EF_MIPS_PIC 2 /* Contains PIC code */
1007−#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
1008−#define EF_MIPS_XGOT 8
1005+#define EF_MIPS_NOREORDER 1 /* A .noreorder directive was used */
1006+#define EF_MIPS_PIC 2 /* Contains PIC code */
1007+#define EF_MIPS_CPIC 4 /* Uses PIC calling sequence */
1008+#define EF_MIPS_XGOT 8
10091009 #define EF_MIPS_64BIT_WHIRL 16
1010−#define EF_MIPS_ABI2 32
1010+#define EF_MIPS_ABI2 32
10111011 #define EF_MIPS_ABI_ON32 64
1012−#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
1012+#define EF_MIPS_ARCH 0xf0000000 /* MIPS architecture level */
10131013
10141014 /* Legal values for MIPS architecture level. */
10151015
1016−#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1017−#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1018−#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1019−#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1020−#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
1016+#define EF_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1017+#define EF_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1018+#define EF_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1019+#define EF_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1020+#define EF_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
10211021
10221022 /* The following are non-official names and should not be used. */
10231023
1024−#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1025−#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1026−#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1027−#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1028−#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
1024+#define E_MIPS_ARCH_1 0x00000000 /* -mips1 code. */
1025+#define E_MIPS_ARCH_2 0x10000000 /* -mips2 code. */
1026+#define E_MIPS_ARCH_3 0x20000000 /* -mips3 code. */
1027+#define E_MIPS_ARCH_4 0x30000000 /* -mips4 code. */
1028+#define E_MIPS_ARCH_5 0x40000000 /* -mips5 code. */
10291029
10301030 /* Special section indices. */
10311031
1032−#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
1033−#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
1034−#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
1035−#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
1036−#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
1032+#define SHN_MIPS_ACOMMON 0xff00 /* Allocated common symbols */
1033+#define SHN_MIPS_TEXT 0xff01 /* Allocated test symbols. */
1034+#define SHN_MIPS_DATA 0xff02 /* Allocated data symbols. */
1035+#define SHN_MIPS_SCOMMON 0xff03 /* Small common symbols */
1036+#define SHN_MIPS_SUNDEFINED 0xff04 /* Small undefined symbols */
10371037
10381038 /* Legal values for sh_type field of Elf32_Shdr. */
10391039
10401040 #define SHT_MIPS_LIBLIST 0x70000000 /* Shared objects used in link */
1041−#define SHT_MIPS_MSYM 0x70000001
1041+#define SHT_MIPS_MSYM 0x70000001
10421042 #define SHT_MIPS_CONFLICT 0x70000002 /* Conflicting symbols */
1043−#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
1044−#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
1045−#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/
1043+#define SHT_MIPS_GPTAB 0x70000003 /* Global data area sizes */
1044+#define SHT_MIPS_UCODE 0x70000004 /* Reserved for SGI/MIPS compilers */
1045+#define SHT_MIPS_DEBUG 0x70000005 /* MIPS ECOFF debugging information*/
10461046 #define SHT_MIPS_REGINFO 0x70000006 /* Register usage information */
10471047 #define SHT_MIPS_PACKAGE 0x70000007
10481048 #define SHT_MIPS_PACKSYM 0x70000008
1049−#define SHT_MIPS_RELD 0x70000009
1049+#define SHT_MIPS_RELD 0x70000009
10501050 #define SHT_MIPS_IFACE 0x7000000b
10511051 #define SHT_MIPS_CONTENT 0x7000000c
10521052 #define SHT_MIPS_OPTIONS 0x7000000d /* Miscellaneous options. */
1053−#define SHT_MIPS_SHDR 0x70000010
1054−#define SHT_MIPS_FDESC 0x70000011
1055−#define SHT_MIPS_EXTSYM 0x70000012
1056−#define SHT_MIPS_DENSE 0x70000013
1057−#define SHT_MIPS_PDESC 0x70000014
1058−#define SHT_MIPS_LOCSYM 0x70000015
1059−#define SHT_MIPS_AUXSYM 0x70000016
1060−#define SHT_MIPS_OPTSYM 0x70000017
1061−#define SHT_MIPS_LOCSTR 0x70000018
1062−#define SHT_MIPS_LINE 0x70000019
1063−#define SHT_MIPS_RFDESC 0x7000001a
1053+#define SHT_MIPS_SHDR 0x70000010
1054+#define SHT_MIPS_FDESC 0x70000011
1055+#define SHT_MIPS_EXTSYM 0x70000012
1056+#define SHT_MIPS_DENSE 0x70000013
1057+#define SHT_MIPS_PDESC 0x70000014
1058+#define SHT_MIPS_LOCSYM 0x70000015
1059+#define SHT_MIPS_AUXSYM 0x70000016
1060+#define SHT_MIPS_OPTSYM 0x70000017
1061+#define SHT_MIPS_LOCSTR 0x70000018
1062+#define SHT_MIPS_LINE 0x70000019
1063+#define SHT_MIPS_RFDESC 0x7000001a
10641064 #define SHT_MIPS_DELTASYM 0x7000001b
10651065 #define SHT_MIPS_DELTAINST 0x7000001c
10661066 #define SHT_MIPS_DELTACLASS 0x7000001d
10671067 #define SHT_MIPS_DWARF 0x7000001e /* DWARF debugging information. */
10681068 #define SHT_MIPS_DELTADECL 0x7000001f
10691069 #define SHT_MIPS_SYMBOL_LIB 0x70000020
1070−#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
1070+#define SHT_MIPS_EVENTS 0x70000021 /* Event section. */
10711071 #define SHT_MIPS_TRANSLATE 0x70000022
1072−#define SHT_MIPS_PIXIE 0x70000023
1073−#define SHT_MIPS_XLATE 0x70000024
1072+#define SHT_MIPS_PIXIE 0x70000023
1073+#define SHT_MIPS_XLATE 0x70000024
10741074 #define SHT_MIPS_XLATE_DEBUG 0x70000025
1075−#define SHT_MIPS_WHIRL 0x70000026
1075+#define SHT_MIPS_WHIRL 0x70000026
10761076 #define SHT_MIPS_EH_REGION 0x70000027
10771077 #define SHT_MIPS_XLATE_OLD 0x70000028
10781078 #define SHT_MIPS_PDR_EXCEPTION 0x70000029
10791079
10801080 /* Legal values for sh_flags field of Elf32_Shdr. */
10811081
1082−#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
1083−#define SHF_MIPS_MERGE 0x20000000
1084−#define SHF_MIPS_ADDR 0x40000000
1082+#define SHF_MIPS_GPREL 0x10000000 /* Must be part of global data area */
1083+#define SHF_MIPS_MERGE 0x20000000
1084+#define SHF_MIPS_ADDR 0x40000000
10851085 #define SHF_MIPS_STRINGS 0x80000000
10861086 #define SHF_MIPS_NOSTRIP 0x08000000
1087−#define SHF_MIPS_LOCAL 0x04000000
1088−#define SHF_MIPS_NAMES 0x02000000
1089−#define SHF_MIPS_NODUPE 0x01000000
1087+#define SHF_MIPS_LOCAL 0x04000000
1088+#define SHF_MIPS_NAMES 0x02000000
1089+#define SHF_MIPS_NODUPE 0x01000000
10901090
10911091
10921092 /* Symbol tables. */
10931093
10941094 /* MIPS specific values for `st_other'. */
1095−#define STO_MIPS_DEFAULT 0x0
1096−#define STO_MIPS_INTERNAL 0x1
1097−#define STO_MIPS_HIDDEN 0x2
1098−#define STO_MIPS_PROTECTED 0x3
1099−#define STO_MIPS_SC_ALIGN_UNUSED 0xff
1095+#define STO_MIPS_DEFAULT 0x0
1096+#define STO_MIPS_INTERNAL 0x1
1097+#define STO_MIPS_HIDDEN 0x2
1098+#define STO_MIPS_PROTECTED 0x3
1099+#define STO_MIPS_SC_ALIGN_UNUSED 0xff
11001100
11011101 /* MIPS specific values for `st_info'. */
1102−#define STB_MIPS_SPLIT_COMMON 13
1102+#define STB_MIPS_SPLIT_COMMON 13
11031103
11041104 /* Entries found in sections of type SHT_MIPS_GPTAB. */
11051105
@@ -1107,176 +1107,176 @@ typedef union · 1 unmodified line
11071107 {
11081108 struct
11091109 {
1110− Elf32_Word gt_current_g_value; /* -G value used for compilation */
1111− Elf32_Word gt_unused; /* Not used */
1112− } gt_header; /* First entry in section */
1110+ Elf32_Word gt_current_g_value; /* -G value used for compilation */
1111+ Elf32_Word gt_unused; /* Not used */
1112+ } gt_header; /* First entry in section */
11131113 struct
11141114 {
1115− Elf32_Word gt_g_value; /* If this value were used for -G */
1116− Elf32_Word gt_bytes; /* This many bytes would be used */
1117− } gt_entry; /* Subsequent entries in section */
1115+ Elf32_Word gt_g_value; /* If this value were used for -G */
1116+ Elf32_Word gt_bytes; /* This many bytes would be used */
1117+ } gt_entry; /* Subsequent entries in section */
11181118 } Elf32_gptab;
11191119
11201120 /* Entry found in sections of type SHT_MIPS_REGINFO. */
11211121
11221122 typedef struct
11231123 {
1124− Elf32_Word ri_gprmask; /* General registers used */
1125− Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
1126− Elf32_Sword ri_gp_value; /* $gp register value */
1124+ Elf32_Word ri_gprmask; /* General registers used */
1125+ Elf32_Word ri_cprmask[4]; /* Coprocessor registers used */
1126+ Elf32_Sword ri_gp_value; /* $gp register value */
11271127 } Elf32_RegInfo;
11281128
11291129 /* Entries found in sections of type SHT_MIPS_OPTIONS. */
11301130
11311131 typedef struct
11321132 {
1133− unsigned char kind; /* Determines interpretation of the
1134− variable part of descriptor. */
1135− unsigned char size; /* Size of descriptor, including header. */
1136− Elf32_Section section; /* Section header index of section affected,
1137− 0 for global options. */
1138− Elf32_Word info; /* Kind-specific information. */
1133+ unsigned char kind; /* Determines interpretation of the
1134+ variable part of descriptor. */
1135+ unsigned char size; /* Size of descriptor, including header. */
1136+ Elf32_Section section; /* Section header index of section affected,
1137+ 0 for global options. */
1138+ Elf32_Word info; /* Kind-specific information. */
11391139 } Elf_Options;
11401140
11411141 /* Values for `kind' field in Elf_Options. */
11421142
1143−#define ODK_NULL 0 /* Undefined. */
1144−#define ODK_REGINFO 1 /* Register usage information. */
1145−#define ODK_EXCEPTIONS 2 /* Exception processing options. */
1146−#define ODK_PAD 3 /* Section padding options. */
1147−#define ODK_HWPATCH 4 /* Hardware workarounds performed */
1148−#define ODK_FILL 5 /* record the fill value used by the linker. */
1149−#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
1150−#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
1151−#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
1143+#define ODK_NULL 0 /* Undefined. */
1144+#define ODK_REGINFO 1 /* Register usage information. */
1145+#define ODK_EXCEPTIONS 2 /* Exception processing options. */
1146+#define ODK_PAD 3 /* Section padding options. */
1147+#define ODK_HWPATCH 4 /* Hardware workarounds performed */
1148+#define ODK_FILL 5 /* record the fill value used by the linker. */
1149+#define ODK_TAGS 6 /* reserve space for desktop tools to write. */
1150+#define ODK_HWAND 7 /* HW workarounds. 'AND' bits when merging. */
1151+#define ODK_HWOR 8 /* HW workarounds. 'OR' bits when merging. */
11521152
11531153 /* Values for `info' in Elf_Options for ODK_EXCEPTIONS entries. */
11541154
1155−#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
1156−#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
1157−#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
1158−#define OEX_SMM 0x20000 /* Force sequential memory mode? */
1159−#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
1160−#define OEX_PRECISEFP OEX_FPDBUG
1161−#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
1155+#define OEX_FPU_MIN 0x1f /* FPE's which MUST be enabled. */
1156+#define OEX_FPU_MAX 0x1f00 /* FPE's which MAY be enabled. */
1157+#define OEX_PAGE0 0x10000 /* page zero must be mapped. */
1158+#define OEX_SMM 0x20000 /* Force sequential memory mode? */
1159+#define OEX_FPDBUG 0x40000 /* Force floating point debug mode? */
1160+#define OEX_PRECISEFP OEX_FPDBUG
1161+#define OEX_DISMISS 0x80000 /* Dismiss invalid address faults? */
11621162
1163−#define OEX_FPU_INVAL 0x10
1164−#define OEX_FPU_DIV0 0x08
1165−#define OEX_FPU_OFLO 0x04
1166−#define OEX_FPU_UFLO 0x02
1167−#define OEX_FPU_INEX 0x01
1163+#define OEX_FPU_INVAL 0x10
1164+#define OEX_FPU_DIV0 0x08
1165+#define OEX_FPU_OFLO 0x04
1166+#define OEX_FPU_UFLO 0x02
1167+#define OEX_FPU_INEX 0x01
11681168
11691169 /* Masks for `info' in Elf_Options for an ODK_HWPATCH entry. */
11701170
1171−#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
1172−#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
1173−#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
1174−#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
1171+#define OHW_R4KEOP 0x1 /* R4000 end-of-page patch. */
1172+#define OHW_R8KPFETCH 0x2 /* may need R8000 prefetch patch. */
1173+#define OHW_R5KEOP 0x4 /* R5000 end-of-page patch. */
1174+#define OHW_R5KCVTL 0x8 /* R5000 cvt.[ds].l bug. clean=1. */
11751175
1176−#define OPAD_PREFIX 0x1
1177−#define OPAD_POSTFIX 0x2
1178−#define OPAD_SYMBOL 0x4
1176+#define OPAD_PREFIX 0x1
1177+#define OPAD_POSTFIX 0x2
1178+#define OPAD_SYMBOL 0x4
11791179
11801180 /* Entry found in `.options' section. */
11811181
11821182 typedef struct
11831183 {
1184− Elf32_Word hwp_flags1; /* Extra flags. */
1185− Elf32_Word hwp_flags2; /* Extra flags. */
1184+ Elf32_Word hwp_flags1; /* Extra flags. */
1185+ Elf32_Word hwp_flags2; /* Extra flags. */
11861186 } Elf_Options_Hw;
11871187
11881188 /* Masks for `info' in ElfOptions for ODK_HWAND and ODK_HWOR entries. */
11891189
1190−#define OHWA0_R4KEOP_CHECKED 0x00000001
1191−#define OHWA1_R4KEOP_CLEAN 0x00000002
1190+#define OHWA0_R4KEOP_CHECKED 0x00000001
1191+#define OHWA1_R4KEOP_CLEAN 0x00000002
11921192
11931193 /* MIPS relocs. */
11941194
1195−#define R_MIPS_NONE 0 /* No reloc */
1196−#define R_MIPS_16 1 /* Direct 16 bit */
1197−#define R_MIPS_32 2 /* Direct 32 bit */
1198−#define R_MIPS_REL32 3 /* PC relative 32 bit */
1199−#define R_MIPS_26 4 /* Direct 26 bit shifted */
1200−#define R_MIPS_HI16 5 /* High 16 bit */
1201−#define R_MIPS_LO16 6 /* Low 16 bit */
1202−#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
1203−#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
1204−#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
1205−#define R_MIPS_PC16 10 /* PC relative 16 bit */
1206−#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
1207−#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
1208−
1209−#define R_MIPS_SHIFT5 16
1210−#define R_MIPS_SHIFT6 17
1211−#define R_MIPS_64 18
1212−#define R_MIPS_GOT_DISP 19
1213−#define R_MIPS_GOT_PAGE 20
1214−#define R_MIPS_GOT_OFST 21
1215−#define R_MIPS_GOT_HI16 22
1216−#define R_MIPS_GOT_LO16 23
1217−#define R_MIPS_SUB 24
1218−#define R_MIPS_INSERT_A 25
1219−#define R_MIPS_INSERT_B 26
1220−#define R_MIPS_DELETE 27
1221−#define R_MIPS_HIGHER 28
1222−#define R_MIPS_HIGHEST 29
1223−#define R_MIPS_CALL_HI16 30
1224−#define R_MIPS_CALL_LO16 31
1225−#define R_MIPS_SCN_DISP 32
1226−#define R_MIPS_REL16 33
1227−#define R_MIPS_ADD_IMMEDIATE 34
1228−#define R_MIPS_PJUMP 35
1229−#define R_MIPS_RELGOT 36
1230−#define R_MIPS_JALR 37
1195+#define R_MIPS_NONE 0 /* No reloc */
1196+#define R_MIPS_16 1 /* Direct 16 bit */
1197+#define R_MIPS_32 2 /* Direct 32 bit */
1198+#define R_MIPS_REL32 3 /* PC relative 32 bit */
1199+#define R_MIPS_26 4 /* Direct 26 bit shifted */
1200+#define R_MIPS_HI16 5 /* High 16 bit */
1201+#define R_MIPS_LO16 6 /* Low 16 bit */
1202+#define R_MIPS_GPREL16 7 /* GP relative 16 bit */
1203+#define R_MIPS_LITERAL 8 /* 16 bit literal entry */
1204+#define R_MIPS_GOT16 9 /* 16 bit GOT entry */
1205+#define R_MIPS_PC16 10 /* PC relative 16 bit */
1206+#define R_MIPS_CALL16 11 /* 16 bit GOT entry for function */
1207+#define R_MIPS_GPREL32 12 /* GP relative 32 bit */
1208+
1209+#define R_MIPS_SHIFT5 16
1210+#define R_MIPS_SHIFT6 17
1211+#define R_MIPS_64 18
1212+#define R_MIPS_GOT_DISP 19
1213+#define R_MIPS_GOT_PAGE 20
1214+#define R_MIPS_GOT_OFST 21
1215+#define R_MIPS_GOT_HI16 22
1216+#define R_MIPS_GOT_LO16 23
1217+#define R_MIPS_SUB 24
1218+#define R_MIPS_INSERT_A 25
1219+#define R_MIPS_INSERT_B 26
1220+#define R_MIPS_DELETE 27
1221+#define R_MIPS_HIGHER 28
1222+#define R_MIPS_HIGHEST 29
1223+#define R_MIPS_CALL_HI16 30
1224+#define R_MIPS_CALL_LO16 31
1225+#define R_MIPS_SCN_DISP 32
1226+#define R_MIPS_REL16 33
1227+#define R_MIPS_ADD_IMMEDIATE 34
1228+#define R_MIPS_PJUMP 35
1229+#define R_MIPS_RELGOT 36
1230+#define R_MIPS_JALR 37
12311231 /* Keep this the last entry. */
1232−#define R_MIPS_NUM 38
1232+#define R_MIPS_NUM 38
12331233
12341234 /* Legal values for p_type field of Elf32_Phdr. */
12351235
1236−#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
1237−#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
1236+#define PT_MIPS_REGINFO 0x70000000 /* Register usage information */
1237+#define PT_MIPS_RTPROC 0x70000001 /* Runtime procedure table. */
12381238 #define PT_MIPS_OPTIONS 0x70000002
12391239
12401240 /* Special program header types. */
12411241
1242−#define PF_MIPS_LOCAL 0x10000000
1242+#define PF_MIPS_LOCAL 0x10000000
12431243
12441244 /* Legal values for d_tag field of Elf32_Dyn. */
12451245
1246−#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
1247−#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
1248−#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
1249−#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
1250−#define DT_MIPS_FLAGS 0x70000005 /* Flags */
1251−#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
1252−#define DT_MIPS_MSYM 0x70000007
1253−#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
1254−#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
1255−#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
1256−#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
1257−#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
1258−#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
1259−#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
1260−#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
1261−#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
1262−#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
1263−#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
1246+#define DT_MIPS_RLD_VERSION 0x70000001 /* Runtime linker interface version */
1247+#define DT_MIPS_TIME_STAMP 0x70000002 /* Timestamp */
1248+#define DT_MIPS_ICHECKSUM 0x70000003 /* Checksum */
1249+#define DT_MIPS_IVERSION 0x70000004 /* Version string (string tbl index) */
1250+#define DT_MIPS_FLAGS 0x70000005 /* Flags */
1251+#define DT_MIPS_BASE_ADDRESS 0x70000006 /* Base address */
1252+#define DT_MIPS_MSYM 0x70000007
1253+#define DT_MIPS_CONFLICT 0x70000008 /* Address of CONFLICT section */
1254+#define DT_MIPS_LIBLIST 0x70000009 /* Address of LIBLIST section */
1255+#define DT_MIPS_LOCAL_GOTNO 0x7000000a /* Number of local GOT entries */
1256+#define DT_MIPS_CONFLICTNO 0x7000000b /* Number of CONFLICT entries */
1257+#define DT_MIPS_LIBLISTNO 0x70000010 /* Number of LIBLIST entries */
1258+#define DT_MIPS_SYMTABNO 0x70000011 /* Number of DYNSYM entries */
1259+#define DT_MIPS_UNREFEXTNO 0x70000012 /* First external DYNSYM */
1260+#define DT_MIPS_GOTSYM 0x70000013 /* First GOT entry in DYNSYM */
1261+#define DT_MIPS_HIPAGENO 0x70000014 /* Number of GOT page table entries */
1262+#define DT_MIPS_RLD_MAP 0x70000016 /* Address of run time loader map. */
1263+#define DT_MIPS_DELTA_CLASS 0x70000017 /* Delta C++ class definition. */
12641264 #define DT_MIPS_DELTA_CLASS_NO 0x70000018 /* Number of entries in
1265− DT_MIPS_DELTA_CLASS. */
1265+ DT_MIPS_DELTA_CLASS. */
12661266 #define DT_MIPS_DELTA_INSTANCE 0x70000019 /* Delta C++ class instances. */
12671267 #define DT_MIPS_DELTA_INSTANCE_NO 0x7000001a /* Number of entries in
1268− DT_MIPS_DELTA_INSTANCE. */
1268+ DT_MIPS_DELTA_INSTANCE. */
12691269 #define DT_MIPS_DELTA_RELOC 0x7000001b /* Delta relocations. */
12701270 #define DT_MIPS_DELTA_RELOC_NO 0x7000001c /* Number of entries in
1271− DT_MIPS_DELTA_RELOC. */
1271+ DT_MIPS_DELTA_RELOC. */
12721272 #define DT_MIPS_DELTA_SYM 0x7000001d /* Delta symbols that Delta
1273− relocations refer to. */
1273+ relocations refer to. */
12741274 #define DT_MIPS_DELTA_SYM_NO 0x7000001e /* Number of entries in
1275− DT_MIPS_DELTA_SYM. */
1275+ DT_MIPS_DELTA_SYM. */
12761276 #define DT_MIPS_DELTA_CLASSSYM 0x70000020 /* Delta symbols that hold the
1277− class declaration. */
1277+ class declaration. */
12781278 #define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021 /* Number of entries in
1279− DT_MIPS_DELTA_CLASSSYM. */
1279+ DT_MIPS_DELTA_CLASSSYM. */
12801280 #define DT_MIPS_CXX_FLAGS 0x70000022 /* Flags indicating for C++ flavor. */
12811281 #define DT_MIPS_PIXIE_INIT 0x70000023
12821282 #define DT_MIPS_SYMBOL_LIB 0x70000024
@@ -1284,68 +1284,68 @@ typedef struct · 1 unmodified line
12841284 #define DT_MIPS_LOCAL_GOTIDX 0x70000026
12851285 #define DT_MIPS_HIDDEN_GOTIDX 0x70000027
12861286 #define DT_MIPS_PROTECTED_GOTIDX 0x70000028
1287−#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
1287+#define DT_MIPS_OPTIONS 0x70000029 /* Address of .options. */
12881288 #define DT_MIPS_INTERFACE 0x7000002a /* Address of .interface. */
12891289 #define DT_MIPS_DYNSTR_ALIGN 0x7000002b
12901290 #define DT_MIPS_INTERFACE_SIZE 0x7000002c /* Size of the .interface section. */
12911291 #define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d /* Address of rld_text_rsolve
1292− function stored in GOT. */
1292+ function stored in GOT. */
12931293 #define DT_MIPS_PERF_SUFFIX 0x7000002e /* Default suffix of dso to be added
1294− by rld on dlopen() calls. */
1294+ by rld on dlopen() calls. */
12951295 #define DT_MIPS_COMPACT_SIZE 0x7000002f /* (O32)Size of compact rel section. */
12961296 #define DT_MIPS_GP_VALUE 0x70000030 /* GP value for aux GOTs. */
12971297 #define DT_MIPS_AUX_DYNAMIC 0x70000031 /* Address of aux .dynamic. */
1298−#define DT_MIPS_NUM 0x32
1298+#define DT_MIPS_NUM 0x32
12991299
13001300 /* Legal values for DT_MIPS_FLAGS Elf32_Dyn entry. */
13011301
1302−#define RHF_NONE 0 /* No flags */
1303−#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
1304−#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
1305−#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
1306−#define RHF_NO_MOVE (1 << 3)
1307−#define RHF_SGI_ONLY (1 << 4)
1308−#define RHF_GUARANTEE_INIT (1 << 5)
1309−#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
1302+#define RHF_NONE 0 /* No flags */
1303+#define RHF_QUICKSTART (1 << 0) /* Use quickstart */
1304+#define RHF_NOTPOT (1 << 1) /* Hash size not power of 2 */
1305+#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2) /* Ignore LD_LIBRARY_PATH */
1306+#define RHF_NO_MOVE (1 << 3)
1307+#define RHF_SGI_ONLY (1 << 4)
1308+#define RHF_GUARANTEE_INIT (1 << 5)
1309+#define RHF_DELTA_C_PLUS_PLUS (1 << 6)
13101310 #define RHF_GUARANTEE_START_INIT (1 << 7)
1311−#define RHF_PIXIE (1 << 8)
1312−#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
1313−#define RHF_REQUICKSTART (1 << 10)
1314−#define RHF_REQUICKSTARTED (1 << 11)
1315−#define RHF_CORD (1 << 12)
1316−#define RHF_NO_UNRES_UNDEF (1 << 13)
1317−#define RHF_RLD_ORDER_SAFE (1 << 14)
1311+#define RHF_PIXIE (1 << 8)
1312+#define RHF_DEFAULT_DELAY_LOAD (1 << 9)
1313+#define RHF_REQUICKSTART (1 << 10)
1314+#define RHF_REQUICKSTARTED (1 << 11)
1315+#define RHF_CORD (1 << 12)
1316+#define RHF_NO_UNRES_UNDEF (1 << 13)
1317+#define RHF_RLD_ORDER_SAFE (1 << 14)
13181318
13191319 /* Entries found in sections of type SHT_MIPS_LIBLIST. */
13201320
13211321 typedef struct
13221322 {
1323− Elf32_Word l_name; /* Name (string table index) */
1324− Elf32_Word l_time_stamp; /* Timestamp */
1325− Elf32_Word l_checksum; /* Checksum */
1326− Elf32_Word l_version; /* Interface version */
1327− Elf32_Word l_flags; /* Flags */
1323+ Elf32_Word l_name; /* Name (string table index) */
1324+ Elf32_Word l_time_stamp; /* Timestamp */
1325+ Elf32_Word l_checksum; /* Checksum */
1326+ Elf32_Word l_version; /* Interface version */
1327+ Elf32_Word l_flags; /* Flags */
13281328 } Elf32_Lib;
13291329
13301330 typedef struct
13311331 {
1332− Elf64_Word l_name; /* Name (string table index) */
1333− Elf64_Word l_time_stamp; /* Timestamp */
1334− Elf64_Word l_checksum; /* Checksum */
1335− Elf64_Word l_version; /* Interface version */
1336− Elf64_Word l_flags; /* Flags */
1332+ Elf64_Word l_name; /* Name (string table index) */
1333+ Elf64_Word l_time_stamp; /* Timestamp */
1334+ Elf64_Word l_checksum; /* Checksum */
1335+ Elf64_Word l_version; /* Interface version */
1336+ Elf64_Word l_flags; /* Flags */
13371337 } Elf64_Lib;
13381338
13391339
13401340 /* Legal values for l_flags. */
13411341
1342−#define LL_NONE 0
1343−#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
1344−#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
1342+#define LL_NONE 0
1343+#define LL_EXACT_MATCH (1 << 0) /* Require exact match */
1344+#define LL_IGNORE_INT_VER (1 << 1) /* Ignore interface version */
13451345 #define LL_REQUIRE_MINOR (1 << 2)
1346−#define LL_EXPORTS (1 << 3)
1347−#define LL_DELAY_LOAD (1 << 4)
1348−#define LL_DELTA (1 << 5)
1346+#define LL_EXPORTS (1 << 3)
1347+#define LL_DELAY_LOAD (1 << 4)
1348+#define LL_DELTA (1 << 5)
13491349
13501350 /* Entries found in sections of type SHT_MIPS_CONFLICT. */
13511351
@@ -1356,193 +1356,193 @@ typedef Elf32_Addr Elf32_Conflict; · 4 unmodified lines
13561356
13571357 /* Legal values for e_flags field of Elf32_Ehdr. */
13581358
1359−#define EF_PARISC_TRAPNL 1 /* Trap nil pointer dereference. */
1360−#define EF_PARISC_EXT 2 /* Program uses arch. extensions. */
1361−#define EF_PARISC_ARCH 0xffff0000 /* Architecture version. */
1359+#define EF_PARISC_TRAPNL 1 /* Trap nil pointer dereference. */
1360+#define EF_PARISC_EXT 2 /* Program uses arch. extensions. */
1361+#define EF_PARISC_ARCH 0xffff0000 /* Architecture version. */
13621362 /* Defined values are:
1363− 0x020b PA-RISC 1.0 big-endian
1364− 0x0210 PA-RISC 1.1 big-endian
1365− 0x028b PA-RISC 1.0 little-endian
1366− 0x0290 PA-RISC 1.1 little-endian
1363+ 0x020b PA-RISC 1.0 big-endian
1364+ 0x0210 PA-RISC 1.1 big-endian
1365+ 0x028b PA-RISC 1.0 little-endian
1366+ 0x0290 PA-RISC 1.1 little-endian
13671367 */
13681368
13691369 /* Legal values for sh_type field of Elf32_Shdr. */
13701370
1371−#define SHT_PARISC_GOT 0x70000000 /* GOT for external data. */
1372−#define SHT_PARISC_ARCH 0x70000001 /* Architecture extensions. */
1373−#define SHT_PARISC_GLOBAL 0x70000002 /* Definition of $global$. */
1374−#define SHT_PARISC_MILLI 0x70000003 /* Millicode routines. */
1375−#define SHT_PARISC_UNWIND 0x70000004 /* Unwind information. */
1376−#define SHT_PARISC_PLT 0x70000005 /* Procedure linkage table. */
1377−#define SHT_PARISC_SDATA 0x70000006 /* Short initialized data. */
1378−#define SHT_PARISC_SBSS 0x70000007 /* Short uninitialized data. */
1379−#define SHT_PARISC_SYMEXTN 0x70000008 /* Argument/relocation info. */
1380−#define SHT_PARISC_STUBS 0x70000009 /* Linker stubs. */
1371+#define SHT_PARISC_GOT 0x70000000 /* GOT for external data. */
1372+#define SHT_PARISC_ARCH 0x70000001 /* Architecture extensions. */
1373+#define SHT_PARISC_GLOBAL 0x70000002 /* Definition of $global$. */
1374+#define SHT_PARISC_MILLI 0x70000003 /* Millicode routines. */
1375+#define SHT_PARISC_UNWIND 0x70000004 /* Unwind information. */
1376+#define SHT_PARISC_PLT 0x70000005 /* Procedure linkage table. */
1377+#define SHT_PARISC_SDATA 0x70000006 /* Short initialized data. */
1378+#define SHT_PARISC_SBSS 0x70000007 /* Short uninitialized data. */
1379+#define SHT_PARISC_SYMEXTN 0x70000008 /* Argument/relocation info. */
1380+#define SHT_PARISC_STUBS 0x70000009 /* Linker stubs. */
13811381
13821382 /* Legal values for sh_flags field of Elf32_Shdr. */
13831383
1384−#define SHF_PARISC_GLOBAL 0x10000000 /* Section defines dp. */
1385−#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
1384+#define SHF_PARISC_GLOBAL 0x10000000 /* Section defines dp. */
1385+#define SHF_PARISC_SHORT 0x20000000 /* Section with short addressing. */
13861386
13871387 /* Legal values for ST_TYPE subfield of st_info (symbol type). */
13881388
1389−#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
1389+#define STT_PARISC_MILLICODE 13 /* Millicode function entry point. */
13901390
13911391 /* HPPA relocs. */
13921392
1393−#define R_PARISC_NONE 0 /* No reloc. */
1394−#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
1395−#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
1396−#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
1397−#define R_PARISC_DIR14R 4 /* Right 14 bits of eff. address. */
1398−#define R_PARISC_PCREL21L 5 /* PC-relative, left 21 bits. */
1399−#define R_PARISC_PCREL14R 6 /* PC-relative, right 14 bits. */
1400−#define R_PARISC_PCREL17C 7 /* Conditional PC-relative, ignore
1401− if displacement > 17bits. */
1402−#define R_PARISC_PCREL17F 8 /* Conditional PC-relative, must
1403− fit in 17bits. */
1404−#define R_PARISC_DPREL21L 9 /* DP-relative, left 21 bits. */
1405−#define R_PARISC_DPREL14R 10 /* DP-relative, right 14 bits. */
1406−#define R_PARISC_DPREL14F 11 /* DP-relative, must bit in 14 bits. */
1407−#define R_PARISC_DLTREL21L 12 /* DLT-relative, left 21 bits. */
1408−#define R_PARISC_DLTREL14R 13 /* DLT-relative, right 14 bits. */
1409−#define R_PARISC_DLTREL14F 14 /* DLT-relative, must fit in 14 bits.*/
1410−#define R_PARISC_DLTIND21L 15 /* DLT-relative indirect, left
1411− 21 bits. */
1412−#define R_PARISC_DLTIND14R 16 /* DLT-relative indirect, right
1413− 14 bits. */
1414−#define R_PARISC_DLTIND14F 17 /* DLT-relative indirect, must fit
1415− int 14 bits. */
1416−#define R_PARISC_PLABEL32 18 /* Direct 32-bit reference to proc. */
1393+#define R_PARISC_NONE 0 /* No reloc. */
1394+#define R_PARISC_DIR32 1 /* Direct 32-bit reference. */
1395+#define R_PARISC_DIR21L 2 /* Left 21 bits of eff. address. */
1396+#define R_PARISC_DIR17R 3 /* Right 17 bits of eff. address. */
1397+#define R_PARISC_DIR14R 4 /* Right 14 bits of eff. address. */
1398+#define R_PARISC_PCREL21L 5 /* PC-relative, left 21 bits. */
1399+#define R_PARISC_PCREL14R 6 /* PC-relative, right 14 bits. */
1400+#define R_PARISC_PCREL17C 7 /* Conditional PC-relative, ignore
1401+ if displacement > 17bits. */
1402+#define R_PARISC_PCREL17F 8 /* Conditional PC-relative, must
1403+ fit in 17bits. */
1404+#define R_PARISC_DPREL21L 9 /* DP-relative, left 21 bits. */
1405+#define R_PARISC_DPREL14R 10 /* DP-relative, right 14 bits. */
1406+#define R_PARISC_DPREL14F 11 /* DP-relative, must bit in 14 bits. */
1407+#define R_PARISC_DLTREL21L 12 /* DLT-relative, left 21 bits. */
1408+#define R_PARISC_DLTREL14R 13 /* DLT-relative, right 14 bits. */
1409+#define R_PARISC_DLTREL14F 14 /* DLT-relative, must fit in 14 bits.*/
1410+#define R_PARISC_DLTIND21L 15 /* DLT-relative indirect, left
1411+ 21 bits. */
1412+#define R_PARISC_DLTIND14R 16 /* DLT-relative indirect, right
1413+ 14 bits. */
1414+#define R_PARISC_DLTIND14F 17 /* DLT-relative indirect, must fit
1415+ int 14 bits. */
1416+#define R_PARISC_PLABEL32 18 /* Direct 32-bit reference to proc. */
14171417
14181418 /* Alpha specific definitions. */
14191419
14201420 /* Legal values for e_flags field of Elf64_Ehdr. */
14211421
1422−#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
1423−#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
1422+#define EF_ALPHA_32BIT 1 /* All addresses must be < 2GB. */
1423+#define EF_ALPHA_CANRELAX 2 /* Relocations for relaxing exist. */
14241424
14251425 /* Legal values for sh_type field of Elf64_Shdr. */
14261426
14271427 /* These two are primerily concerned with ECOFF debugging info. */
1428−#define SHT_ALPHA_DEBUG 0x70000001
1429−#define SHT_ALPHA_REGINFO 0x70000002
1428+#define SHT_ALPHA_DEBUG 0x70000001
1429+#define SHT_ALPHA_REGINFO 0x70000002
14301430
14311431 /* Legal values for sh_flags field of Elf64_Shdr. */
14321432
1433−#define SHF_ALPHA_GPREL 0x10000000
1433+#define SHF_ALPHA_GPREL 0x10000000
14341434
14351435 /* Legal values for st_other field of Elf64_Sym. */
1436−#define STO_ALPHA_NOPV 0x80 /* No PV required. */
1437−#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
1436+#define STO_ALPHA_NOPV 0x80 /* No PV required. */
1437+#define STO_ALPHA_STD_GPLOAD 0x88 /* PV only used for initial ldgp. */
14381438
14391439 /* Alpha relocs. */
14401440
1441−#define R_ALPHA_NONE 0 /* No reloc */
1442−#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
1443−#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
1444−#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
1445−#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
1446−#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
1447−#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
1448−#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
1449−#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
1450−#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
1451−#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
1452−#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
1453−#define R_ALPHA_OP_PUSH 12 /* OP stack push */
1454−#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
1455−#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
1456−#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
1457−#define R_ALPHA_GPVALUE 16
1458−#define R_ALPHA_GPRELHIGH 17
1459−#define R_ALPHA_GPRELLOW 18
1460−#define R_ALPHA_IMMED_GP_16 19
1461−#define R_ALPHA_IMMED_GP_HI32 20
1462−#define R_ALPHA_IMMED_SCN_HI32 21
1463−#define R_ALPHA_IMMED_BR_HI32 22
1464−#define R_ALPHA_IMMED_LO32 23
1465−#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
1466−#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
1467−#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
1468−#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
1441+#define R_ALPHA_NONE 0 /* No reloc */
1442+#define R_ALPHA_REFLONG 1 /* Direct 32 bit */
1443+#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */
1444+#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */
1445+#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */
1446+#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */
1447+#define R_ALPHA_GPDISP 6 /* Add displacement to GP */
1448+#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */
1449+#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */
1450+#define R_ALPHA_SREL16 9 /* PC relative 16 bit */
1451+#define R_ALPHA_SREL32 10 /* PC relative 32 bit */
1452+#define R_ALPHA_SREL64 11 /* PC relative 64 bit */
1453+#define R_ALPHA_OP_PUSH 12 /* OP stack push */
1454+#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */
1455+#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */
1456+#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */
1457+#define R_ALPHA_GPVALUE 16
1458+#define R_ALPHA_GPRELHIGH 17
1459+#define R_ALPHA_GPRELLOW 18
1460+#define R_ALPHA_IMMED_GP_16 19
1461+#define R_ALPHA_IMMED_GP_HI32 20
1462+#define R_ALPHA_IMMED_SCN_HI32 21
1463+#define R_ALPHA_IMMED_BR_HI32 22
1464+#define R_ALPHA_IMMED_LO32 23
1465+#define R_ALPHA_COPY 24 /* Copy symbol at runtime */
1466+#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */
1467+#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */
1468+#define R_ALPHA_RELATIVE 27 /* Adjust by program base */
14691469 /* Keep this the last entry. */
1470−#define R_ALPHA_NUM 28
1470+#define R_ALPHA_NUM 28
14711471
14721472
14731473 /* PowerPC specific declarations */
14741474
14751475 /* PowerPC relocations defined by the ABIs */
1476−#define R_PPC_NONE 0
1477−#define R_PPC_ADDR32 1 /* 32bit absolute address */
1478−#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
1479−#define R_PPC_ADDR16 3 /* 16bit absolute address */
1480−#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
1481−#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
1482−#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
1483−#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
1484−#define R_PPC_ADDR14_BRTAKEN 8
1485−#define R_PPC_ADDR14_BRNTAKEN 9
1486−#define R_PPC_REL24 10 /* PC relative 26 bit */
1487−#define R_PPC_REL14 11 /* PC relative 16 bit */
1488−#define R_PPC_REL14_BRTAKEN 12
1489−#define R_PPC_REL14_BRNTAKEN 13
1490−#define R_PPC_GOT16 14
1491−#define R_PPC_GOT16_LO 15
1492−#define R_PPC_GOT16_HI 16
1493−#define R_PPC_GOT16_HA 17
1494−#define R_PPC_PLTREL24 18
1495−#define R_PPC_COPY 19
1496−#define R_PPC_GLOB_DAT 20
1497−#define R_PPC_JMP_SLOT 21
1498−#define R_PPC_RELATIVE 22
1499−#define R_PPC_LOCAL24PC 23
1500−#define R_PPC_UADDR32 24
1501−#define R_PPC_UADDR16 25
1502−#define R_PPC_REL32 26
1503−#define R_PPC_PLT32 27
1504−#define R_PPC_PLTREL32 28
1505−#define R_PPC_PLT16_LO 29
1506−#define R_PPC_PLT16_HI 30
1507−#define R_PPC_PLT16_HA 31
1508−#define R_PPC_SDAREL16 32
1509−#define R_PPC_SECTOFF 33
1510−#define R_PPC_SECTOFF_LO 34
1511−#define R_PPC_SECTOFF_HI 35
1512−#define R_PPC_SECTOFF_HA 36
1476+#define R_PPC_NONE 0
1477+#define R_PPC_ADDR32 1 /* 32bit absolute address */
1478+#define R_PPC_ADDR24 2 /* 26bit address, 2 bits ignored. */
1479+#define R_PPC_ADDR16 3 /* 16bit absolute address */
1480+#define R_PPC_ADDR16_LO 4 /* lower 16bit of absolute address */
1481+#define R_PPC_ADDR16_HI 5 /* high 16bit of absolute address */
1482+#define R_PPC_ADDR16_HA 6 /* adjusted high 16bit */
1483+#define R_PPC_ADDR14 7 /* 16bit address, 2 bits ignored */
1484+#define R_PPC_ADDR14_BRTAKEN 8
1485+#define R_PPC_ADDR14_BRNTAKEN 9
1486+#define R_PPC_REL24 10 /* PC relative 26 bit */
1487+#define R_PPC_REL14 11 /* PC relative 16 bit */
1488+#define R_PPC_REL14_BRTAKEN 12
1489+#define R_PPC_REL14_BRNTAKEN 13
1490+#define R_PPC_GOT16 14
1491+#define R_PPC_GOT16_LO 15
1492+#define R_PPC_GOT16_HI 16
1493+#define R_PPC_GOT16_HA 17
1494+#define R_PPC_PLTREL24 18
1495+#define R_PPC_COPY 19
1496+#define R_PPC_GLOB_DAT 20
1497+#define R_PPC_JMP_SLOT 21
1498+#define R_PPC_RELATIVE 22
1499+#define R_PPC_LOCAL24PC 23
1500+#define R_PPC_UADDR32 24
1501+#define R_PPC_UADDR16 25
1502+#define R_PPC_REL32 26
1503+#define R_PPC_PLT32 27
1504+#define R_PPC_PLTREL32 28
1505+#define R_PPC_PLT16_LO 29
1506+#define R_PPC_PLT16_HI 30
1507+#define R_PPC_PLT16_HA 31
1508+#define R_PPC_SDAREL16 32
1509+#define R_PPC_SECTOFF 33
1510+#define R_PPC_SECTOFF_LO 34
1511+#define R_PPC_SECTOFF_HI 35
1512+#define R_PPC_SECTOFF_HA 36
15131513 /* Keep this the last entry. */
1514−#define R_PPC_NUM 37
1514+#define R_PPC_NUM 37
15151515
15161516 /* The remaining relocs are from the Embedded ELF ABI, and are not
15171517 in the SVR4 ELF ABI. */
1518−#define R_PPC_EMB_NADDR32 101
1519−#define R_PPC_EMB_NADDR16 102
1520−#define R_PPC_EMB_NADDR16_LO 103
1521−#define R_PPC_EMB_NADDR16_HI 104
1522−#define R_PPC_EMB_NADDR16_HA 105
1523−#define R_PPC_EMB_SDAI16 106
1524−#define R_PPC_EMB_SDA2I16 107
1525−#define R_PPC_EMB_SDA2REL 108
1526−#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
1527−#define R_PPC_EMB_MRKREF 110
1528−#define R_PPC_EMB_RELSEC16 111
1529−#define R_PPC_EMB_RELST_LO 112
1530−#define R_PPC_EMB_RELST_HI 113
1531−#define R_PPC_EMB_RELST_HA 114
1532−#define R_PPC_EMB_BIT_FLD 115
1533−#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
1518+#define R_PPC_EMB_NADDR32 101
1519+#define R_PPC_EMB_NADDR16 102
1520+#define R_PPC_EMB_NADDR16_LO 103
1521+#define R_PPC_EMB_NADDR16_HI 104
1522+#define R_PPC_EMB_NADDR16_HA 105
1523+#define R_PPC_EMB_SDAI16 106
1524+#define R_PPC_EMB_SDA2I16 107
1525+#define R_PPC_EMB_SDA2REL 108
1526+#define R_PPC_EMB_SDA21 109 /* 16 bit offset in SDA */
1527+#define R_PPC_EMB_MRKREF 110
1528+#define R_PPC_EMB_RELSEC16 111
1529+#define R_PPC_EMB_RELST_LO 112
1530+#define R_PPC_EMB_RELST_HI 113
1531+#define R_PPC_EMB_RELST_HA 114
1532+#define R_PPC_EMB_BIT_FLD 115
1533+#define R_PPC_EMB_RELSDA 116 /* 16 bit relative offset in SDA */
15341534
15351535 /* Diab tool relocations. */
1536−#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
1537−#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
1538−#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
1539−#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
1540−#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
1541−#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
1536+#define R_PPC_DIAB_SDA21_LO 180 /* like EMB_SDA21, but lower 16 bit */
1537+#define R_PPC_DIAB_SDA21_HI 181 /* like EMB_SDA21, but high 16 bit */
1538+#define R_PPC_DIAB_SDA21_HA 182 /* like EMB_SDA21, adjusted high 16 */
1539+#define R_PPC_DIAB_RELSDA_LO 183 /* like EMB_RELSDA, but lower 16 bit */
1540+#define R_PPC_DIAB_RELSDA_HI 184 /* like EMB_RELSDA, but high 16 bit */
1541+#define R_PPC_DIAB_RELSDA_HA 185 /* like EMB_RELSDA, adjusted high 16 */
15421542
15431543 /* This is a phony reloc to handle any old fashioned TOC16 references
15441544 that may still be in object files. */
1545−#define R_PPC_TOC16 255
1545+#define R_PPC_TOC16 255
15461546
15471547
15481548 /* ARM specific declarations */
@@ -1554,7 +1554,7 @@ typedef Elf32_Addr Elf32_Conflict; · 5 unmodified lines
15541554 #define EF_ARM_APCS_26 0x08
15551555 #define EF_ARM_APCS_FLOAT 0x10
15561556 #define EF_ARM_PIC 0x20
1557−#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
1557+#define EF_ALIGN8 0x40 /* 8-bit structure alignment is in use */
15581558 #define EF_NEW_ABI 0x80
15591559 #define EF_OLD_ABI 0x100
15601560
@@ -1564,70 +1564,70 @@ typedef Elf32_Addr Elf32_Conflict; · 3 unmodified lines
15641564 /* ARM-specific values for sh_flags */
15651565 #define SHF_ARM_ENTRYSECT 0x10000000 /* Section contains an entry point */
15661566 #define SHF_ARM_COMDEF 0x80000000 /* Section may be multiply defined
1567− in the input to a link step */
1567+ in the input to a link step */
15681568
15691569 /* ARM-specific program header flags */
15701570 #define PF_ARM_SB 0x10000000 /* Segment contains the location
1571− addressed by the static base */
1571+ addressed by the static base */
15721572
15731573 /* ARM relocs. */
1574−#define R_ARM_NONE 0 /* No reloc */
1575−#define R_ARM_PC24 1 /* PC relative 26 bit branch */
1576−#define R_ARM_ABS32 2 /* Direct 32 bit */
1577−#define R_ARM_REL32 3 /* PC relative 32 bit */
1578−#define R_ARM_PC13 4
1579−#define R_ARM_ABS16 5 /* Direct 16 bit */
1580−#define R_ARM_ABS12 6 /* Direct 12 bit */
1581−#define R_ARM_THM_ABS5 7
1582−#define R_ARM_ABS8 8 /* Direct 8 bit */
1583−#define R_ARM_SBREL32 9
1584−#define R_ARM_THM_PC22 10
1585−#define R_ARM_THM_PC8 11
1586−#define R_ARM_AMP_VCALL9 12
1587−#define R_ARM_SWI24 13
1588−#define R_ARM_THM_SWI8 14
1589−#define R_ARM_XPC25 15
1590−#define R_ARM_THM_XPC22 16
1591−#define R_ARM_COPY 20 /* Copy symbol at runtime */
1592−#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
1593−#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
1594−#define R_ARM_RELATIVE 23 /* Adjust by program base */
1574+#define R_ARM_NONE 0 /* No reloc */
1575+#define R_ARM_PC24 1 /* PC relative 26 bit branch */
1576+#define R_ARM_ABS32 2 /* Direct 32 bit */
1577+#define R_ARM_REL32 3 /* PC relative 32 bit */
1578+#define R_ARM_PC13 4
1579+#define R_ARM_ABS16 5 /* Direct 16 bit */
1580+#define R_ARM_ABS12 6 /* Direct 12 bit */
1581+#define R_ARM_THM_ABS5 7
1582+#define R_ARM_ABS8 8 /* Direct 8 bit */
1583+#define R_ARM_SBREL32 9
1584+#define R_ARM_THM_PC22 10
1585+#define R_ARM_THM_PC8 11
1586+#define R_ARM_AMP_VCALL9 12
1587+#define R_ARM_SWI24 13
1588+#define R_ARM_THM_SWI8 14
1589+#define R_ARM_XPC25 15
1590+#define R_ARM_THM_XPC22 16
1591+#define R_ARM_COPY 20 /* Copy symbol at runtime */
1592+#define R_ARM_GLOB_DAT 21 /* Create GOT entry */
1593+#define R_ARM_JUMP_SLOT 22 /* Create PLT entry */
1594+#define R_ARM_RELATIVE 23 /* Adjust by program base */
15951595 #define R_ARM_GOTOFF32 24 /* 32 bit offset to GOT */
15961596 #define R_ARM_BASE_PREL 25 /* 32 bit PC relative offset to GOT */
15971597 #define R_ARM_GOT_BREL 26 /* 32 bit GOT entry */
1598−#define R_ARM_PLT32 27 /* 32 bit PLT address */
1598+#define R_ARM_PLT32 27 /* 32 bit PLT address */
15991599 #define R_ARM_CALL 28
16001600 #define R_ARM_JUMP24 29
16011601 #define R_ARM_PREL31 42
1602−#define R_ARM_GNU_VTENTRY 100
1603−#define R_ARM_GNU_VTINHERIT 101
1604−#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
1605−#define R_ARM_THM_PC9 103 /* thumb conditional branch */
1606−#define R_ARM_RXPC25 249
1607−#define R_ARM_RSBREL32 250
1608−#define R_ARM_THM_RPC22 251
1609−#define R_ARM_RREL32 252
1610−#define R_ARM_RABS22 253
1611−#define R_ARM_RPC24 254
1612−#define R_ARM_RBASE 255
1602+#define R_ARM_GNU_VTENTRY 100
1603+#define R_ARM_GNU_VTINHERIT 101
1604+#define R_ARM_THM_PC11 102 /* thumb unconditional branch */
1605+#define R_ARM_THM_PC9 103 /* thumb conditional branch */
1606+#define R_ARM_RXPC25 249
1607+#define R_ARM_RSBREL32 250
1608+#define R_ARM_THM_RPC22 251
1609+#define R_ARM_RREL32 252
1610+#define R_ARM_RABS22 253
1611+#define R_ARM_RPC24 254
1612+#define R_ARM_RBASE 255
16131613 /* Keep this the last entry. */
1614−#define R_ARM_NUM 256
1614+#define R_ARM_NUM 256
16151615
16161616 /* TMS320C67xx specific declarations */
16171617 /* XXX: no ELF standard yet */
16181618
16191619 /* TMS320C67xx relocs. */
16201620 #define R_C60_32 1
1621−#define R_C60_GOT32 3 /* 32 bit GOT entry */
1622−#define R_C60_PLT32 4 /* 32 bit PLT address */
1623−#define R_C60_COPY 5 /* Copy symbol at runtime */
1624−#define R_C60_GLOB_DAT 6 /* Create GOT entry */
1625−#define R_C60_JMP_SLOT 7 /* Create PLT entry */
1626−#define R_C60_RELATIVE 8 /* Adjust by program base */
1627−#define R_C60_GOTOFF 9 /* 32 bit offset to GOT */
1628−#define R_C60_GOTPC 10 /* 32 bit PC relative offset to GOT */
1621+#define R_C60_GOT32 3 /* 32 bit GOT entry */
1622+#define R_C60_PLT32 4 /* 32 bit PLT address */
1623+#define R_C60_COPY 5 /* Copy symbol at runtime */
1624+#define R_C60_GLOB_DAT 6 /* Create GOT entry */
1625+#define R_C60_JMP_SLOT 7 /* Create PLT entry */
1626+#define R_C60_RELATIVE 8 /* Adjust by program base */
1627+#define R_C60_GOTOFF 9 /* 32 bit offset to GOT */
1628+#define R_C60_GOTPC 10 /* 32 bit PC relative offset to GOT */
16291629
16301630 #define R_C60HI16 0x55 // high 16 bit MVKH embedded
16311631 #define R_C60LO16 0x54 // low 16 bit MVKL embedded
16321632
1633−#endif /* elf.h */
1633+#endif /* elf.h */
tcc.c+52−48
@@ -38,11 +38,11 @@ · 37 unmodified lines
3838 #include <fcntl.h>
3939 #include <setjmp.h>
4040 #include <time.h>
41−#ifdef WIN32
41+#ifdef _WIN32
4242 #include <sys/timeb.h>
4343 // #include <windows.h>
4444 #endif
45−#ifndef WIN32
45+#ifndef _WIN32
4646 #include <sys/time.h>
4747 #include <sys/ucontext.h>
4848 #include <sys/mman.h>
@@ -86,12 +86,12 @@ · 37 unmodified lines
8686 #define TCC_TARGET_I386
8787 #endif
8888
89−#if !defined(WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \
89+#if !defined(_WIN32) && !defined(TCC_UCLIBC) && !defined(TCC_TARGET_ARM) && \
9090 !defined(TCC_TARGET_C67)
9191 #define CONFIG_TCC_BCHECK /* enable bound checking code */
9292 #endif
9393
94−#if defined(WIN32) && !defined(TCC_TARGET_PE)
94+#if defined(_WIN32) && !defined(TCC_TARGET_PE)
9595 #define CONFIG_TCC_STATIC
9696 #endif
9797
@@ -722,7 +722,7 @@ static const char tcc_keywords[] = · 624 unmodified lines
722722
723723 #define TOK_UIDENT TOK_DEFINE
724724
725−#ifdef WIN32
725+#ifdef _WIN32
726726 int __stdcall GetModuleFileNameA(void *, char *, int);
727727 void *__stdcall GetProcAddress(void *, const char *);
728728 void *__stdcall GetModuleHandleA(const char *);
@@ -967,7 +967,7 @@ void *resolve_sym(TCCState *s1, const char *symbol, int type) · 238 unmodified lines
967967 return NULL;
968968 }
969969
970−#elif !defined(WIN32)
970+#elif !defined(_WIN32)
971971
972972 #include <dlfcn.h>
973973
@@ -1035,7 +1035,7 @@ static int strstart(const char *str, const char *val, const char **ptr) · 61 unmodified lines
10351035 return 1;
10361036 }
10371037
1038−#ifdef WIN32
1038+#ifdef _WIN32
10391039 char *normalize_slashes(char *path)
10401040 {
10411041 char *p;
@@ -1053,14 +1053,28 @@ char *w32_tcc_lib_path(void) · 11 unmodified lines
10531053 GetModuleFileNameA(NULL, path, sizeof path);
10541054 p = tcc_basename(normalize_slashes(strlwr(path)));
10551055 if (p - 5 > path && 0 == strncmp(p - 5, "/bin/", 5))
1056− p -= 5;
1056+ p -= 5;
10571057 else if (p > path)
1058− p--;
1058+ p--;
10591059 *p = 0;
10601060 return strdup(path);
10611061 }
10621062 #endif
10631063
1064+void set_pages_executable(void *ptr, unsigned long length)
1065+{
1066+#ifdef _WIN32
1067+ unsigned long old_protect;
1068+ VirtualProtect(ptr, length, PAGE_EXECUTE_READWRITE, &old_protect);
1069+#else
1070+ unsigned long start, end;
1071+ start = (unsigned long)ptr & ~(PAGESIZE - 1);
1072+ end = (unsigned long)ptr + length;
1073+ end = (end + PAGESIZE - 1) & ~(PAGESIZE - 1);
1074+ mprotect((void *)start, end - start, PROT_READ | PROT_WRITE | PROT_EXEC);
1075+#endif
1076+}
1077+
10641078 /* memory management */
10651079 #ifdef MEM_DEBUG
10661080 int mem_cur_size;
@@ -1887,7 +1901,9 @@ BufferedFile *tcc_open(TCCState *s1, const char *filename) · 820 unmodified lines
18871901 bf->buf_end = bf->buffer;
18881902 bf->buffer[0] = CH_EOB; /* put eob symbol */
18891903 pstrcpy(bf->filename, sizeof(bf->filename), filename);
1904+#ifdef _WIN32
18901905 normalize_slashes(bf->filename);
1906+#endif
18911907 bf->line_num = 1;
18921908 bf->ifndef_macro = 0;
18931909 bf->ifdef_stack_ptr = s1->ifdef_stack_ptr;
@@ -3566,16 +3582,16 @@ static inline void next_nomacro1(void) · 1672 unmodified lines
35663582 {
35673583 TCCState *s1 = tcc_state;
35683584 if ((parse_flags & PARSE_FLAG_LINEFEED)
3569− && !(tok_flags & TOK_FLAG_EOF)) {
3570− tok_flags |= TOK_FLAG_EOF;
3585+ && !(tok_flags & TOK_FLAG_EOF)) {
3586+ tok_flags |= TOK_FLAG_EOF;
35713587 tok = TOK_LINEFEED;
3572− goto keep_tok_flags;
3588+ goto keep_tok_flags;
35733589 } else if (s1->include_stack_ptr == s1->include_stack ||
35743590 !(parse_flags & PARSE_FLAG_PREPROCESS)) {
35753591 /* no include left : end of file. */
35763592 tok = TOK_EOF;
35773593 } else {
3578− tok_flags &= ~TOK_FLAG_EOF;
3594+ tok_flags &= ~TOK_FLAG_EOF;
35793595 /* pop include file */
35803596
35813597 /* test if previous '#endif' was after a #ifdef at
@@ -3603,13 +3619,13 @@ static inline void next_nomacro1(void) · 21 unmodified lines
36033619 break;
36043620
36053621 case '\n':
3606− file->line_num++;
3607− tok_flags |= TOK_FLAG_BOL;
3608− p++;
3622+ file->line_num++;
3623+ tok_flags |= TOK_FLAG_BOL;
3624+ p++;
36093625 if (0 == (parse_flags & PARSE_FLAG_LINEFEED))
36103626 goto redo_no_start;
36113627 tok = TOK_LINEFEED;
3612− goto keep_tok_flags;
3628+ goto keep_tok_flags;
36133629
36143630 case '#':
36153631 /* XXX: simplify */
@@ -4168,8 +4184,8 @@ static int macro_subst_tok(TokenString *tok_str, · 552 unmodified lines
41684184 parlevel++;
41694185 else if (tok == ')')
41704186 parlevel--;
4171− if (tok != TOK_LINEFEED)
4172− tok_str_add2(&str, tok, &tokc);
4187+ if (tok != TOK_LINEFEED)
4188+ tok_str_add2(&str, tok, &tokc);
41734189 next_nomacro();
41744190 }
41754191 tok_str_add(&str, 0);
@@ -9388,6 +9404,9 @@ static int tcc_compile(TCCState *s1) · 5212 unmodified lines
93889404 ELF32_ST_INFO(STB_LOCAL, STT_SECTION), 0,
93899405 text_section->sh_num, NULL);
93909406 getcwd(buf, sizeof(buf));
9407+#ifdef _WIN32
9408+ normalize_slashes(buf);
9409+#endif
93919410 pstrcat(buf, sizeof(buf), "/");
93929411 put_stabs_r(buf, N_SO, 0, 0,
93939412 text_section->data_offset, text_section, section_sym);
@@ -9489,9 +9508,9 @@ static int tcc_preprocess(TCCState *s1) · 95 unmodified lines
94899508 break;
94909509 } else if (tok == TOK_LINEFEED) {
94919510 last_is_space = 1;
9492− } else {
9493− if (!last_is_space)
9494− fputc(' ', s1->outfile);
9511+ } else {
9512+ if (!last_is_space)
9513+ fputc(' ', s1->outfile);
94959514 last_is_space = 0;
94969515 }
94979516 fputs(get_tok_str(tok, &tokc), s1->outfile);
@@ -9724,7 +9743,7 @@ static void rt_printline(unsigned long wanted_pc) · 226 unmodified lines
97249743 fprintf(stderr, "\n");
97259744 }
97269745
9727−#if !defined(WIN32) && !defined(CONFIG_TCCBOOT)
9746+#if !defined(_WIN32) && !defined(CONFIG_TCCBOOT)
97289747
97299748 #ifdef __i386__
97309749
@@ -9888,24 +9907,8 @@ int tcc_relocate(TCCState *s1) · 157 unmodified lines
98889907 for(i = 1; i < s1->nb_sections; i++) {
98899908 s = s1->sections[i];
98909909 if ((s->sh_flags & (SHF_ALLOC | SHF_EXECINSTR)) ==
9891− (SHF_ALLOC | SHF_EXECINSTR)) {
9892−#ifdef WIN32
9893− {
9894− unsigned long old_protect;
9895− VirtualProtect(s->data, s->data_offset,
9896− PAGE_EXECUTE_READWRITE, &old_protect);
9897− }
9898−#else
9899− {
9900− unsigned long start, end;
9901− start = (unsigned long)(s->data) & ~(PAGESIZE - 1);
9902− end = (unsigned long)(s->data + s->data_offset);
9903− end = (end + PAGESIZE - 1) & ~(PAGESIZE - 1);
9904− mprotect((void *)start, end - start,
9905− PROT_READ | PROT_WRITE | PROT_EXEC);
9906− }
9907−#endif
9908− }
9910+ (SHF_ALLOC | SHF_EXECINSTR))
9911+ set_pages_executable(s->data, s->data_offset);
99099912 }
99109913 return 0;
99119914 }
@@ -9921,7 +9924,7 @@ int tcc_run(TCCState *s1, int argc, char **argv) · 9 unmodified lines
99219924 prog_main = tcc_get_symbol_err(s1, "main");
99229925
99239926 if (do_debug) {
9924−#if defined(WIN32) || defined(CONFIG_TCCBOOT)
9927+#if defined(_WIN32) || defined(CONFIG_TCCBOOT)
99259928 error("debug mode currently not available for Windows");
99269929 #else
99279930 struct sigaction sigact;
@@ -10022,6 +10025,7 @@ TCCState *tcc_new(void) · 94 unmodified lines
1002210025 tcc_define_symbol(s, "__PTRDIFF_TYPE__", "int");
1002310026 #ifdef TCC_TARGET_PE
1002410027 tcc_define_symbol(s, "__WCHAR_TYPE__", "unsigned short");
10028+ tcc_define_symbol(s, "_WIN32", NULL);
1002510029 #else
1002610030 tcc_define_symbol(s, "__WCHAR_TYPE__", "int");
1002710031 #endif
@@ -10461,7 +10465,7 @@ static char *tcc_basename(const char *name) · 433 unmodified lines
1046110465 char *p = strchr(name, 0);
1046210466 while (p > name
1046310467 && p[-1] != '/'
10464−#ifdef WIN32
10468+#ifdef _WIN32
1046510469 && p[-1] != '\\'
1046610470 #endif
1046710471 )
@@ -10473,7 +10477,7 @@ static char *tcc_basename(const char *name) · 5 unmodified lines
1047310477
1047410478 static int64_t getclock_us(void)
1047510479 {
10476−#ifdef WIN32
10480+#ifdef _WIN32
1047710481 struct _timeb tb;
1047810482 _ftime(&tb);
1047910483 return (tb.time * 1000LL + tb.millitm) * 1000LL;
@@ -10849,7 +10853,7 @@ int main(int argc, char **argv) · 369 unmodified lines
1084910853 char objfilename[1024];
1085010854 int64_t start_time = 0;
1085110855
10852−#ifdef WIN32
10856+#ifdef _WIN32
1085310857 tcc_lib_path = w32_tcc_lib_path();
1085410858 #endif
1085510859
@@ -10898,7 +10902,7 @@ int main(int argc, char **argv) · 42 unmodified lines
1089810902 }
1089910903 } else if (output_type != TCC_OUTPUT_MEMORY) {
1090010904 if (!outfile) {
10901− /* compute default outfile name */
10905+ /* compute default outfile name */
1090210906 pstrcpy(objfilename, sizeof(objfilename) - 1,
1090310907 /* strip path */
1090410908 tcc_basename(files[0]));
@@ -10907,10 +10911,10 @@ int main(int argc, char **argv) · 2 unmodified lines
1090710911 #else
1090810912 if (output_type == TCC_OUTPUT_OBJ && !reloc_output) {
1090910913 char *ext = strrchr(objfilename, '.');
10910− if (!ext)
10914+ if (!ext)
1091110915 goto default_outfile;
1091210916 /* add .o extension */
10913− strcpy(ext + 1, "o");
10917+ strcpy(ext + 1, "o");
1091410918 } else {
1091510919 default_outfile:
1091610920 pstrcpy(objfilename, sizeof(objfilename), "a.out");
tccpe.c+523−523
@@ -28,31 +28,31 @@ int verbose = 0; · 27 unmodified lines
2828
2929 /* definitions below are from winnt.h */
3030
31−typedef struct _IMAGE_DOS_HEADER { /* DOS .EXE header */
32− WORD e_magic; /* Magic number */
33− WORD e_cblp; /* Bytes on last page of file */
34− WORD e_cp; /* Pages in file */
35− WORD e_crlc; /* Relocations */
36− WORD e_cparhdr; /* Size of header in paragraphs */
37− WORD e_minalloc; /* Minimum extra paragraphs needed */
38− WORD e_maxalloc; /* Maximum extra paragraphs needed */
39− WORD e_ss; /* Initial (relative) SS value */
40− WORD e_sp; /* Initial SP value */
41− WORD e_csum; /* Checksum */
42− WORD e_ip; /* Initial IP value */
43− WORD e_cs; /* Initial (relative) CS value */
44− WORD e_lfarlc; /* File address of relocation table */
45− WORD e_ovno; /* Overlay number */
46− WORD e_res[4]; /* Reserved words */
47− WORD e_oemid; /* OEM identifier (for e_oeminfo) */
48− WORD e_oeminfo; /* OEM information; e_oemid specific */
49− WORD e_res2[10]; /* Reserved words */
50− DWORD e_lfanew; /* File address of new exe header */
31+typedef struct _IMAGE_DOS_HEADER { /* DOS .EXE header */
32+ WORD e_magic; /* Magic number */
33+ WORD e_cblp; /* Bytes on last page of file */
34+ WORD e_cp; /* Pages in file */
35+ WORD e_crlc; /* Relocations */
36+ WORD e_cparhdr; /* Size of header in paragraphs */
37+ WORD e_minalloc; /* Minimum extra paragraphs needed */
38+ WORD e_maxalloc; /* Maximum extra paragraphs needed */
39+ WORD e_ss; /* Initial (relative) SS value */
40+ WORD e_sp; /* Initial SP value */
41+ WORD e_csum; /* Checksum */
42+ WORD e_ip; /* Initial IP value */
43+ WORD e_cs; /* Initial (relative) CS value */
44+ WORD e_lfarlc; /* File address of relocation table */
45+ WORD e_ovno; /* Overlay number */
46+ WORD e_res[4]; /* Reserved words */
47+ WORD e_oemid; /* OEM identifier (for e_oeminfo) */
48+ WORD e_oeminfo; /* OEM information; e_oemid specific */
49+ WORD e_res2[10]; /* Reserved words */
50+ DWORD e_lfanew; /* File address of new exe header */
5151 BYTE e_code[0x40];
5252
5353 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
5454
55−#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
55+#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
5656 #define SIZE_OF_NT_SIGNATURE 4
5757
5858 typedef struct _IMAGE_FILE_HEADER {
@@ -113,22 +113,22 @@ typedef struct _IMAGE_OPTIONAL_HEADER { · 54 unmodified lines
113113 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
114114
115115
116−#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 /* Export Directory */
117−#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 /* Import Directory */
118−#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 /* Resource Directory */
119−#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 /* Exception Directory */
120−#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 /* Security Directory */
121−#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 /* Base Relocation Table */
122−#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 /* Debug Directory */
116+#define IMAGE_DIRECTORY_ENTRY_EXPORT 0 /* Export Directory */
117+#define IMAGE_DIRECTORY_ENTRY_IMPORT 1 /* Import Directory */
118+#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 /* Resource Directory */
119+#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 /* Exception Directory */
120+#define IMAGE_DIRECTORY_ENTRY_SECURITY 4 /* Security Directory */
121+#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 /* Base Relocation Table */
122+#define IMAGE_DIRECTORY_ENTRY_DEBUG 6 /* Debug Directory */
123123 /* IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 (X86 usage) */
124−#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 /* Architecture Specific Data */
125−#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* RVA of GP */
126−#define IMAGE_DIRECTORY_ENTRY_TLS 9 /* TLS Directory */
127−#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 /* Load Configuration Directory */
128−#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 /* Bound Import Directory in headers */
129−#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
130−#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 /* Delay Load Import Descriptors */
131−#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 /* COM Runtime descriptor */
124+#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7 /* Architecture Specific Data */
125+#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* RVA of GP */
126+#define IMAGE_DIRECTORY_ENTRY_TLS 9 /* TLS Directory */
127+#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 /* Load Configuration Directory */
128+#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 /* Bound Import Directory in headers */
129+#define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
130+#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 /* Delay Load Import Descriptors */
131+#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 /* COM Runtime descriptor */
132132
133133 /* Section header format. */
134134 #define IMAGE_SIZEOF_SHORT_NAME 8
@@ -136,8 +136,8 @@ typedef struct _IMAGE_OPTIONAL_HEADER { · 1 unmodified line
136136 typedef struct _IMAGE_SECTION_HEADER {
137137 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
138138 union {
139− DWORD PhysicalAddress;
140− DWORD VirtualSize;
139+ DWORD PhysicalAddress;
140+ DWORD VirtualSize;
141141 } Misc;
142142 DWORD VirtualAddress;
143143 DWORD SizeOfRawData;
@@ -173,28 +173,28 @@ typedef struct _IMAGE_BASE_RELOCATION { · 29 unmodified lines
173173
174174 /* ----------------------------------------------------------- */
175175 IMAGE_DOS_HEADER pe_dos_hdr = {
176− 0x5A4D, /*WORD e_magic; Magic number */
177− 0x0090, /*WORD e_cblp; Bytes on last page of file */
178− 0x0003, /*WORD e_cp; Pages in file */
179− 0x0000, /*WORD e_crlc; Relocations */
180−
181− 0x0004, /*WORD e_cparhdr; Size of header in paragraphs */
182− 0x0000, /*WORD e_minalloc; Minimum extra paragraphs needed */
183− 0xFFFF, /*WORD e_maxalloc; Maximum extra paragraphs needed */
184− 0x0000, /*WORD e_ss; Initial (relative) SS value */
185−
186− 0x00B8, /*WORD e_sp; Initial SP value */
187− 0x0000, /*WORD e_csum; Checksum */
188− 0x0000, /*WORD e_ip; Initial IP value */
189− 0x0000, /*WORD e_cs; Initial (relative) CS value */
190− 0x0040, /*WORD e_lfarlc; File address of relocation table */
191− 0x0000, /*WORD e_ovno; Overlay number */
192− {0, 0, 0, 0}, /*WORD e_res[4]; Reserved words */
193− 0x0000, /*WORD e_oemid; OEM identifier (for e_oeminfo) */
194− 0x0000, /*WORD e_oeminfo; OEM information; e_oemid specific */
195− {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*WORD e_res2[10]; Reserved words */
196− 0x00000080, /*DWORD e_lfanew; File address of new exe header */
197− { /* 14 code bytes + "This program cannot be run in DOS mode.\r\r\n$" + 6 * 0x00 */
176+ 0x5A4D, /*WORD e_magic; Magic number */
177+ 0x0090, /*WORD e_cblp; Bytes on last page of file */
178+ 0x0003, /*WORD e_cp; Pages in file */
179+ 0x0000, /*WORD e_crlc; Relocations */
180+
181+ 0x0004, /*WORD e_cparhdr; Size of header in paragraphs */
182+ 0x0000, /*WORD e_minalloc; Minimum extra paragraphs needed */
183+ 0xFFFF, /*WORD e_maxalloc; Maximum extra paragraphs needed */
184+ 0x0000, /*WORD e_ss; Initial (relative) SS value */
185+
186+ 0x00B8, /*WORD e_sp; Initial SP value */
187+ 0x0000, /*WORD e_csum; Checksum */
188+ 0x0000, /*WORD e_ip; Initial IP value */
189+ 0x0000, /*WORD e_cs; Initial (relative) CS value */
190+ 0x0040, /*WORD e_lfarlc; File address of relocation table */
191+ 0x0000, /*WORD e_ovno; Overlay number */
192+ {0, 0, 0, 0}, /*WORD e_res[4]; Reserved words */
193+ 0x0000, /*WORD e_oemid; OEM identifier (for e_oeminfo) */
194+ 0x0000, /*WORD e_oeminfo; OEM information; e_oemid specific */
195+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, /*WORD e_res2[10]; Reserved words */
196+ 0x00000080, /*DWORD e_lfanew; File address of new exe header */
197+ { /* 14 code bytes + "This program cannot be run in DOS mode.\r\r\n$" + 6 * 0x00 */
198198 /*0040 */ 0x0e, 0x1f, 0xba, 0x0e, 0x00, 0xb4, 0x09, 0xcd, 0x21, 0xb8,
199199 0x01, 0x4c, 0xcd, 0x21, 0x54, 0x68,
200200 /*0050 */ 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d,
@@ -210,49 +210,49 @@ IMAGE_DOS_HEADER pe_dos_hdr = { · 9 unmodified lines
210210 DWORD pe_magic = IMAGE_NT_SIGNATURE;
211211
212212 IMAGE_FILE_HEADER pe_file_hdr = {
213− 0x014C, /*WORD Machine; */
214− 0x0003, /*WORD NumberOfSections; */
215− 0x00000000, /*DWORD TimeDateStamp; */
216− 0x00000000, /*DWORD PointerToSymbolTable; */
217− 0x00000000, /*DWORD NumberOfSymbols; */
218− 0x00E0, /*WORD SizeOfOptionalHeader; */
219− 0x030F /*WORD Characteristics; */
213+ 0x014C, /*WORD Machine; */
214+ 0x0003, /*WORD NumberOfSections; */
215+ 0x00000000, /*DWORD TimeDateStamp; */
216+ 0x00000000, /*DWORD PointerToSymbolTable; */
217+ 0x00000000, /*DWORD NumberOfSymbols; */
218+ 0x00E0, /*WORD SizeOfOptionalHeader; */
219+ 0x030F /*WORD Characteristics; */
220220 };
221221
222222 IMAGE_OPTIONAL_HEADER32 pe_opt_hdr = {
223223 /* Standard fields. */
224− 0x010B, /*WORD Magic; */
225− 0x06, /*BYTE MajorLinkerVersion; */
226− 0x00, /*BYTE MinorLinkerVersion; */
227− 0x00000000, /*DWORD SizeOfCode; */
228− 0x00000000, /*DWORD SizeOfInitializedData; */
229− 0x00000000, /*DWORD SizeOfUninitializedData; */
230− 0x00000000, /*DWORD AddressOfEntryPoint; */
231− 0x00000000, /*DWORD BaseOfCode; */
232− 0x00000000, /*DWORD BaseOfData; */
224+ 0x010B, /*WORD Magic; */
225+ 0x06, /*BYTE MajorLinkerVersion; */
226+ 0x00, /*BYTE MinorLinkerVersion; */
227+ 0x00000000, /*DWORD SizeOfCode; */
228+ 0x00000000, /*DWORD SizeOfInitializedData; */
229+ 0x00000000, /*DWORD SizeOfUninitializedData; */
230+ 0x00000000, /*DWORD AddressOfEntryPoint; */
231+ 0x00000000, /*DWORD BaseOfCode; */
232+ 0x00000000, /*DWORD BaseOfData; */
233233
234234 /* NT additional fields. */
235− 0x00400000, /*DWORD ImageBase; */
236− 0x00001000, /*DWORD SectionAlignment; */
237− 0x00000200, /*DWORD FileAlignment; */
238− 0x0004, /*WORD MajorOperatingSystemVersion; */
239− 0x0000, /*WORD MinorOperatingSystemVersion; */
240− 0x0000, /*WORD MajorImageVersion; */
241− 0x0000, /*WORD MinorImageVersion; */
242− 0x0004, /*WORD MajorSubsystemVersion; */
243− 0x0000, /*WORD MinorSubsystemVersion; */
244− 0x00000000, /*DWORD Win32VersionValue; */
245− 0x00000000, /*DWORD SizeOfImage; */
246− 0x00000200, /*DWORD SizeOfHeaders; */
247− 0x00000000, /*DWORD CheckSum; */
248− 0x0002, /*WORD Subsystem; */
249− 0x0000, /*WORD DllCharacteristics; */
250− 0x00100000, /*DWORD SizeOfStackReserve; */
251− 0x00001000, /*DWORD SizeOfStackCommit; */
252− 0x00100000, /*DWORD SizeOfHeapReserve; */
253− 0x00001000, /*DWORD SizeOfHeapCommit; */
254− 0x00000000, /*DWORD LoaderFlags; */
255− 0x00000010, /*DWORD NumberOfRvaAndSizes; */
235+ 0x00400000, /*DWORD ImageBase; */
236+ 0x00001000, /*DWORD SectionAlignment; */
237+ 0x00000200, /*DWORD FileAlignment; */
238+ 0x0004, /*WORD MajorOperatingSystemVersion; */
239+ 0x0000, /*WORD MinorOperatingSystemVersion; */
240+ 0x0000, /*WORD MajorImageVersion; */
241+ 0x0000, /*WORD MinorImageVersion; */
242+ 0x0004, /*WORD MajorSubsystemVersion; */
243+ 0x0000, /*WORD MinorSubsystemVersion; */
244+ 0x00000000, /*DWORD Win32VersionValue; */
245+ 0x00000000, /*DWORD SizeOfImage; */
246+ 0x00000200, /*DWORD SizeOfHeaders; */
247+ 0x00000000, /*DWORD CheckSum; */
248+ 0x0002, /*WORD Subsystem; */
249+ 0x0000, /*WORD DllCharacteristics; */
250+ 0x00100000, /*DWORD SizeOfStackReserve; */
251+ 0x00001000, /*DWORD SizeOfStackCommit; */
252+ 0x00100000, /*DWORD SizeOfHeapReserve; */
253+ 0x00001000, /*DWORD SizeOfHeapCommit; */
254+ 0x00000000, /*DWORD LoaderFlags; */
255+ 0x00000010, /*DWORD NumberOfRvaAndSizes; */
256256
257257 /* IMAGE_DATA_DIRECTORY DataDirectory[16]; */
258258 {{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},
@@ -314,13 +314,13 @@ enum { · 55 unmodified lines
314314 };
315315
316316 ST DWORD pe_flags[] = {
317− 0x60000020, /* ".text", */
318− 0xC0000040, /* ".data", */
319− 0xC0000080, /* ".bss", */
320− 0x40000040, /* ".rsrc", */
321− 0x42000040, /* ".reloc", */
322− 0x42000802, /* ".stab", */
323− 0x42000802 /* ".stabstr", */
317+ 0x60000020, /* ".text", */
318+ 0xC0000040, /* ".data", */
319+ 0xC0000080, /* ".bss", */
320+ 0x40000040, /* ".rsrc", */
321+ 0x42000040, /* ".reloc", */
322+ 0x42000802, /* ".stab", */
323+ 0x42000802 /* ".stabstr", */
324324 };
325325
326326 struct section_info {
@@ -384,20 +384,20 @@ ST int pe_find_import(TCCState * s1, const char *symbol, char *ret) · 57 unmodified lines
384384 {
385385 int sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
386386 if (0 == sym_index) {
387− /* Hm, maybe it's '_symbol' instead of 'symbol' or '__imp__symbol' */
388− char buffer[100];
389− if (0 == memcmp(symbol, "__imp__", 7))
390− symbol += 6;
391− else
392− buffer[0] = '_', strcpy(buffer + 1, symbol), symbol = buffer;
393− sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
387+ /* Hm, maybe it's '_symbol' instead of 'symbol' or '__imp__symbol' */
388+ char buffer[100];
389+ if (0 == memcmp(symbol, "__imp__", 7))
390+ symbol += 6;
391+ else
392+ buffer[0] = '_', strcpy(buffer + 1, symbol), symbol = buffer;
393+ sym_index = find_elf_sym(s1->dynsymtab_section, symbol);
394394 }
395395 if (ret)
396− strcpy(ret, symbol);
396+ strcpy(ret, symbol);
397397 return sym_index;
398398 }
399399
400−#ifdef WIN32
400+#ifdef _WIN32
401401 ST void **pe_imp;
402402 ST int nb_pe_imp;
403403
@@ -411,10 +411,10 @@ void *resolve_sym(struct TCCState *s1, const char *symbol, int type) · 7 unmodified lines
411411 void *hm;
412412
413413 if (sym_index) {
414− dll_index = ((Elf32_Sym *) s1->dynsymtab_section->data)[sym_index].
415− st_other;
414+ dll_index = ((Elf32_Sym *) s1->dynsymtab_section->data)[sym_index].
415+ st_other;
416416 dll_name = s1->loaded_dlls[dll_index]->name;
417− hm = GetModuleHandleA(dll_name);
417+ hm = GetModuleHandleA(dll_name);
418418 if (NULL == hm)
419419 hm = LoadLibraryA(dll_name);
420420 if (hm) {
@@ -432,20 +432,20 @@ void *resolve_sym(struct TCCState *s1, const char *symbol, int type) · 11 unmodified lines
432432
433433 #define for_sym_in_symtab(sym) \
434434 for (sym = (Elf32_Sym *)symtab_section->data + 1; \
435− sym < (Elf32_Sym *)(symtab_section->data + \
436− symtab_section->data_offset); \
437− ++sym)
435+ sym < (Elf32_Sym *)(symtab_section->data + \
436+ symtab_section->data_offset); \
437+ ++sym)
438438
439439 #define pe_set_datadir(dir,addr,size) \
440− pe_opt_hdr.DataDirectory[dir].VirtualAddress = addr, \
441− pe_opt_hdr.DataDirectory[dir].Size = size
440+ pe_opt_hdr.DataDirectory[dir].VirtualAddress = addr, \
441+ pe_opt_hdr.DataDirectory[dir].Size = size
442442
443443 /*----------------------------------------------------------------------------*/
444444 ST void dynarray_reset(void ***pp, int *n)
445445 {
446446 int i;
447447 for (i = 0; i < *n; ++i)
448− tcc_free((*pp)[i]);
448+ tcc_free((*pp)[i]);
449449 tcc_free(*pp);
450450 *pp = NULL;
451451 *n = 0;
@@ -455,8 +455,8 @@ ST int dynarray_assoc(void **pp, int n, int key) · 3 unmodified lines
455455 {
456456 int i;
457457 for (i = 0; i < n; ++i, ++pp)
458− if (key == **(int **) pp)
459− return i;
458+ if (key == **(int **) pp)
459+ return i;
460460 return -1;
461461 }
462462
@@ -476,7 +476,7 @@ ST void pe_fpad(FILE * fp, DWORD new_pos) · 13 unmodified lines
476476 {
477477 DWORD pos = ftell(fp);
478478 while (++pos <= new_pos)
479− fputc(0, fp);
479+ fputc(0, fp);
480480 }
481481
482482 ST DWORD pe_file_align(DWORD n)
@@ -493,7 +493,7 @@ ST void pe_align_section(Section * s, int a) · 10 unmodified lines
493493 {
494494 int i = s->data_offset & (a - 1);
495495 if (i)
496− section_ptr_add(s, a - i);
496+ section_ptr_add(s, a - i);
497497 }
498498
499499
@@ -508,104 +508,104 @@ ST int pe_write_pe(struct pe_info *pe) · 8 unmodified lines
508508
509509 op = fopen(pe->filename, "wb");
510510 if (NULL == op) {
511− error_noabort("could not create file: %s", pe->filename);
512− return 1;
511+ error_noabort("could not create file: %s", pe->filename);
512+ return 1;
513513 }
514514
515515 memset(&ish, 0, sizeof ish);
516516
517517 pe->sizeofheaders = pe_file_align(sizeof pe_dos_hdr
518− + sizeof pe_magic
519− + sizeof pe_file_hdr
520− + sizeof pe_opt_hdr
521− +
522− pe->sec_count *
523− sizeof(IMAGE_SECTION_HEADER)
524− );
518+ + sizeof pe_magic
519+ + sizeof pe_file_hdr
520+ + sizeof pe_opt_hdr
521+ +
522+ pe->sec_count *
523+ sizeof(IMAGE_SECTION_HEADER)
524+ );
525525
526526 file_offset = pe->sizeofheaders;
527527 pe_fpad(op, file_offset);
528528
529529 if (2 == verbose)
530− printf("-------------------------------"
531− "\n virt file size section" "\n");
530+ printf("-------------------------------"
531+ "\n virt file size section" "\n");
532532
533533 for (i = 0; i < pe->sec_count; ++i) {
534− struct section_info *si = pe->sh_info + i;
535− const char *sh_name = pe_sec_names[si->id];
536− unsigned long addr = si->sh_addr - pe->imagebase;
537− unsigned long size = si->sh_size;
538−
539− if (2 == verbose)
540− printf("%6lx %6lx %6lx %s\n",
541− addr, file_offset, size, sh_name);
542−
543− switch (si->id) {
544− case sec_text:
545− pe_opt_hdr.BaseOfCode = addr;
546− pe_opt_hdr.AddressOfEntryPoint = addr + pe->start_addr;
547− break;
548−
549− case sec_data:
550− pe_opt_hdr.BaseOfData = addr;
551− if (pe->imp_size) {
552− pe_set_datadir(IMAGE_DIRECTORY_ENTRY_IMPORT,
553− pe->imp_offs + addr, pe->imp_size);
554− pe_set_datadir(IMAGE_DIRECTORY_ENTRY_IAT,
555− pe->iat_offs + addr, pe->iat_size);
556− }
557− if (pe->exp_size) {
558− pe_set_datadir(IMAGE_DIRECTORY_ENTRY_EXPORT,
559− pe->exp_offs + addr, pe->exp_size);
560− }
561− break;
562−
563− case sec_bss:
564− break;
565−
566− case sec_reloc:
567− pe_set_datadir(IMAGE_DIRECTORY_ENTRY_BASERELOC, addr, size);
568− break;
569−
570− case sec_rsrc:
571− pe_set_datadir(IMAGE_DIRECTORY_ENTRY_RESOURCE, addr, size);
572− break;
573−
574− case sec_stab:
575− break;
576−
577− case sec_stabstr:
578− break;
579− }
580−
581− psh = &ish[sec_index++];
582− strcpy((char *) psh->Name, sh_name);
583−
584− psh->Characteristics = pe_flags[si->id];
585− psh->VirtualAddress = addr;
586− psh->Misc.VirtualSize = size;
587− pe_opt_hdr.SizeOfImage =
588− umax(psh->VirtualAddress + psh->Misc.VirtualSize,
589− pe_opt_hdr.SizeOfImage);
590−
591− if (si->data_size) {
592− psh->PointerToRawData = file_offset;
593− fwrite(si->data, 1, si->data_size, op);
594− file_offset = pe_file_align(file_offset + si->data_size);
595− psh->SizeOfRawData = file_offset - psh->PointerToRawData;
596− pe_fpad(op, file_offset);
597− }
534+ struct section_info *si = pe->sh_info + i;
535+ const char *sh_name = pe_sec_names[si->id];
536+ unsigned long addr = si->sh_addr - pe->imagebase;
537+ unsigned long size = si->sh_size;
538+
539+ if (2 == verbose)
540+ printf("%6lx %6lx %6lx %s\n",
541+ addr, file_offset, size, sh_name);
542+
543+ switch (si->id) {
544+ case sec_text:
545+ pe_opt_hdr.BaseOfCode = addr;
546+ pe_opt_hdr.AddressOfEntryPoint = addr + pe->start_addr;
547+ break;
548+
549+ case sec_data:
550+ pe_opt_hdr.BaseOfData = addr;
551+ if (pe->imp_size) {
552+ pe_set_datadir(IMAGE_DIRECTORY_ENTRY_IMPORT,
553+ pe->imp_offs + addr, pe->imp_size);
554+ pe_set_datadir(IMAGE_DIRECTORY_ENTRY_IAT,
555+ pe->iat_offs + addr, pe->iat_size);
556+ }
557+ if (pe->exp_size) {
558+ pe_set_datadir(IMAGE_DIRECTORY_ENTRY_EXPORT,
559+ pe->exp_offs + addr, pe->exp_size);
560+ }
561+ break;
562+
563+ case sec_bss:
564+ break;
565+
566+ case sec_reloc:
567+ pe_set_datadir(IMAGE_DIRECTORY_ENTRY_BASERELOC, addr, size);
568+ break;
569+
570+ case sec_rsrc:
571+ pe_set_datadir(IMAGE_DIRECTORY_ENTRY_RESOURCE, addr, size);
572+ break;
573+
574+ case sec_stab:
575+ break;
576+
577+ case sec_stabstr:
578+ break;
579+ }
580+
581+ psh = &ish[sec_index++];
582+ strcpy((char *) psh->Name, sh_name);
583+
584+ psh->Characteristics = pe_flags[si->id];
585+ psh->VirtualAddress = addr;
586+ psh->Misc.VirtualSize = size;
587+ pe_opt_hdr.SizeOfImage =
588+ umax(psh->VirtualAddress + psh->Misc.VirtualSize,
589+ pe_opt_hdr.SizeOfImage);
590+
591+ if (si->data_size) {
592+ psh->PointerToRawData = file_offset;
593+ fwrite(si->data, 1, si->data_size, op);
594+ file_offset = pe_file_align(file_offset + si->data_size);
595+ psh->SizeOfRawData = file_offset - psh->PointerToRawData;
596+ pe_fpad(op, file_offset);
597+ }
598598 }
599599
600− /*----------------------------------------------------- */
600+ /*----------------------------------------------------- */
601601
602602 pe_file_hdr.NumberOfSections = sec_index;
603603 pe_opt_hdr.SizeOfHeaders = pe->sizeofheaders;
604604 pe_opt_hdr.ImageBase = pe->imagebase;
605605 if (PE_DLL == pe_type)
606− pe_file_hdr.Characteristics = 0x230E;
606+ pe_file_hdr.Characteristics = 0x230E;
607607 else if (PE_GUI != pe_type)
608− pe_opt_hdr.Subsystem = 3;
608+ pe_opt_hdr.Subsystem = 3;
609609
610610 fseek(op, SEEK_SET, 0);
611611 fwrite(&pe_dos_hdr, 1, sizeof pe_dos_hdr, op);
@@ -613,13 +613,13 @@ ST int pe_write_pe(struct pe_info *pe) · 1 unmodified line
613613 fwrite(&pe_file_hdr, 1, sizeof pe_file_hdr, op);
614614 fwrite(&pe_opt_hdr, 1, sizeof pe_opt_hdr, op);
615615 for (i = 0; i < sec_index; ++i)
616− fwrite(&ish[i], 1, sizeof(IMAGE_SECTION_HEADER), op);
616+ fwrite(&ish[i], 1, sizeof(IMAGE_SECTION_HEADER), op);
617617 fclose(op);
618618
619619 if (2 == verbose)
620− printf("-------------------------------\n");
620+ printf("-------------------------------\n");
621621 if (verbose)
622− printf("<-- %s (%lu bytes)\n", pe->filename, file_offset);
622+ printf("<-- %s (%lu bytes)\n", pe->filename, file_offset);
623623
624624 return 0;
625625 }
@@ -633,12 +633,12 @@ ST int pe_add_import(struct pe_info *pe, int sym_index, DWORD offset) · 7 unmodified lines
633633 struct import_symbol *s;
634634
635635 dll_index =
636− ((Elf32_Sym *) pe->s1->dynsymtab_section->data)[sym_index].
637− st_other;
636+ ((Elf32_Sym *) pe->s1->dynsymtab_section->data)[sym_index].
637+ st_other;
638638 i = dynarray_assoc((void **) pe->imp_info, pe->imp_count, dll_index);
639639 if (-1 != i) {
640− p = pe->imp_info[i];
641− goto found_dll;
640+ p = pe->imp_info[i];
641+ goto found_dll;
642642 }
643643 p = tcc_mallocz(sizeof *p);
644644 p->dll_index = dll_index;
@@ -647,7 +647,7 @@ ST int pe_add_import(struct pe_info *pe, int sym_index, DWORD offset) · 2 unmodified lines
647647 found_dll:
648648 i = dynarray_assoc((void **) p->symbols, p->sym_count, sym_index);
649649 if (-1 != i)
650− goto found_sym;
650+ goto found_sym;
651651 s = tcc_mallocz(sizeof *s);
652652 s->sym_index = sym_index;
653653 s->offset = offset;
@@ -665,10 +665,10 @@ ST void pe_build_imports(struct pe_info *pe) · 11 unmodified lines
665665 int ndlls = pe->imp_count;
666666
667667 for (sym_cnt = i = 0; i < ndlls; ++i)
668− sym_cnt += pe->imp_info[i]->sym_count;
668+ sym_cnt += pe->imp_info[i]->sym_count;
669669
670670 if (0 == sym_cnt)
671− return;
671+ return;
672672
673673 pe_align_section(pe->thunk, 16);
674674
@@ -681,62 +681,62 @@ ST void pe_build_imports(struct pe_info *pe) · 6 unmodified lines
681681 thk_ptr = pe->iat_offs;
682682 ent_ptr = pe->iat_offs + pe->iat_size;
683683 for (i = 0; i < pe->imp_count; ++i) {
684− struct pe_import_header *hdr;
685− int k, n, v;
686− struct pe_import_info *p = pe->imp_info[i];
687− const char *name = pe->s1->loaded_dlls[p->dll_index]->name;
688−
689− /* put the dll name into the import header */
690− if (0 == strncmp(name, "lib", 3))
691− name += 3;
692− v = put_elf_str(pe->thunk, name);
693−
694− hdr = (struct pe_import_header *) (pe->thunk->data + dll_ptr);
695− hdr->first_thunk = thk_ptr + voffset;
696− hdr->first_entry = ent_ptr + voffset;
697− hdr->lib_name_offset = v + voffset;
698−
699− for (k = 0, n = p->sym_count; k <= n; ++k) {
700− if (k < n) {
701− DWORD offset = p->symbols[k]->offset;
702− int sym_index = p->symbols[k]->sym_index;
703− Elf32_Sym *sym =
704− (Elf32_Sym *) pe->s1->dynsymtab_section->data +
705− sym_index;
706− const char *name =
707− pe->s1->dynsymtab_section->link->data + sym->st_name;
708−
709− if (offset & 0x80000000) { /* ref to data */
710− Elf32_Sym *sym =
711− &((Elf32_Sym *) symtab_section->
712− data)[offset & 0x7FFFFFFF];
713− sym->st_value = thk_ptr;
714− sym->st_shndx = pe->thunk->sh_num;
715− } else { /* ref to function */
716−
717− char buffer[100];
718− sprintf(buffer, "IAT.%s", name);
719− sym_index =
720− put_elf_sym(symtab_section, thk_ptr, sizeof(DWORD),
721− ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT),
722− 0, pe->thunk->sh_num, buffer);
723−
724− put_elf_reloc(symtab_section, text_section, offset, R_386_32, /*R_JMP_SLOT, */
725− sym_index);
726− }
727− v = pe->thunk->data_offset + voffset;
728− section_ptr_add(pe->thunk, sizeof(WORD)); /* hint, not used */
729− put_elf_str(pe->thunk, name);
730− } else {
731− v = 0; // last entry is zero
732− }
733− *(DWORD *) (pe->thunk->data + thk_ptr) =
734− *(DWORD *) (pe->thunk->data + ent_ptr) = v;
735− thk_ptr += sizeof(DWORD);
736− ent_ptr += sizeof(DWORD);
737− }
738− dll_ptr += sizeof(struct pe_import_header);
739− dynarray_reset((void ***) &p->symbols, &p->sym_count);
684+ struct pe_import_header *hdr;
685+ int k, n, v;
686+ struct pe_import_info *p = pe->imp_info[i];
687+ const char *name = pe->s1->loaded_dlls[p->dll_index]->name;
688+
689+ /* put the dll name into the import header */
690+ if (0 == strncmp(name, "lib", 3))
691+ name += 3;
692+ v = put_elf_str(pe->thunk, name);
693+
694+ hdr = (struct pe_import_header *) (pe->thunk->data + dll_ptr);
695+ hdr->first_thunk = thk_ptr + voffset;
696+ hdr->first_entry = ent_ptr + voffset;
697+ hdr->lib_name_offset = v + voffset;
698+
699+ for (k = 0, n = p->sym_count; k <= n; ++k) {
700+ if (k < n) {
701+ DWORD offset = p->symbols[k]->offset;
702+ int sym_index = p->symbols[k]->sym_index;
703+ Elf32_Sym *sym =
704+ (Elf32_Sym *) pe->s1->dynsymtab_section->data +
705+ sym_index;
706+ const char *name =
707+ pe->s1->dynsymtab_section->link->data + sym->st_name;
708+
709+ if (offset & 0x80000000) { /* ref to data */
710+ Elf32_Sym *sym =
711+ &((Elf32_Sym *) symtab_section->
712+ data)[offset & 0x7FFFFFFF];
713+ sym->st_value = thk_ptr;
714+ sym->st_shndx = pe->thunk->sh_num;
715+ } else { /* ref to function */
716+
717+ char buffer[100];
718+ sprintf(buffer, "IAT.%s", name);
719+ sym_index =
720+ put_elf_sym(symtab_section, thk_ptr, sizeof(DWORD),
721+ ELF32_ST_INFO(STB_GLOBAL, STT_OBJECT),
722+ 0, pe->thunk->sh_num, buffer);
723+
724+ put_elf_reloc(symtab_section, text_section, offset, R_386_32, /*R_JMP_SLOT, */
725+ sym_index);
726+ }
727+ v = pe->thunk->data_offset + voffset;
728+ section_ptr_add(pe->thunk, sizeof(WORD)); /* hint, not used */
729+ put_elf_str(pe->thunk, name);
730+ } else {
731+ v = 0; // last entry is zero
732+ }
733+ *(DWORD *) (pe->thunk->data + thk_ptr) =
734+ *(DWORD *) (pe->thunk->data + ent_ptr) = v;
735+ thk_ptr += sizeof(DWORD);
736+ ent_ptr += sizeof(DWORD);
737+ }
738+ dll_ptr += sizeof(struct pe_import_header);
739+ dynarray_reset((void ***) &p->symbols, &p->sym_count);
740740 }
741741 dynarray_reset((void ***) &pe->imp_info, &pe->imp_count);
742742 }
@@ -771,15 +771,15 @@ ST void pe_build_exports(struct pe_info *pe) · 28 unmodified lines
771771 }
772772
773773 if (0 == sym_count)
774− return;
774+ return;
775775
776776 qsort (sorted, sym_count, sizeof sorted[0], sym_cmp);
777777 pe_align_section(pe->thunk, 16);
778778
779779 pe->exp_offs = pe->thunk->data_offset;
780780 hdr = section_ptr_add(pe->thunk,
781− sizeof(struct pe_export_header) +
782− sym_count * (2 * sizeof(DWORD) + sizeof(WORD)));
781+ sizeof(struct pe_export_header) +
782+ sym_count * (2 * sizeof(DWORD) + sizeof(WORD)));
783783
784784 func_offset = pe->exp_offs + sizeof(struct pe_export_header);
785785
@@ -803,10 +803,10 @@ ST void pe_build_exports(struct pe_info *pe) · 17 unmodified lines
803803 pname = p + sym_count + ord;
804804 pord = (WORD *)(p + 2*sym_count) + ord;
805805 *pfunc = sym->st_value + pe->s1->sections[sym->st_shndx]->sh_addr - pe->imagebase;
806− *pname = pe->thunk->data_offset + voffset;
806+ *pname = pe->thunk->data_offset + voffset;
807807 *pord = ord;
808− put_elf_str(pe->thunk, name);
809− /* printf("export: %s\n", name); */
808+ put_elf_str(pe->thunk, name);
809+ /* printf("export: %s\n", name); */
810810 }
811811 pe->exp_size = pe->thunk->data_offset - pe->exp_offs;
812812 tcc_free(sorted);
@@ -814,7 +814,7 @@ ST void pe_build_exports(struct pe_info *pe) · 1 unmodified line
814814
815815 /* ------------------------------------------------------------- */
816816 ST void pe_build_reloc(struct pe_info *pe, int *section_order,
817− int section_count)
817+ int section_count)
818818 {
819819 DWORD offset, block_ptr, addr;
820820 int count, i;
@@ -823,45 +823,45 @@ ST void pe_build_reloc(struct pe_info *pe, int *section_order, · 2 unmodified lines
823823 offset = addr = block_ptr = count = i = 0;
824824 rel = rel_end = NULL;
825825 for (;;) {
826− if (rel < rel_end) {
827− int type = ELF32_R_TYPE(rel->r_info);
828− addr = rel->r_offset + s->sh_addr;
829− ++rel;
830− if (type != R_386_32)
831− continue;
832− if (count == 0) { /* new block */
833− block_ptr = pe->reloc->data_offset;
834− section_ptr_add(pe->reloc, sizeof(struct pe_reloc_header));
835− offset = addr & 0xFFFFFFFF << 12;
836− }
837− if ((addr -= offset) < (1 << 12)) { /* one block spans 4k addresses */
838− WORD *wp = section_ptr_add(pe->reloc, sizeof(WORD));
839− *wp = addr | IMAGE_REL_BASED_HIGHLOW << 12;
840− ++count;
841− continue;
842− }
843− --rel;
844− } else if (i < section_count) {
845− sr = (s = pe->s1->sections[section_order[i++]])->reloc;
846− if (sr) {
847− rel = (Elf32_Rel *) sr->data;
848− rel_end = (Elf32_Rel *) (sr->data + sr->data_offset);
849− }
850− continue;
851− }
852−
853− if (count) { /* store the last block and ready for a new one */
854− struct pe_reloc_header *hdr;
855− if (count & 1)
856− section_ptr_add(pe->reloc, 2), ++count;
857− hdr = (struct pe_reloc_header *) (pe->reloc->data + block_ptr);
858− hdr->offset = offset - pe->imagebase;
859− hdr->size =
860− count * sizeof(WORD) + sizeof(struct pe_reloc_header);
861− count = 0;
862− }
863− if (rel >= rel_end)
864− break;
826+ if (rel < rel_end) {
827+ int type = ELF32_R_TYPE(rel->r_info);
828+ addr = rel->r_offset + s->sh_addr;
829+ ++rel;
830+ if (type != R_386_32)
831+ continue;
832+ if (count == 0) { /* new block */
833+ block_ptr = pe->reloc->data_offset;
834+ section_ptr_add(pe->reloc, sizeof(struct pe_reloc_header));
835+ offset = addr & 0xFFFFFFFF << 12;
836+ }
837+ if ((addr -= offset) < (1 << 12)) { /* one block spans 4k addresses */
838+ WORD *wp = section_ptr_add(pe->reloc, sizeof(WORD));
839+ *wp = addr | IMAGE_REL_BASED_HIGHLOW << 12;
840+ ++count;
841+ continue;
842+ }
843+ --rel;
844+ } else if (i < section_count) {
845+ sr = (s = pe->s1->sections[section_order[i++]])->reloc;
846+ if (sr) {
847+ rel = (Elf32_Rel *) sr->data;
848+ rel_end = (Elf32_Rel *) (sr->data + sr->data_offset);
849+ }
850+ continue;
851+ }
852+
853+ if (count) { /* store the last block and ready for a new one */
854+ struct pe_reloc_header *hdr;
855+ if (count & 1)
856+ section_ptr_add(pe->reloc, 2), ++count;
857+ hdr = (struct pe_reloc_header *) (pe->reloc->data + block_ptr);
858+ hdr->offset = offset - pe->imagebase;
859+ hdr->size =
860+ count * sizeof(WORD) + sizeof(struct pe_reloc_header);
861+ count = 0;
862+ }
863+ if (rel >= rel_end)
864+ break;
865865 }
866866 }
867867
@@ -877,50 +877,50 @@ ST int pe_assign_addresses(struct pe_info *pe) · 9 unmodified lines
877877 addr = pe->imagebase + 1;
878878
879879 if (PE_DLL == pe_type)
880− pe->reloc = new_section(pe->s1, ".reloc", SHT_DYNAMIC, SHF_ALLOC);
880+ pe->reloc = new_section(pe->s1, ".reloc", SHT_DYNAMIC, SHF_ALLOC);
881881
882882 for (n = k = 0; n < pe_sec_number; ++n) {
883− for (i = 1; i < pe->s1->nb_sections; ++i) {
884− Section *s = pe->s1->sections[i];
885− if (0 == strcmp(s->name, pe_sec_names[n])) {
886− struct section_info *si = &pe->sh_info[pe->sec_count];
883+ for (i = 1; i < pe->s1->nb_sections; ++i) {
884+ Section *s = pe->s1->sections[i];
885+ if (0 == strcmp(s->name, pe_sec_names[n])) {
886+ struct section_info *si = &pe->sh_info[pe->sec_count];
887887 #ifdef PE_MERGE_DATA
888− if (n == sec_bss && si_data) {
889− /* append .bss to .data */
890− s->sh_addr = addr = ((addr - 1) | 15) + 1;
891− addr += s->data_offset;
892− si_data->sh_size = addr - si_data->sh_addr;
893− } else
888+ if (n == sec_bss && si_data) {
889+ /* append .bss to .data */
890+ s->sh_addr = addr = ((addr - 1) | 15) + 1;
891+ addr += s->data_offset;
892+ si_data->sh_size = addr - si_data->sh_addr;
893+ } else
894894 #endif
895− {
896− si->sh_addr = s->sh_addr = addr =
897− pe_virtual_align(addr);
898− si->id = n;
899−
900− if (n == sec_data) {
901− pe->thunk = s;
902− si_data = si;
903− pe_build_imports(pe);
904− pe_build_exports(pe);
905− } else if (n == sec_reloc) {
906− pe_build_reloc(pe, section_order, k);
907− }
908−
909− if (s->data_offset) {
910− if (n != sec_bss) {
911− si->data = s->data;
912− si->data_size = s->data_offset;
913− }
914−
915− addr += s->data_offset;
916− si->sh_size = s->data_offset;
917− ++pe->sec_count;
918− }
919− //printf("Section %08X %04X %s\n", si->sh_addr, si->data_size, s->name);
920− }
921− section_order[k] = i, ++k;
922− }
923− }
895+ {
896+ si->sh_addr = s->sh_addr = addr =
897+ pe_virtual_align(addr);
898+ si->id = n;
899+
900+ if (n == sec_data) {
901+ pe->thunk = s;
902+ si_data = si;
903+ pe_build_imports(pe);
904+ pe_build_exports(pe);
905+ } else if (n == sec_reloc) {
906+ pe_build_reloc(pe, section_order, k);
907+ }
908+
909+ if (s->data_offset) {
910+ if (n != sec_bss) {
911+ si->data = s->data;
912+ si->data_size = s->data_offset;
913+ }
914+
915+ addr += s->data_offset;
916+ si->sh_size = s->data_offset;
917+ ++pe->sec_count;
918+ }
919+ //printf("Section %08X %04X %s\n", si->sh_addr, si->data_size, s->name);
920+ }
921+ section_order[k] = i, ++k;
922+ }
923+ }
924924 }
925925 return 0;
926926 }
@@ -934,38 +934,38 @@ ST int pe_check_symbols(struct pe_info *pe) · 7 unmodified lines
934934 pe_align_section(text_section, 8);
935935
936936 for_sym_in_symtab(sym) {
937− if (sym->st_shndx == SHN_UNDEF) {
938− const char *symbol = symtab_section->link->data + sym->st_name;
939− unsigned type = ELF32_ST_TYPE(sym->st_info);
940− int sym_index = pe_find_import(pe->s1, symbol, NULL);
941− if (sym_index) {
942− if (type == STT_FUNC) {
943− unsigned long offset = text_section->data_offset;
944− if (pe_add_import(pe, sym_index, offset + 2)) {
945− /* add the 'jmp IAT[x]' instruction */
946− *(WORD *) section_ptr_add(text_section, 8) =
947− 0x25FF;
948− /* patch the symbol */
949− sym->st_shndx = text_section->sh_num;
950− sym->st_value = offset;
951− continue;
952− }
953− } else if (type == STT_OBJECT) { /* data, ptr to that should be */
954− if (pe_add_import(pe, sym_index,
955− (sym -
956− (Elf32_Sym *) symtab_section->data) |
937+ if (sym->st_shndx == SHN_UNDEF) {
938+ const char *symbol = symtab_section->link->data + sym->st_name;
939+ unsigned type = ELF32_ST_TYPE(sym->st_info);
940+ int sym_index = pe_find_import(pe->s1, symbol, NULL);
941+ if (sym_index) {
942+ if (type == STT_FUNC) {
943+ unsigned long offset = text_section->data_offset;
944+ if (pe_add_import(pe, sym_index, offset + 2)) {
945+ /* add the 'jmp IAT[x]' instruction */
946+ *(WORD *) section_ptr_add(text_section, 8) =
947+ 0x25FF;
948+ /* patch the symbol */
949+ sym->st_shndx = text_section->sh_num;
950+ sym->st_value = offset;
951+ continue;
952+ }
953+ } else if (type == STT_OBJECT) { /* data, ptr to that should be */
954+ if (pe_add_import(pe, sym_index,
955+ (sym -
956+ (Elf32_Sym *) symtab_section->data) |
957957 0x80000000))
958− continue;
959− }
960− }
961− error_noabort("undefined symbol '%s'", symbol);
962− ret = 1;
963− } else
964− if (pe->s1->rdynamic
965− && ELF32_ST_BIND(sym->st_info) != STB_LOCAL) {
966− /* if -rdynamic option, then export all non local symbols */
967− sym->st_other |= 1;
968− }
958+ continue;
959+ }
960+ }
961+ error_noabort("undefined symbol '%s'", symbol);
962+ ret = 1;
963+ } else
964+ if (pe->s1->rdynamic
965+ && ELF32_ST_BIND(sym->st_info) != STB_LOCAL) {
966+ /* if -rdynamic option, then export all non local symbols */
967+ sym->st_other |= 1;
968+ }
969969 }
970970 return ret;
971971 }
@@ -973,7 +973,7 @@ ST int pe_check_symbols(struct pe_info *pe) · 1 unmodified line
973973 /*----------------------------------------------------------------------------*/
974974 #ifdef PE_PRINT_SECTIONS
975975 ST void pe_print_section(FILE * f, Section * s)
976−{ /* just if you'r curious */
976+{ /* just if you'r curious */
977977 BYTE *p, *e, b;
978978 int i, n, l, m;
979979 p = s->data;
@@ -982,76 +982,76 @@ ST void pe_print_section(FILE * f, Section * s) · 2 unmodified lines
982982
983983 fprintf(f, "section \"%s\"", s->name);
984984 if (s->link)
985− fprintf(f, "\nlink \"%s\"", s->link->name);
985+ fprintf(f, "\nlink \"%s\"", s->link->name);
986986 if (s->reloc)
987− fprintf(f, "\nreloc \"%s\"", s->reloc->name);
987+ fprintf(f, "\nreloc \"%s\"", s->reloc->name);
988988 fprintf(f, "\nv_addr %08X", s->sh_addr);
989989 fprintf(f, "\ncontents %08X", l);
990990 fprintf(f, "\n\n");
991991
992992 if (s->sh_type == SHT_NOBITS)
993− return;
993+ return;
994994
995995 if (s->sh_type == SHT_SYMTAB)
996− m = sizeof(Elf32_Sym);
996+ m = sizeof(Elf32_Sym);
997997 if (s->sh_type == SHT_REL)
998− m = sizeof(Elf32_Rel);
998+ m = sizeof(Elf32_Rel);
999999 else
1000− m = 16;
1000+ m = 16;
10011001
10021002 for (i = 0; i < l;) {
1003− fprintf(f, "%08X", i);
1004− for (n = 0; n < m; ++n) {
1005− if (n + i < l)
1006− fprintf(f, " %02X", p[i + n]);
1007− else
1008− fprintf(f, " ");
1009− }
1010−
1011− if (s->sh_type == SHT_SYMTAB) {
1012− Elf32_Sym *sym = (Elf32_Sym *) (p + i);
1013− const char *name = s->link->data + sym->st_name;
1014− fprintf(f,
1015− " name:%04X"
1016− " value:%04X"
1017− " size:%04X"
1018− " bind:%02X"
1019− " type:%02X"
1020− " other:%02X"
1021− " shndx:%04X"
1022− " \"%s\"",
1023− sym->st_name,
1024− sym->st_value,
1025− sym->st_size,
1026− ELF32_ST_BIND(sym->st_info),
1027− ELF32_ST_TYPE(sym->st_info),
1028− sym->st_other, sym->st_shndx, name);
1029− } else if (s->sh_type == SHT_REL) {
1030− Elf32_Rel *rel = (Elf32_Rel *) (p + i);
1031− Elf32_Sym *sym =
1032− (Elf32_Sym *) s->link->data + ELF32_R_SYM(rel->r_info);
1033− const char *name = s->link->link->data + sym->st_name;
1034− fprintf(f,
1035− " offset:%04X"
1036− " type:%02X"
1037− " symbol:%04X"
1038− " \"%s\"",
1039− rel->r_offset,
1040− ELF32_R_TYPE(rel->r_info),
1041− ELF32_R_SYM(rel->r_info), name);
1042− } else {
1043− fprintf(f, " ");
1044− for (n = 0; n < m; ++n) {
1045− if (n + i < l) {
1046− b = p[i + n];
1047− if (b < 32 || b >= 127)
1048− b = '.';
1049− fprintf(f, "%c", b);
1050− }
1051− }
1052− }
1053− i += m;
1054− fprintf(f, "\n");
1003+ fprintf(f, "%08X", i);
1004+ for (n = 0; n < m; ++n) {
1005+ if (n + i < l)
1006+ fprintf(f, " %02X", p[i + n]);
1007+ else
1008+ fprintf(f, " ");
1009+ }
1010+
1011+ if (s->sh_type == SHT_SYMTAB) {
1012+ Elf32_Sym *sym = (Elf32_Sym *) (p + i);
1013+ const char *name = s->link->data + sym->st_name;
1014+ fprintf(f,
1015+ " name:%04X"
1016+ " value:%04X"
1017+ " size:%04X"
1018+ " bind:%02X"
1019+ " type:%02X"
1020+ " other:%02X"
1021+ " shndx:%04X"
1022+ " \"%s\"",
1023+ sym->st_name,
1024+ sym->st_value,
1025+ sym->st_size,
1026+ ELF32_ST_BIND(sym->st_info),
1027+ ELF32_ST_TYPE(sym->st_info),
1028+ sym->st_other, sym->st_shndx, name);
1029+ } else if (s->sh_type == SHT_REL) {
1030+ Elf32_Rel *rel = (Elf32_Rel *) (p + i);
1031+ Elf32_Sym *sym =
1032+ (Elf32_Sym *) s->link->data + ELF32_R_SYM(rel->r_info);
1033+ const char *name = s->link->link->data + sym->st_name;
1034+ fprintf(f,
1035+ " offset:%04X"
1036+ " type:%02X"
1037+ " symbol:%04X"
1038+ " \"%s\"",
1039+ rel->r_offset,
1040+ ELF32_R_TYPE(rel->r_info),
1041+ ELF32_R_SYM(rel->r_info), name);
1042+ } else {
1043+ fprintf(f, " ");
1044+ for (n = 0; n < m; ++n) {
1045+ if (n + i < l) {
1046+ b = p[i + n];
1047+ if (b < 32 || b >= 127)
1048+ b = '.';
1049+ fprintf(f, "%c", b);
1050+ }
1051+ }
1052+ }
1053+ i += m;
1054+ fprintf(f, "\n");
10551055 }
10561056 fprintf(f, "\n\n");
10571057 }
@@ -1083,50 +1083,50 @@ int pe_load_def_file(TCCState * s1, FILE * fp) · 25 unmodified lines
10831083 int f = 0, sym_index;
10841084 char *p, line[120], dllname[40];
10851085 while (fgets(line, sizeof line, fp)) {
1086− p = strchr(line, 0);
1087− while (p > line && p[-1] <= ' ')
1088− --p;
1089− *p = 0;
1090− p = line;
1091− while (*p && *p <= ' ')
1092− ++p;
1093−
1094− if (*p && ';' != *p)
1095− switch (f) {
1096− case 0:
1086+ p = strchr(line, 0);
1087+ while (p > line && p[-1] <= ' ')
1088+ --p;
1089+ *p = 0;
1090+ p = line;
1091+ while (*p && *p <= ' ')
1092+ ++p;
1093+
1094+ if (*p && ';' != *p)
1095+ switch (f) {
1096+ case 0:
10971097 if (!pe_test_cmd((const char **)&p, "LIBRARY"))
1098− return -1;
1098+ return -1;
10991099 while (is_space(*p))
11001100 p++;
1101− pstrcpy(dllname, sizeof(dllname), p);
1102− ++f;
1103− continue;
1101+ pstrcpy(dllname, sizeof(dllname), p);
1102+ ++f;
1103+ continue;
11041104
1105− case 1:
1105+ case 1:
11061106 if (!pe_test_cmd((const char **)&p, "EXPORTS"))
1107− return -1;
1108− ++f;
1109− continue;
1110−
1111− case 2:
1112− dllref =
1113− tcc_malloc(sizeof(DLLReference) + strlen(dllname));
1114− strcpy(dllref->name, dllname);
1115− dllref->level = 0;
1116− dynarray_add((void ***) &s1->loaded_dlls,
1117− &s1->nb_loaded_dlls, dllref);
1118− ++f;
1119−
1120− default:
1121− /* tccpe needs to know from what dll it should import
1107+ return -1;
1108+ ++f;
1109+ continue;
1110+
1111+ case 2:
1112+ dllref =
1113+ tcc_malloc(sizeof(DLLReference) + strlen(dllname));
1114+ strcpy(dllref->name, dllname);
1115+ dllref->level = 0;
1116+ dynarray_add((void ***) &s1->loaded_dlls,
1117+ &s1->nb_loaded_dlls, dllref);
1118+ ++f;
1119+
1120+ default:
1121+ /* tccpe needs to know from what dll it should import
11221122 the sym */
1123− sym_index = add_elf_sym(s1->dynsymtab_section,
1124− 0, 0, ELF32_ST_INFO(STB_GLOBAL,
1125− STT_FUNC),
1123+ sym_index = add_elf_sym(s1->dynsymtab_section,
1124+ 0, 0, ELF32_ST_INFO(STB_GLOBAL,
1125+ STT_FUNC),
11261126 s1->nb_loaded_dlls - 1,
1127− text_section->sh_num, p);
1128− continue;
1129− }
1127+ text_section->sh_num, p);
1128+ continue;
1129+ }
11301130 }
11311131 return 0;
11321132 }
@@ -1156,7 +1156,7 @@ unsigned long pe_add_runtime(TCCState * s1) · 23 unmodified lines
11561156 unsigned long addr;
11571157
11581158 if (find_elf_sym(symtab_section, "WinMain"))
1159− pe_type = PE_GUI;
1159+ pe_type = PE_GUI;
11601160 else
11611161 if (TCC_OUTPUT_DLL == s1->output_type)
11621162 {
@@ -1166,39 +1166,39 @@ unsigned long pe_add_runtime(TCCState * s1) · 3 unmodified lines
11661166 }
11671167
11681168 start_symbol =
1169− TCC_OUTPUT_MEMORY == s1->output_type
1170− ? PE_GUI == pe_type ? "_runwinmain" : NULL
1171− : PE_DLL == pe_type ? "_dllstart"
1172− : PE_GUI == pe_type ? "_winstart" : "_start";
1169+ TCC_OUTPUT_MEMORY == s1->output_type
1170+ ? PE_GUI == pe_type ? "_runwinmain" : NULL
1171+ : PE_DLL == pe_type ? "_dllstart"
1172+ : PE_GUI == pe_type ? "_winstart" : "_start";
11731173
11741174 /* grab the startup code from libtcc1 */
11751175 if (start_symbol)
1176− add_elf_sym(symtab_section,
1177− 0, 0,
1178− ELF32_ST_INFO(STB_GLOBAL, STT_NOTYPE), 0,
1179− SHN_UNDEF, start_symbol);
1176+ add_elf_sym(symtab_section,
1177+ 0, 0,
1178+ ELF32_ST_INFO(STB_GLOBAL, STT_NOTYPE), 0,
1179+ SHN_UNDEF, start_symbol);
11801180
11811181 if (0 == s1->nostdlib) {
1182− tcc_add_library(s1, "tcc1");
1183− tcc_add_library(s1, "msvcrt");
1184− if (PE_DLL == pe_type || PE_GUI == pe_type) {
1185− tcc_add_library(s1, "kernel32");
1186− tcc_add_library(s1, "user32");
1187− tcc_add_library(s1, "gdi32");
1188− }
1182+ tcc_add_library(s1, "tcc1");
1183+ tcc_add_library(s1, "msvcrt");
1184+ if (PE_DLL == pe_type || PE_GUI == pe_type) {
1185+ tcc_add_library(s1, "kernel32");
1186+ tcc_add_library(s1, "user32");
1187+ tcc_add_library(s1, "gdi32");
1188+ }
11891189 }
11901190
11911191 addr = start_symbol ?
1192− (unsigned long) tcc_get_symbol_err(s1, start_symbol) : 0;
1192+ (unsigned long) tcc_get_symbol_err(s1, start_symbol) : 0;
11931193
11941194 if (s1->output_type == TCC_OUTPUT_MEMORY && addr) {
1195− /* for -run GUI's, put '_runwinmain' instead of 'main' */
1196− add_elf_sym(symtab_section,
1197− addr, 0,
1198− ELF32_ST_INFO(STB_GLOBAL, STT_NOTYPE), 0,
1199− text_section->sh_num, "main");
1195+ /* for -run GUI's, put '_runwinmain' instead of 'main' */
1196+ add_elf_sym(symtab_section,
1197+ addr, 0,
1198+ ELF32_ST_INFO(STB_GLOBAL, STT_NOTYPE), 0,
1199+ text_section->sh_num, "main");
12001200
1201− /* FreeConsole(); */
1201+ /* FreeConsole(); */
12021202 }
12031203 return addr;
12041204 }
@@ -1213,29 +1213,29 @@ int tcc_output_pe(TCCState * s1, const char *filename) · 8 unmodified lines
12131213 pe.s1 = s1;
12141214 pe.start_addr = pe_add_runtime(s1);
12151215
1216− relocate_common_syms(); /* assign bss adresses */
1216+ relocate_common_syms(); /* assign bss adresses */
12171217 ret = pe_check_symbols(&pe);
12181218 if (0 == ret) {
1219− pe_assign_addresses(&pe);
1220− relocate_syms(s1, 0);
1221− for (i = 1; i < s1->nb_sections; ++i) {
1222− Section *s = s1->sections[i];
1223− if (s->reloc)
1224− relocate_section(s1, s);
1225− }
1226− ret = pe_write_pe(&pe);
1219+ pe_assign_addresses(&pe);
1220+ relocate_syms(s1, 0);
1221+ for (i = 1; i < s1->nb_sections; ++i) {
1222+ Section *s = s1->sections[i];
1223+ if (s->reloc)
1224+ relocate_section(s1, s);
1225+ }
1226+ ret = pe_write_pe(&pe);
12271227 }
12281228 #ifdef PE_PRINT_SECTIONS
12291229 {
1230− Section *s;
1231− FILE *f;
1230+ Section *s;
1231+ FILE *f;
12321232 f = fopen("tccpe.log", "wt");
1233− for (i = 1; i < s1->nb_sections; ++i) {
1234− s = s1->sections[i];
1235− pe_print_section(f, s);
1236− }
1237− pe_print_section(f, s1->dynsymtab_section);
1238− fclose(f);
1233+ for (i = 1; i < s1->nb_sections; ++i) {
1234+ s = s1->sections[i];
1235+ pe_print_section(f, s);
1236+ }
1237+ pe_print_section(f, s1->dynsymtab_section);
1238+ fclose(f);
12391239 }
12401240 #endif
12411241 return ret;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t