OpenADFortTk (including Open64 and OpenAnalysis references)
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
elf.h
Go to the documentation of this file.
1
2
/*
3
4
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
5
6
This program is free software; you can redistribute it and/or modify it
7
under the terms of version 2 of the GNU General Public License as
8
published by the Free Software Foundation.
9
10
This program is distributed in the hope that it would be useful, but
11
WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
14
Further, this software is distributed without any warranty that it is
15
free of the rightful claim of any third person regarding infringement
16
or the like. Any license provided herein, whether implied or
17
otherwise, applies only to this software file. Patent licenses, if
18
any, provided herein do not apply to combinations of this program with
19
other software, or any other product whatsoever.
20
21
You should have received a copy of the GNU General Public License along
22
with this program; if not, write the Free Software Foundation, Inc., 59
23
Temple Place - Suite 330, Boston MA 02111-1307, USA.
24
25
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
26
Mountain View, CA 94043, or:
27
28
http://www.sgi.com
29
30
For further information regarding this notice, see:
31
32
http://oss.sgi.com/projects/GenInfo/NoticeExplan
33
34
*/
35
36
#ifndef _ELF_H
37
#define _ELF_H 1
38
39
#if defined(__mips)
/* MIPS */
40
41
# include <../../usr/include/elf.h>
42
43
#else
44
45
/***************************************************************************/
46
/* eraxxon: Assume we always want this */
47
48
#if !(defined(__MIPS_AND_IA64_ELF_H))
49
# define __MIPS_AND_IA64_ELF_H 1
50
#endif
51
52
/***************************************************************************/
53
/* eraxxon: Manually declare needed stuff from cdefs.h */
54
55
#ifdef __BEGIN_DECLS
56
# undef __BEGIN_DECLS
57
#endif
58
59
#ifdef __END_DECLS
60
# undef __END_DECLS
61
#endif
62
63
#ifdef _DOTDOTDOT
64
# undef _DOTDOTDOT
65
#endif
66
67
#if defined(__cplusplus)
68
# define __BEGIN_DECLS extern "C" {
69
# define __END_DECLS };
70
# define _DOTDOTDOT ...
71
#else
72
# define __BEGIN_DECLS
73
# define __END_DECLS
74
# define _DOTDOTDOT
75
#endif
76
77
/***************************************************************************/
78
79
80
81
__BEGIN_DECLS
82
83
/* Standard ELF types. */
84
85
#include <inttypes.h>
86
/* #include <stdint.h> */
87
88
/* Type for a 16-bit quantity. */
89
typedef
uint16_t
Elf32_Half
;
90
typedef
uint16_t
Elf64_Half
;
91
92
/* Types for signed and unsigned 32-bit quantities. */
93
typedef
uint32_t
Elf32_Word
;
94
typedef
int32_t
Elf32_Sword
;
95
typedef
uint32_t
Elf64_Word
;
96
typedef
int32_t
Elf64_Sword
;
97
98
/* Types for signed and unsigned 64-bit quantities. */
99
typedef
uint64_t
Elf32_Xword
;
100
typedef
int64_t
Elf32_Sxword
;
101
typedef
uint64_t
Elf64_Xword
;
102
typedef
int64_t
Elf64_Sxword
;
103
104
/* Type of addresses. */
105
typedef
uint32_t
Elf32_Addr
;
106
typedef
uint64_t
Elf64_Addr
;
107
108
/* Type of file offsets. */
109
typedef
uint32_t
Elf32_Off
;
110
typedef
uint64_t
Elf64_Off
;
111
112
/* Type for section indices, which are 16-bit quantities. */
113
typedef
uint16_t
Elf32_Section
;
114
typedef
uint16_t
Elf64_Section
;
115
116
/* Type of symbol indices. */
117
typedef
uint32_t
Elf32_Symndx
;
118
typedef
uint64_t
Elf64_Symndx
;
119
120
#if defined(__MIPS_AND_IA64_ELF_H)
121
typedef
unsigned
char
Elf32_Byte
;
122
typedef
unsigned
char
Elf64_Byte
;
123
#endif
124
125
/* The ELF file header. This appears at the start of every ELF file. */
126
127
#define EI_NIDENT (16)
128
129
typedef
struct
130
{
131
unsigned
char
e_ident[
EI_NIDENT
];
/* Magic number and other info */
132
Elf32_Half
e_type
;
/* Object file type */
133
Elf32_Half
e_machine
;
/* Architecture */
134
Elf32_Word
e_version
;
/* Object file version */
135
Elf32_Addr
e_entry
;
/* Entry point virtual address */
136
Elf32_Off
e_phoff
;
/* Program header table file offset */
137
Elf32_Off
e_shoff
;
/* Section header table file offset */
138
Elf32_Word
e_flags
;
/* Processor-specific flags */
139
Elf32_Half
e_ehsize
;
/* ELF header size in bytes */
140
Elf32_Half
e_phentsize
;
/* Program header table entry size */
141
Elf32_Half
e_phnum
;
/* Program header table entry count */
142
Elf32_Half
e_shentsize
;
/* Section header table entry size */
143
Elf32_Half
e_shnum
;
/* Section header table entry count */
144
Elf32_Half
e_shstrndx
;
/* Section header string table index */
145
}
Elf32_Ehdr
;
146
147
typedef
struct
148
{
149
unsigned
char
e_ident[
EI_NIDENT
];
/* Magic number and other info */
150
Elf64_Half
e_type
;
/* Object file type */
151
Elf64_Half
e_machine
;
/* Architecture */
152
Elf64_Word
e_version
;
/* Object file version */
153
Elf64_Addr
e_entry
;
/* Entry point virtual address */
154
Elf64_Off
e_phoff
;
/* Program header table file offset */
155
Elf64_Off
e_shoff
;
/* Section header table file offset */
156
Elf64_Word
e_flags
;
/* Processor-specific flags */
157
Elf64_Half
e_ehsize
;
/* ELF header size in bytes */
158
Elf64_Half
e_phentsize
;
/* Program header table entry size */
159
Elf64_Half
e_phnum
;
/* Program header table entry count */
160
Elf64_Half
e_shentsize
;
/* Section header table entry size */
161
Elf64_Half
e_shnum
;
/* Section header table entry count */
162
Elf64_Half
e_shstrndx
;
/* Section header string table index */
163
}
Elf64_Ehdr
;
164
165
/* Fields in the e_ident array. The EI_* macros are indices into the
166
array. The macros under each EI_* macro are the values the byte
167
may have. */
168
169
#define EI_MAG0 0
/* File identification byte 0 index */
170
#define ELFMAG0 0x7f
/* Magic number byte 0 */
171
172
#define EI_MAG1 1
/* File identification byte 1 index */
173
#define ELFMAG1 'E'
/* Magic number byte 1 */
174
175
#define EI_MAG2 2
/* File identification byte 2 index */
176
#define ELFMAG2 'L'
/* Magic number byte 2 */
177
178
#define EI_MAG3 3
/* File identification byte 3 index */
179
#define ELFMAG3 'F'
/* Magic number byte 3 */
180
181
/* Conglomeration of the identification bytes, for easy testing as a word. */
182
#define ELFMAG "\177ELF"
183
#define SELFMAG 4
184
185
#define IS_ELF(ehdr) ((ehdr).e_ident[EI_MAG0] == ELFMAG0 && \
186
(ehdr).e_ident[EI_MAG1] == ELFMAG1 && \
187
(ehdr).e_ident[EI_MAG2] == ELFMAG2 && \
188
(ehdr).e_ident[EI_MAG3] == ELFMAG3)
189
190
#define EI_CLASS 4
/* File class byte index */
191
#define ELFCLASSNONE 0
/* Invalid class */
192
#define ELFCLASS32 1
/* 32-bit objects */
193
#define ELFCLASS64 2
/* 64-bit objects */
194
195
#define EI_DATA 5
/* Data encoding byte index */
196
#define ELFDATANONE 0
/* Invalid data encoding */
197
#define ELFDATA2LSB 1
/* 2's complement, little endian */
198
#define ELFDATA2MSB 2
/* 2's complement, big endian */
199
200
#define EI_VERSION 6
/* File version byte index */
201
/* Value must be EV_CURRENT */
202
203
#define EI_PAD 7
/* Byte index of padding bytes */
204
205
/* Legal values for e_type (object file type). */
206
207
#define ET_NONE 0
/* No file type */
208
#define ET_REL 1
/* Relocatable file */
209
#define ET_EXEC 2
/* Executable file */
210
#define ET_DYN 3
/* Shared object file */
211
#define ET_CORE 4
/* Core file */
212
#define ET_NUM 5
/* Number of defined types. */
213
#define ET_LOPROC 0xff00
/* Processor-specific */
214
#define ET_HIPROC 0xffff
/* Processor-specific */
215
216
#if defined(__MIPS_AND_IA64_ELF_H)
217
# define ET_IR (ET_LOPROC + 0)
/* file is a 32-bit or 64-bit WHIRL file*/
218
#endif
219
220
/* Legal values for e_machine (architecture). */
221
222
#define EM_NONE 0
/* No machine */
223
#define EM_M32 1
/* AT&T WE 32100 */
224
#define EM_SPARC 2
/* SUN SPARC */
225
#define EM_386 3
/* Intel 80386 */
226
#define EM_68K 4
/* Motorola m68k family */
227
#define EM_88K 5
/* Motorola m88k family */
228
#define EM_486 6
/* Intel 80486 */
229
#define EM_860 7
/* Intel 80860 */
230
#define EM_MIPS 8
/* MIPS R3000 big-endian */
231
#define EM_S370 9
/* Amdahl */
232
#define EM_MIPS_RS4_BE 10
/* MIPS R4000 big-endian */
233
234
#if defined(__MIPS_AND_IA64_ELF_H)
235
/* NOTE THAT THIS VALUE CLASHES WITH AN OFFICIAL ONE JUST ABOVE. */
236
#define EM_XIA64 10
/* Experimental IA64 objects
237
* used only by the simulator.
238
*/
239
#define EM_IA_64 50
/* Intel IA64 */
240
#define EM_EAS2_3 0x0406
241
#endif
242
243
#define EM_SPARC64 11
/* SPARC v9 (not official) 64-bit */
244
245
#define EM_PARISC 15
/* HPPA */
246
#define EM_PPC 20
/* PowerPC */
247
248
/* If it is necessary to assign new unofficial EM_* values, please
249
pick large random numbers (0x8523, 0xa7f2, etc.) to minimize the
250
chances of collision with official or non-GNU unofficial values. */
251
252
#define EM_ALPHA 0x9026
253
254
/* Legal values for e_version (version). */
255
256
#define EV_NONE 0
/* Invalid ELF version */
257
#define EV_CURRENT 1
/* Current version */
258
259
/* Section header. */
260
261
typedef
struct
262
{
263
Elf32_Word
sh_name
;
/* Section name (string tbl index) */
264
Elf32_Word
sh_type
;
/* Section type */
265
Elf32_Word
sh_flags
;
/* Section flags */
266
Elf32_Addr
sh_addr
;
/* Section virtual addr at execution */
267
Elf32_Off
sh_offset
;
/* Section file offset */
268
Elf32_Word
sh_size
;
/* Section size in bytes */
269
Elf32_Word
sh_link
;
/* Link to another section */
270
Elf32_Word
sh_info
;
/* Additional section information */
271
Elf32_Word
sh_addralign
;
/* Section alignment */
272
Elf32_Word
sh_entsize
;
/* Entry size if section holds table */
273
}
Elf32_Shdr
;
274
275
typedef
struct
276
{
277
Elf64_Word
sh_name
;
/* Section name (string tbl index) */
278
Elf64_Word
sh_type
;
/* Section type */
279
Elf64_Xword
sh_flags
;
/* Section flags */
280
Elf64_Addr
sh_addr
;
/* Section virtual addr at execution */
281
Elf64_Off
sh_offset
;
/* Section file offset */
282
Elf64_Xword
sh_size
;
/* Section size in bytes */
283
Elf64_Word
sh_link
;
/* Link to another section */
284
Elf64_Word
sh_info
;
/* Additional section information */
285
Elf64_Xword
sh_addralign
;
/* Section alignment */
286
Elf64_Xword
sh_entsize
;
/* Entry size if section holds table */
287
}
Elf64_Shdr
;
288
289
290
/* eraxxon: a special section only for IRIX */
291
#if defined(__mips)
292
#define MIPS_LBSS ".lbss"
293
#endif
294
295
#if defined(__MIPS_AND_IA64_ELF_H)
296
/* Special section names */
297
#define ELF_BSS ".bss"
298
#define ELF_COMMENT ".comment"
299
#define ELF_DATA ".data"
300
#define ELF_DATA_PU ".data_pu"
301
#define ELF_DEBUG ".debug"
302
#define ELF_DYNAMIC ".dynamic"
303
#define ELF_DYNSTR ".dynstr"
304
#define ELF_DYNSYM ".dynsym"
305
#define ELF_MSYM ".msym"
306
#define ELF_FINI ".fini"
307
#define ELF_GOT ".got"
308
#define ELF_PLT ".plt"
309
#define ELF_HASH ".hash"
310
#define ELF_INIT ".init"
311
#define ELF_REL_DATA ".rel.data"
312
#define ELF_REL_FINI ".rel.fini"
313
#define ELF_REL_INIT ".rel.init"
314
#define ELF_REL_DYN ".rel.dyn"
315
#define ELF_REL_RODATA ".rel.rodata"
316
#define ELF_REL_TEXT ".rel.text"
317
#define ELF_RODATA ".rodata"
318
#define ELF_RODATA_PU ".rodata_pu"
319
#define ELF_SHSTRTAB ".shstrtab"
320
#define ELF_STRTAB ".strtab"
321
#define ELF_SYMTAB ".symtab"
322
#define ELF_TEXT ".text"
323
324
/*
325
* special section names
326
*
327
* These are the section names for those sections
328
* that exist in both Irix/mips and Irix/ia64 objects.
329
*/
330
#define MIPS_LIBLIST ".liblist"
331
#define MIPS_MSYM ".msym"
332
#define MIPS_CONFLICT ".conflict"
333
#define MIPS_SDATA ".sdata"
334
#define MIPS_SDATA_PU ".sdata_pu"
335
#define MIPS_REL_SDATA ".rel.sdata"
336
#define MIPS_SRDATA ".srdata"
337
#define MIPS_SRDATA_PU ".srdata_pu"
338
#define MIPS_RDATA ".rdata"
339
#define MIPS_SBSS ".sbss"
340
#define MIPS_LIT4 ".lit4"
341
#define MIPS_LIT8 ".lit8"
342
#define MIPS_LIT16 ".lit16"
343
#define MIPS_EVENTS ".MIPS.events"
344
#define MIPS_INTERFACES ".MIPS.interfaces"
345
#define MIPS_OPTIONS ".MIPS.options"
346
#define MIPS_SYMBOL_LIB ".MIPS.symlib"
347
#define MIPS_DEBUG_INFO ".debug_info"
348
#define MIPS_DEBUG_LINE ".debug_line"
349
#define MIPS_DEBUG_ABBREV ".debug_abbrev"
350
#define MIPS_DEBUG_FRAME ".debug_frame"
351
#define MIPS_DEBUG_ARANGES ".debug_aranges"
352
#define MIPS_DEBUG_PUBNAMES ".debug_pubnames"
353
#define MIPS_DEBUG_STR ".debug_str"
354
#define MIPS_DEBUG_FUNCNAMES ".debug_funcnames"
355
#define MIPS_DEBUG_TYPENAMES ".debug_typenames"
356
#define MIPS_DEBUG_VARNAMES ".debug_varnames"
357
#define MIPS_DEBUG_WEAKNAMES ".debug_weaknames"
358
#define MIPS_XLATE ".MIPS.Xlate"
359
#define MIPS_XLATE_DEBUG ".MIPS.Xlate_debug"
360
#define MIPS_CONTENT ".MIPS.content"
361
#define MIPS_WHIRL ".WHIRL"
/* Mips uses this name */
362
363
/*
364
* special section names
365
*
366
* These are the section names for those sections
367
* that exist in both Irix/mips and Irix/ia64 objects.
368
*/
369
#define IA64_LIBLIST ".liblist"
370
#define IA64_MSYM ".msym"
371
#define IA64_CONFLICT ".conflict"
372
#define IA64_SDATA ".sdata"
373
#define IA64_REL_SDATA ".rel.sdata"
374
#define IA64_SRDATA ".srdata"
375
#define IA64_RDATA ".rdata"
376
#define IA64_SBSS ".sbss"
377
#define IA64_LIT4 ".lit4"
378
#define IA64_LIT8 ".lit8"
379
#define IA64_LIT16 ".lit16"
380
#define IA64_EVENTS ".IA64.events"
381
#define IA64_INTERFACES ".IA64.interfaces"
382
#define IA64_OPTIONS ".IA64.options"
383
#define IA64_SYMBOL_LIB ".IA64.symlib"
384
#define IA64_DEBUG_INFO ".debug_info"
385
#define IA64_DEBUG_LINE ".debug_line"
386
#define IA64_DEBUG_ABBREV ".debug_abbrev"
387
#define IA64_DEBUG_FRAME ".debug_frame"
388
#define IA64_DEBUG_ARANGES ".debug_aranges"
389
#define IA64_DEBUG_PUBNAMES ".debug_pubnames"
390
#define IA64_DEBUG_STR ".debug_str"
391
#define IA64_DEBUG_FUNCNAMES ".debug_funcnames"
392
#define IA64_DEBUG_TYPENAMES ".debug_typenames"
393
#define IA64_DEBUG_VARNAMES ".debug_varnames"
394
#define IA64_DEBUG_WEAKNAMES ".debug_weaknames"
395
#define IA64_XLATE ".IA64.Xlate"
396
#define IA64_XLATE_DEBUG ".IA64.Xlate_debug"
397
#define IA64_WHIRL ".IA64.WHIRL"
398
#define IA64_CONTENT ".IA64.content"
399
400
401
#ifdef __osf__
402
#define IA64_PACKAGE ".package"
403
#define IA64_PACKSYM ".packsym"
404
#endif
/* __osf__ */
405
406
/*
407
* special section names
408
*
409
* These are the section names for sections
410
* that are unique to Irix/ia64.
411
*/
412
#define IA64_ARCHEXT ".IA_64.archext"
413
#define IA64_PLTOFF ".IA_64.pltoff"
414
#define IA64_UNWIND ".IA_64.unwind"
415
#define IA64_UNWIND_INFO ".IA_64.unwind_info"
416
417
#define ELF64_FSZ_ADDR 8
418
#define ELF64_FSZ_HALF 2
419
#define ELF64_FSZ_OFF 8
420
#define ELF64_FSZ_SWORD 4
421
#define ELF64_FSZ_WORD 4
422
#define ELF64_FSZ_SXWORD 8
423
#define ELF64_FSZ_XWORD 8
424
425
#define ELF32_FSZ_ADDR 4
426
#define ELF32_FSZ_HALF 2
427
#define ELF32_FSZ_OFF 4
428
#define ELF32_FSZ_SWORD 4
429
#define ELF32_FSZ_WORD 4
430
431
/* Content kind -- valid for ELF-32 and ELF-64: */
432
typedef
enum
{
433
CK_NULL
= 0,
/* Invalid, same as EK_NULL */
434
CK_DEFAULT
= 0x30,
/* Default type of data for section */
435
CK_ALIGN
= 0x31,
/* Alignment for described range */
436
CK_INSTR
= 0x32,
/* Instructions */
437
CK_DATA
= 0x33,
/* Non-address data */
438
CK_SADDR_32
= 0x34,
/* Simple 32-bit addresses */
439
CK_GADDR_32
= 0x35,
/* GP-relative 32-bit addresses */
440
CK_CADDR_32
= 0x36,
/* Complex 32-bit addresses */
441
CK_SADDR_64
= 0x37,
/* Simple 64-bit addresses */
442
CK_GADDR_64
= 0x38,
/* GP-relative 64-bit addresses */
443
CK_CADDR_64
= 0x39,
/* Complex 64-bit addresses */
444
CK_NO_XFORM
= 0x3a,
/* No transformations allowed in this range */
445
CK_NO_REORDER
= 0x3b,
/* No reordering allowed in this range */
446
CK_GP_GROUP
= 0x3c,
/* Text/data in range with length given by
447
second argument references GP group given
448
by first. */
449
CK_STUBS
= 0x3d
/* Text in range is stub code. ULEB */
450
}
Elf_MIPS_Content_Kind
;
451
452
typedef
struct
453
{
454
Elf32_Word
hwp_flags1
;
/* extra flags */
455
Elf32_Word
hwp_flags2
;
/* extra flags */
456
}
Elf_Options_Hw
;
457
458
/*
459
* Elf_Options.kind Options descriptor kinds
460
*/
461
#define ODK_NULL 0
/* Undefined */
462
#define ODK_MIPS_REGINFO 1
/* MIPS Register usage information */
463
#define ODK_REGINFO 1
/* MIPS Register usage information */
464
#define ODK_MIPS_EXCEPTIONS 2
/* MIPS Exception processing options */
465
#define ODK_EXCEPTIONS 2
/* MIPS Exception processing options */
466
#define ODK_PAD 3
/* Section padding options */
467
#define ODK_MIPS_HWPATCH 4
/* MIPS Hardware workarounds performed*/
468
#define ODK_HWPATCH 4
/* MIPS Hardware workarounds performed*/
469
#define ODK_FILL 5
/* The fill value used by the linker */
470
#define ODK_TAGS 6
/* Space for desktop tools to write */
471
#define ODK_MIPS_HWAND 7
/* HW workarounds.'AND' when merging */
472
#define ODK_HWAND 7
/* HW workarounds.'AND' when merging */
473
#define ODK_MIPS_HWOR 8
/* HW workarounds.'OR' when merging */
474
#define ODK_HWOR 8
/* HW workarounds.'OR' when merging */
475
#define ODK_GP_GROUP 9
/* GP group for text/data sections */
476
#define ODK_IDENT 10
/* ID information */
477
#define ODK_IA64_REGINFO 11
/* TO BE CHANGED! */
478
#define ODK_PAGESIZE 12
/* Alternate segment page size */
479
480
481
#define ODK_IA64_EXCEPTIONS 12
/* NOT USED! */
482
#define ODK_IA64_HWAND 13
/* NOT USED! */
483
#define ODK_IA64_HWOR 14
/* NOT USED! */
484
485
/*
486
* Elf_Options.kind == ODK_MIPS_EXCEPTIONS
487
*
488
* masks for Elf_Options.info
489
*/
490
#define OEX_PAGE0 0x10000
/* page zero must be mapped */
491
#define OEX_SMM 0x20000
/* Force sequential memory mode? */
492
#define OEX_FPDBUG 0x40000
/* Force floating point debug mode? */
493
#define OEX_PRECISEFP OEX_FPDBUG
494
#define OEX_DISMISS 0x80000
/* Dismiss invalid address faults? */
495
#define OEX_FPU_MIN 0x1f
/* FPE's which MUST be enabled */
496
#define OEX_FPU_MAX 0x1f00
/* FPE's which MAY be enabled */
497
#define OEX_FPU_INVAL 0x10
498
#define OEX_FPU_DIV0 0x08
499
#define OEX_FPU_OFLO 0x04
500
#define OEX_FPU_UFLO 0x02
501
#define OEX_FPU_INEX 0x01
502
503
/*
504
* Elf_Options.kind == ODK_MIPS_HWPATCH
505
*
506
* masks for Elf_Options.info
507
*/
508
#define OHW_R4KEOP 0x1
/* R4000 end-of-page patch */
509
#define OHW_R8KPFETCH 0x2
/* may need R8000 prefetch patch */
510
#define OHW_R5KEOP 0x4
/* R5000 end-of-page patch */
511
#define OHW_R5KCVTL 0x8
/* R5000 cvt.[ds].l bug. clean=1 */
512
#define OHW_R10KLDL 0x10
/* R10000 requires LDL patch */
513
514
/*
515
* Elf_Options.kind == ODK_MIPS_HWOR
516
*
517
* masks for Elf_Options.info
518
*/
519
#define OHWO0_FIXADE 0x00000001
/* Object requires FIXADE call */
520
521
/*
522
* Elf_Options.kind == ODK_PAD
523
*
524
* masks for Elf_Options.info
525
*/
526
#define OPAD_PREFIX 0x1
527
#define OPAD_POSTFIX 0x2
528
#define OPAD_SYMBOL 0x4
529
530
/*
531
* Elf_Options.kind == ODK_GP_GROUP
532
*
533
* masks for Elf_Options.info
534
*/
535
#define OGP_GROUP 0x0000ffff
/* GP group number */
536
#define OGP_SELF 0x00010000
/* Self-contained GP groups */
537
#endif
538
539
540
/* Special section indices. */
541
542
#define SHN_UNDEF 0
/* Undefined section */
543
#define SHN_LORESERVE 0xff00
/* Start of reserved indices */
544
#define SHN_LOPROC 0xff00
/* Start of processor-specific */
545
#define SHN_HIPROC 0xff1f
/* End of processor-specific */
546
#define SHN_ABS 0xfff1
/* Associated symbol is absolute */
547
#define SHN_COMMON 0xfff2
/* Associated symbol is common */
548
#define SHN_HIRESERVE 0xffff
/* End of reserved indices */
549
550
/* Legal values for sh_type (section type). */
551
552
#define SHT_NULL 0
/* Section header table entry unused */
553
#define SHT_PROGBITS 1
/* Program data */
554
#define SHT_SYMTAB 2
/* Symbol table */
555
#define SHT_STRTAB 3
/* String table */
556
#define SHT_RELA 4
/* Relocation entries with addends */
557
#define SHT_HASH 5
/* Symbol hash table */
558
#define SHT_DYNAMIC 6
/* Dynamic linking information */
559
#define SHT_NOTE 7
/* Notes */
560
#define SHT_NOBITS 8
/* Program space with no data (bss) */
561
#define SHT_REL 9
/* Relocation entries, no addends */
562
#define SHT_SHLIB 10
/* Reserved */
563
#define SHT_DYNSYM 11
/* Dynamic linker symbol table */
564
#define SHT_NUM 12
/* Number of defined types. */
565
#define SHT_LOSUNW 0x6ffffffd
/* Sun-specific low bound. */
566
#define SHT_GNU_verdef 0x6ffffffd
/* Version definition section. */
567
#define SHT_GNU_verneed 0x6ffffffe
/* Version needs section. */
568
#define SHT_GNU_versym 0x6fffffff
/* Version symbol table. */
569
#define SHT_HISUNW 0x6fffffff
/* Sun-specific high bound. */
570
#define SHT_LOPROC 0x70000000
/* Start of processor-specific */
571
#define SHT_HIPROC 0x7fffffff
/* End of processor-specific */
572
#define SHT_LOUSER 0x80000000
/* Start of application-specific */
573
#define SHT_HIUSER 0x8fffffff
/* End of application-specific */
574
575
/* Legal values for sh_flags (section flags). */
576
577
#define SHF_WRITE (1 << 0)
/* Writable */
578
#define SHF_ALLOC (1 << 1)
/* Occupies memory during execution */
579
#define SHF_EXECINSTR (1 << 2)
/* Executable */
580
#define SHF_MASKPROC 0xf0000000
/* Processor-specific */
581
582
/* Symbol table entry. */
583
584
typedef
struct
585
{
586
Elf32_Word
st_name
;
/* Symbol name (string tbl index) */
587
Elf32_Addr
st_value
;
/* Symbol value */
588
Elf32_Word
st_size
;
/* Symbol size */
589
unsigned
char
st_info
;
/* Symbol type and binding */
590
unsigned
char
st_other
;
/* No defined meaning, 0 */
591
Elf32_Section
st_shndx
;
/* Section index */
592
}
Elf32_Sym
;
593
594
typedef
struct
595
{
596
Elf64_Word
st_name
;
/* Symbol name (string tbl index) */
597
unsigned
char
st_info
;
/* Symbol type and binding */
598
unsigned
char
st_other
;
/* No defined meaning, 0 */
599
Elf64_Section
st_shndx
;
/* Section index */
600
Elf64_Addr
st_value
;
/* Symbol value */
601
Elf64_Xword
st_size
;
/* Symbol size */
602
}
Elf64_Sym
;
603
604
/* Special section index. */
605
606
#define SHN_UNDEF 0
/* No section, undefined symbol. */
607
608
/* How to extract and insert information held in the st_info field. */
609
610
#define ELF32_ST_BIND(val) (((unsigned char) (val)) >> 4)
611
#define ELF32_ST_TYPE(val) ((val) & 0xf)
612
#define ELF32_ST_INFO(bind, type) (((bind) << 4) + ((type) & 0xf))
613
614
/* Both Elf32_Sym and Elf64_Sym use the same one-byte st_info field. */
615
#define ELF64_ST_BIND(val) ELF32_ST_BIND (val)
616
#define ELF64_ST_TYPE(val) ELF32_ST_TYPE (val)
617
#define ELF64_ST_INFO(bind, type) ELF32_ST_INFO ((bind), (type))
618
619
/* Legal values for ST_BIND subfield of st_info (symbol binding). */
620
621
#define STB_LOCAL 0
/* Local symbol */
622
#define STB_GLOBAL 1
/* Global symbol */
623
#define STB_WEAK 2
/* Weak symbol */
624
#define STB_NUM 3
/* Number of defined types. */
625
#define STB_LOPROC 13
/* Start of processor-specific */
626
#define STB_HIPROC 15
/* End of processor-specific */
627
628
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
629
630
#define STT_NOTYPE 0
/* Symbol type is unspecified */
631
#define STT_OBJECT 1
/* Symbol is a data object */
632
#define STT_FUNC 2
/* Symbol is a code object */
633
#define STT_SECTION 3
/* Symbol associated with a section */
634
#define STT_FILE 4
/* Symbol's name is file name */
635
#define STT_NUM 5
/* Number of defined types. */
636
#define STT_LOPROC 13
/* Start of processor-specific */
637
#define STT_HIPROC 15
/* End of processor-specific */
638
639
640
/* Symbol table indices are found in the hash buckets and chain table
641
of a symbol hash table section. This special index value indicates
642
the end of a chain, meaning no further symbols are found in that bucket. */
643
644
#define STN_UNDEF 0
/* End of a chain. */
645
646
647
/* Relocation table entry without addend (in section of type SHT_REL). */
648
649
typedef
struct
650
{
651
Elf32_Addr
r_offset
;
/* Address */
652
Elf32_Word
r_info
;
/* Relocation type and symbol index */
653
}
Elf32_Rel
;
654
655
#if defined(__MIPS_AND_IA64_ELF_H)
656
#if defined(_MIPSEB)
657
typedef
struct
658
{
659
Elf64_Addr
r_offset;
660
Elf64_Word
r_sym;
/* Symbol index */
661
Elf64_Byte
r_ssym;
/* Special symbol */
662
Elf64_Byte
r_type3;
/* 3rd relocation op type */
663
Elf64_Byte
r_type2;
/* 2nd relocation op type */
664
Elf64_Byte
r_type;
/* 1st relocation op type */
665
}
Elf64_Rel
;
666
667
typedef
struct
{
668
Elf64_Addr
r_offset;
669
Elf64_Word
r_sym;
/* Symbol index */
670
Elf64_Byte
r_ssym;
/* Special symbol */
671
Elf64_Byte
r_type3;
/* 3rd relocation op type */
672
Elf64_Byte
r_type2;
/* 2nd relocation op type */
673
Elf64_Byte
r_type;
/* 1st relocation op type */
674
Elf64_Sxword
r_addend;
675
}
Elf64_Rela
;
676
#else
/* !defined(_MIPSEB) */
677
typedef
struct
678
{
679
Elf64_Addr
r_offset
;
680
Elf64_Byte
r_type
;
/* 1st relocation op type */
681
Elf64_Byte
r_type2
;
/* 2nd relocation op type */
682
Elf64_Byte
r_type3
;
/* 3rd relocation op type */
683
Elf64_Byte
r_ssym
;
/* Special symbol */
684
Elf64_Word
r_sym
;
/* Symbol index */
685
}
Elf64_Rel
;
686
687
typedef
struct
{
688
Elf64_Addr
r_offset
;
689
Elf64_Byte
r_type
;
/* 1st relocation op type */
690
Elf64_Byte
r_type2
;
/* 2nd relocation op type */
691
Elf64_Byte
r_type3
;
/* 3rd relocation op type */
692
Elf64_Byte
r_ssym
;
/* Special symbol */
693
Elf64_Word
r_sym
;
/* Symbol index */
694
Elf64_Sxword
r_addend
;
695
}
Elf64_Rela
;
696
#endif
/* defined(_MIPSEB) */
697
typedef
struct
698
{
699
Elf64_Byte
kind
;
/* determines interpretation of the */
700
/* variable part of descriptor */
701
Elf64_Byte
size
;
/* size of descriptor, incl. header */
702
Elf64_Section
section
;
/* section header index of section */
703
/* affected, 0 for global options */
704
Elf64_Word
info
;
/* Kind-specific information */
705
}
Elf_Options
;
706
707
/* Values for the r_ssym field: */
708
typedef
enum
{
709
RSS_UNDEF
= 0,
/* Undefined */
710
RSS_GP
= 1,
/* Context pointer (gp) value */
711
RSS_GP0
= 2,
/* gp value used to create object being relocated */
712
RSS_LOC
= 3
/* Address of location being relocated */
713
}
Elf64_Rel_Ssym
;
714
#else
715
/* I have seen two different definitions of the Elf64_Rel and
716
Elf64_Rela structures, so we'll leave them out until Novell (or
717
whoever) gets their act together. */
718
/* The following, at least, is used on Sparc v9, MIPS, and Alpha. */
719
720
typedef
struct
721
{
722
Elf64_Addr
r_offset;
/* Address */
723
Elf64_Xword
r_info;
/* Relocation type and symbol index */
724
}
Elf64_Rel
;
725
726
typedef
struct
727
{
728
Elf64_Addr
r_offset;
/* Address */
729
Elf64_Xword
r_info;
/* Relocation type and symbol index */
730
Elf64_Sxword
r_addend;
/* Addend */
731
}
Elf64_Rela
;
732
#endif
733
734
/* Relocation table entry with addend (in section of type SHT_RELA). */
735
736
typedef
struct
737
{
738
Elf32_Addr
r_offset
;
/* Address */
739
Elf32_Word
r_info
;
/* Relocation type and symbol index */
740
Elf32_Sword
r_addend
;
/* Addend */
741
}
Elf32_Rela
;
742
743
/* How to extract and insert information held in the r_info field. */
744
745
#define ELF32_R_SYM(val) ((val) >> 8)
746
#define ELF32_R_TYPE(val) ((val) & 0xff)
747
#define ELF32_R_INFO(sym, type) (((sym) << 8) + ((type) & 0xff))
748
749
#define ELF64_R_SYM(i) ((i) >> 32)
750
#define ELF64_R_TYPE(i) ((i) & 0xffffffff)
751
#define ELF64_R_INFO(sym,type) (((sym) << 32) + (type))
752
753
/* Program segment header. */
754
755
typedef
struct
756
{
757
Elf32_Word
p_type
;
/* Segment type */
758
Elf32_Off
p_offset
;
/* Segment file offset */
759
Elf32_Addr
p_vaddr
;
/* Segment virtual address */
760
Elf32_Addr
p_paddr
;
/* Segment physical address */
761
Elf32_Word
p_filesz
;
/* Segment size in file */
762
Elf32_Word
p_memsz
;
/* Segment size in memory */
763
Elf32_Word
p_flags
;
/* Segment flags */
764
Elf32_Word
p_align
;
/* Segment alignment */
765
}
Elf32_Phdr
;
766
767
typedef
struct
768
{
769
Elf64_Word
p_type
;
/* Segment type */
770
Elf64_Word
p_flags
;
/* Segment flags */
771
Elf64_Off
p_offset
;
/* Segment file offset */
772
Elf64_Addr
p_vaddr
;
/* Segment virtual address */
773
Elf64_Addr
p_paddr
;
/* Segment physical address */
774
Elf64_Xword
p_filesz
;
/* Segment size in file */
775
Elf64_Xword
p_memsz
;
/* Segment size in memory */
776
Elf64_Xword
p_align
;
/* Segment alignment */
777
}
Elf64_Phdr
;
778
779
/* Legal values for p_type (segment type). */
780
781
#define PT_NULL 0
/* Program header table entry unused */
782
#define PT_LOAD 1
/* Loadable program segment */
783
#define PT_DYNAMIC 2
/* Dynamic linking information */
784
#define PT_INTERP 3
/* Program interpreter */
785
#define PT_NOTE 4
/* Auxiliary information */
786
#define PT_SHLIB 5
/* Reserved */
787
#define PT_PHDR 6
/* Entry for header table itself */
788
#define PT_NUM 7
/* Number of defined types. */
789
#define PT_LOPROC 0x70000000
/* Start of processor-specific */
790
#define PT_HIPROC 0x7fffffff
/* End of processor-specific */
791
792
/* Legal values for p_flags (segment flags). */
793
794
#define PF_X (1 << 0)
/* Segment is executable */
795
#define PF_W (1 << 1)
/* Segment is writable */
796
#define PF_R (1 << 2)
/* Segment is readable */
797
#define PF_MASKPROC 0xf0000000
/* Processor-specific */
798
799
/* Legal values for note segment descriptor types for core files. */
800
801
#define NT_PRSTATUS 1
/* Contains copy of prstatus struct */
802
#define NT_FPREGSET 2
/* Contains copy of fpregset struct */
803
#define NT_PRPSINFO 3
/* Contains copy of prpsinfo struct */
804
805
/* Legal values for the note segment descriptor types for object files. */
806
807
#define NT_VERSION 1
/* Contains a version string. */
808
809
810
/* Dynamic section entry. */
811
812
typedef
struct
813
{
814
Elf32_Sword
d_tag
;
/* Dynamic entry type */
815
union
816
{
817
Elf32_Word
d_val
;
/* Integer value */
818
Elf32_Addr
d_ptr
;
/* Address value */
819
} d_un;
820
}
Elf32_Dyn
;
821
822
typedef
struct
823
{
824
Elf64_Sxword
d_tag
;
/* Dynamic entry type */
825
union
826
{
827
Elf64_Xword
d_val
;
/* Integer value */
828
Elf64_Addr
d_ptr
;
/* Address value */
829
} d_un;
830
}
Elf64_Dyn
;
831
832
/* Legal values for d_tag (dynamic entry type). */
833
834
#define DT_NULL 0
/* Marks end of dynamic section */
835
#define DT_NEEDED 1
/* Name of needed library */
836
#define DT_PLTRELSZ 2
/* Size in bytes of PLT relocs */
837
#define DT_PLTGOT 3
/* Processor defined value */
838
#define DT_HASH 4
/* Address of symbol hash table */
839
#define DT_STRTAB 5
/* Address of string table */
840
#define DT_SYMTAB 6
/* Address of symbol table */
841
#define DT_RELA 7
/* Address of Rela relocs */
842
#define DT_RELASZ 8
/* Total size of Rela relocs */
843
#define DT_RELAENT 9
/* Size of one Rela reloc */
844
#define DT_STRSZ 10
/* Size of string table */
845
#define DT_SYMENT 11
/* Size of one symbol table entry */
846
#define DT_INIT 12
/* Address of init function */
847
#define DT_FINI 13
/* Address of termination function */
848
#define DT_SONAME 14
/* Name of shared object */
849
#define DT_RPATH 15
/* Library search path */
850
#define DT_SYMBOLIC 16
/* Start symbol search here */
851
#define DT_REL 17
/* Address of Rel relocs */
852
#define DT_RELSZ 18
/* Total size of Rel relocs */
853
#define DT_RELENT 19
/* Size of one Rel reloc */
854
#define DT_PLTREL 20
/* Type of reloc in PLT */
855
#define DT_DEBUG 21
/* For debugging; unspecified */
856
#define DT_TEXTREL 22
/* Reloc might modify .text */
857
#define DT_JMPREL 23
/* Address of PLT relocs */
858
#define DT_NUM 24
/* Number used */
859
#define DT_LOPROC 0x70000000
/* Start of processor-specific */
860
#define DT_HIPROC 0x7fffffff
/* End of processor-specific */
861
#define DT_PROCNUM DT_MIPS_NUM
/* Most used by any processor */
862
863
/* The versioning entry types. The next are defined as part of the
864
GNU extension. */
865
#define DT_VERSYM 0x6ffffff0
866
867
/* These were chosen by Sun. */
868
#define DT_VERDEF 0x6ffffffc
/* Address of version definition
869
table */
870
#define DT_VERDEFNUM 0x6ffffffd
/* Number of version definitions */
871
#define DT_VERNEED 0x6ffffffe
/* Address of table with needed
872
versions */
873
#define DT_VERNEEDNUM 0x6fffffff
/* Number of needed versions */
874
#define DT_VERSIONTAGIDX(tag) (DT_VERNEEDNUM - (tag))
/* Reverse order! */
875
#define DT_VERSIONTAGNUM 16
876
877
/* Sun added these machine-independent extensions in the "processor-specific"
878
range. Be compatible. */
879
#define DT_AUXILIARY 0x7ffffffd
/* Shared object to load before self */
880
#define DT_FILTER 0x7fffffff
/* Shared object to get values from */
881
#define DT_EXTRATAGIDX(tag) ((Elf32_Word)-((Elf32_Sword) (tag) <<1>>1)-1)
882
#define DT_EXTRANUM 3
883
884
/* Version definition sections. */
885
886
typedef
struct
887
{
888
Elf32_Half
vd_version
;
/* Version revision */
889
Elf32_Half
vd_flags
;
/* Version information */
890
Elf32_Half
vd_ndx
;
/* Version Index */
891
Elf32_Half
vd_cnt
;
/* Number of associated aux entries */
892
Elf32_Word
vd_hash
;
/* Version name hash value */
893
Elf32_Word
vd_aux
;
/* Offset in bytes to verdaux array */
894
Elf32_Word
vd_next
;
/* Offset in bytes to next verdef
895
entry */
896
}
Elf32_Verdef
;
897
898
/* Legal values for vd_version (version revision). */
899
#define VER_DEF_NONE 0
/* No version */
900
#define VER_DEF_CURRENT 1
/* Current version */
901
#define VER_DEF_NUM 2
/* Given version number */
902
903
/* Legal values for vd_flags (version information flags). */
904
#define VER_FLG_BASE 0x1
/* Version definition of file itself */
905
#define VER_FLG_WEAK 0x2
/* Weak version identifier */
906
907
/* Auxialiary version information. */
908
909
typedef
struct
910
{
911
Elf32_Addr
vda_name
;
/* Version or dependency names */
912
Elf32_Word
vda_next
;
/* Offset in bytes to next verdaux
913
entry */
914
}
Elf32_Verdaux
;
915
916
/* Version dependency section. */
917
918
typedef
struct
919
{
920
Elf32_Half
vn_version
;
/* Version of structure */
921
Elf32_Half
vn_cnt
;
/* Number of associated aux entries */
922
Elf32_Addr
vn_file
;
/* Offset of filename for this
923
dependency */
924
Elf32_Word
vn_aux
;
/* Offset in bytes to vernaux array */
925
Elf32_Word
vn_next
;
/* Offset in bytes to next verneed
926
entry */
927
}
Elf32_Verneed
;
928
929
/* Legal values for vn_version (version revision). */
930
#define VER_NEED_NONE 0
/* No version */
931
#define VER_NEED_CURRENT 1
/* Current version */
932
#define VER_NEED_NUM 2
/* Given version number */
933
934
/* Auxiliary needed version information. */
935
936
typedef
struct
937
{
938
Elf32_Word
vna_hash
;
/* Hash value of dependency name */
939
Elf32_Half
vna_flags
;
/* Dependency specific information */
940
Elf32_Half
vna_other
;
/* Unused */
941
Elf32_Addr
vna_name
;
/* Dependency name string offset */
942
Elf32_Word
vna_next
;
/* Offset in bytes to next vernaux
943
entry */
944
}
Elf32_Vernaux
;
945
946
/* Legal values for vna_flags. */
947
#define VER_FLG_WEAK 0x2
/* Weak verison identifier */
948
949
950
/* Auxiliary vector. */
951
952
/* This vector is normally only used by the program interpreter. The
953
usual definition in an ABI supplement uses the name auxv_t. The
954
vector is not usually defined in a standard <elf.h> file, but it
955
can't hurt. We rename it to avoid conflicts. The sizes of these
956
types are an arrangement between the exec server and the program
957
interpreter, so we don't fully specify them here. */
958
959
typedef
struct
960
{
961
int
a_type
;
/* Entry type */
962
union
963
{
964
long
int
a_val
;
/* Integer value */
965
void
*
a_ptr
;
/* Pointer value */
966
void (*a_fcn) (void);
/* Function pointer value */
967
} a_un;
968
}
Elf32_auxv_t
;
969
970
typedef
struct
971
{
972
long
int
a_type
;
/* Entry type */
973
union
974
{
975
long
int
a_val
;
/* Integer value */
976
void
*
a_ptr
;
/* Pointer value */
977
void (*a_fcn) (void);
/* Function pointer value */
978
} a_un;
979
}
Elf64_auxv_t
;
980
981
/* Legal values for a_type (entry type). */
982
983
#define AT_NULL 0
/* End of vector */
984
#define AT_IGNORE 1
/* Entry should be ignored */
985
#define AT_EXECFD 2
/* File descriptor of program */
986
#define AT_PHDR 3
/* Program headers for program */
987
#define AT_PHENT 4
/* Size of program header entry */
988
#define AT_PHNUM 5
/* Number of program headers */
989
#define AT_PAGESZ 6
/* System page size */
990
#define AT_BASE 7
/* Base address of interpreter */
991
#define AT_FLAGS 8
/* Flags */
992
#define AT_ENTRY 9
/* Entry point of program */
993
#define AT_NOTELF 10
/* Program is not ELF */
994
#define AT_UID 11
/* Real uid */
995
#define AT_EUID 12
/* Effective uid */
996
#define AT_GID 13
/* Real gid */
997
#define AT_EGID 14
/* Effective gid */
998
999
/* Motorola 68k specific definitions. */
1000
1001
/* m68k relocs. */
1002
1003
#define R_68K_NONE 0
/* No reloc */
1004
#define R_68K_32 1
/* Direct 32 bit */
1005
#define R_68K_16 2
/* Direct 16 bit */
1006
#define R_68K_8 3
/* Direct 8 bit */
1007
#define R_68K_PC32 4
/* PC relative 32 bit */
1008
#define R_68K_PC16 5
/* PC relative 16 bit */
1009
#define R_68K_PC8 6
/* PC relative 8 bit */
1010
#define R_68K_GOT32 7
/* 32 bit PC relative GOT entry */
1011
#define R_68K_GOT16 8
/* 16 bit PC relative GOT entry */
1012
#define R_68K_GOT8 9
/* 8 bit PC relative GOT entry */
1013
#define R_68K_GOT32O 10
/* 32 bit GOT offset */
1014
#define R_68K_GOT16O 11
/* 16 bit GOT offset */
1015
#define R_68K_GOT8O 12
/* 8 bit GOT offset */
1016
#define R_68K_PLT32 13
/* 32 bit PC relative PLT address */
1017
#define R_68K_PLT16 14
/* 16 bit PC relative PLT address */
1018
#define R_68K_PLT8 15
/* 8 bit PC relative PLT address */
1019
#define R_68K_PLT32O 16
/* 32 bit PLT offset */
1020
#define R_68K_PLT16O 17
/* 16 bit PLT offset */
1021
#define R_68K_PLT8O 18
/* 8 bit PLT offset */
1022
#define R_68K_COPY 19
/* Copy symbol at runtime */
1023
#define R_68K_GLOB_DAT 20
/* Create GOT entry */
1024
#define R_68K_JMP_SLOT 21
/* Create PLT entry */
1025
#define R_68K_RELATIVE 22
/* Adjust by program base */
1026
#define R_68K_NUM 23
1027
1028
/* Intel 80386 specific definitions. */
1029
1030
/* i386 relocs. */
1031
1032
#define R_386_NONE 0
/* No reloc */
1033
#define R_386_32 1
/* Direct 32 bit */
1034
#define R_386_PC32 2
/* PC relative 32 bit */
1035
#define R_386_GOT32 3
/* 32 bit GOT entry */
1036
#define R_386_PLT32 4
/* 32 bit PLT address */
1037
#define R_386_COPY 5
/* Copy symbol at runtime */
1038
#define R_386_GLOB_DAT 6
/* Create GOT entry */
1039
#define R_386_JMP_SLOT 7
/* Create PLT entry */
1040
#define R_386_RELATIVE 8
/* Adjust by program base */
1041
#define R_386_GOTOFF 9
/* 32 bit offset to GOT */
1042
#define R_386_GOTPC 10
/* 32 bit PC relative offset to GOT */
1043
#define R_386_NUM 11
1044
1045
/* Intel IA64 specific definitions. */
1046
enum
{
1047
1048
/*----------------------------------------------------------------------------
1049
* Relocation TYPE = value Field Calculation
1050
*----------------------------------------------------------------------------
1051
*/
1052
1053
R_IA_64_NONE
= 0x00,
/* None None */
1054
1055
/* unused: 0x01 .. 0x20 */
1056
1057
R_IA_64_IMM14
= 0x21,
/* instr: immediate14 S+A */
1058
R_IA_64_IMM22
= 0x22,
/* instr: immediate22 S+A */
1059
R_IA_64_IMM64
= 0x23,
/* instr: immediate64 S+A */
1060
R_IA_64_DIR32MSB
= 0x24,
/* word32 MSB S+A */
1061
R_IA_64_DIR32LSB
= 0x25,
/* word32 LSB S+A */
1062
R_IA_64_DIR64MSB
= 0x26,
/* word64 MSB S+A */
1063
R_IA_64_DIR64LSB
= 0x27,
/* word64 LSB S+A */
1064
1065
/* unused: 0x28 .. 0x29 */
1066
1067
R_IA_64_GPREL22
= 0x2a,
/* instr: immediate22 @gprel(S+A) */
1068
R_IA_64_GPREL64I
= 0x2b,
/* instr: immediate64 @gprel(S+A) */
1069
1070
/* unused: 0x2c .. 0x2d */
1071
1072
R_IA_64_GPREL64MSB
= 0x2e,
/* word64 MSB @gprel(S+A) */
1073
R_IA_64_GPREL64LSB
= 0x2f,
/* word64 LSB @gprel(S+A) */
1074
1075
/* unused: 0x30 .. 0x31 */
1076
1077
R_IA_64_LTOFF22
= 0x32,
/* instr: immediate22 @ltoff(S+A) */
1078
R_IA_64_LTOFF64I
= 0x33,
/* instr: immediate64 @ltoff(S+A) */
1079
1080
/* unused: 0x34 .. 0x39 */
1081
1082
R_IA_64_PLTOFF22
= 0x3a,
/* instr: immediate22 @pltoff(S+A) */
1083
R_IA_64_PLTOFF64I
= 0x3b,
/* instr: immediate64 @pltoff(S+A) */
1084
1085
/* unused: 0x3c .. 0x3d */
1086
1087
R_IA_64_PLTOFF64MSB
= 0x3e,
/* word64 MSB @pltoff(S+A) */
1088
R_IA_64_PLTOFF64LSB
= 0x3f,
/* wordL4 MSB @pltoff(S+A) */
1089
1090
/* unused: 0x40 .. 0x42 */
1091
1092
R_IA_64_FPTR64I
= 0x43,
/* instr: immediate64 @fptr(S+A) */
1093
R_IA_64_FPTR32MSB
= 0x44,
/* word32 MSB @fptr(S+A) */
1094
R_IA_64_FPTR32LSB
= 0x45,
/* word32 LSB @fptr(S+A) */
1095
R_IA_64_FPTR64MSB
= 0x46,
/* word64 MSB @fptr(S+A) */
1096
R_IA_64_FPTR64LSB
= 0x47,
/* word64 LSB @fptr(S+A) */
1097
1098
/* unused: 0x48 .. 0x48 */
1099
1100
R_IA_64_PCREL21B
= 0x49,
/* instr: imm21 (form1) S+A-P */
1101
R_IA_64_PCREL21M
= 0x4a,
/* instr: imm21 (form2) S+A-P */
1102
R_IA_64_PCREL21F
= 0x4b,
/* instr: imm21 (form3) S+A-P */
1103
R_IA_64_PCREL32MSB
= 0x4c,
/* word32 MSB S+A-P */
1104
R_IA_64_PCREL32LSB
= 0x4d,
/* word32 LSB S+A-P */
1105
R_IA_64_PCREL64MSB
= 0x4e,
/* word64 MSB S+A-P */
1106
R_IA_64_PCREL64LSB
= 0x4f,
/* word64 LSB S+A-P */
1107
1108
/* unused: 0x50 .. 0x51 */
1109
1110
R_IA_64_LTOFF_FPTR22
= 0x52,
/* instr: immediate22 @ltoff(@fptr(S+A)) */
1111
R_IA_64_LTOFF_FPTR64I
= 0x53,
/* instr: immediate64 @ltoff(@fptr(S+A)) */
1112
1113
/* unused: 0x54 .. 0x5b */
1114
1115
R_IA_64_SEGREL32MSB
= 0x5c,
/* word32 MSB @segrel(S+A) */
1116
R_IA_64_SEGREL32LSB
= 0x5d,
/* word32 LSB @segrel(S+A) */
1117
R_IA_64_SEGREL64MSB
= 0x5e,
/* word64 MSB @segrel(S+A) */
1118
R_IA_64_SEGREL64LSB
= 0x5f,
/* word64 LSB @segrel(S+A) */
1119
1120
/* unused: 0x60 .. 0x63 */
1121
1122
R_IA_64_SECREL32MSB
= 0x64,
/* word32 MSB @secrel(S+A) */
1123
R_IA_64_SECREL32LSB
= 0x65,
/* word32 LSB @secrel(S+A) */
1124
R_IA_64_SECREL64MSB
= 0x66,
/* word64 MSB @secrel(S+A) */
1125
R_IA_64_SECREL64LSB
= 0x67,
/* word64 LSB @secrel(S+A) */
1126
1127
/* unused: 0x68 .. 0x6b */
1128
1129
R_IA_64_REL32MSB
= 0x6c,
/* word32 MSB BD+C */
1130
R_IA_64_REL32LSB
= 0x6d,
/* word32 LSB BD+C */
1131
R_IA_64_REL64MSB
= 0x6e,
/* word64 MSB BD+C */
1132
R_IA_64_REL64LSB
= 0x6f,
/* word64 LSB BD+C */
1133
R_IA_64_LTV32MSB
= 0x70,
/* word32 MSB S+A [note 2] */
1134
R_IA_64_LTV32LSB
= 0x71,
/* word32 LSB S+A [note 2] */
1135
R_IA_64_LTV64MSB
= 0x72,
/* word64 MSB S+A [note 2] */
1136
R_IA_64_LTV64LSB
= 0x73,
/* word64 LSB S+A [note 2] */
1137
1138
/* unused: 0x74 .. 0x7f */
1139
1140
R_IA_64_IPLTMSB
= 0x80,
/* func desc MSB [note 3] */
1141
R_IA_64_IPLTLSB
= 0x81,
/* func desc LSB [note 3] */
1142
1143
/* unused: 0x82 .. 0xff */
1144
1145
R_IA_64_END_
= 0x82
/* R_IA_64_END_ is not a relocation type.
1146
* It marks the end of the list of types.
1147
*/
1148
};
1149
1150
/* SUN SPARC specific definitions. */
1151
1152
/* SPARC relocs. */
1153
1154
#define R_SPARC_NONE 0
/* No reloc */
1155
#define R_SPARC_8 1
/* Direct 8 bit */
1156
#define R_SPARC_16 2
/* Direct 16 bit */
1157
#define R_SPARC_32 3
/* Direct 32 bit */
1158
#define R_SPARC_DISP8 4
/* PC relative 8 bit */
1159
#define R_SPARC_DISP16 5
/* PC relative 16 bit */
1160
#define R_SPARC_DISP32 6
/* PC relative 32 bit */
1161
#define R_SPARC_WDISP30 7
/* PC relative 30 bit shifted */
1162
#define R_SPARC_WDISP22 8
/* PC relative 22 bit shifted */
1163
#define R_SPARC_HI22 9
/* High 22 bit */
1164
#define R_SPARC_22 10
/* Direct 22 bit */
1165
#define R_SPARC_13 11
/* Direct 13 bit */
1166
#define R_SPARC_LO10 12
/* Truncated 10 bit */
1167
#define R_SPARC_GOT10 13
/* Truncated 10 bit GOT entry */
1168
#define R_SPARC_GOT13 14
/* 13 bit GOT entry */
1169
#define R_SPARC_GOT22 15
/* 22 bit GOT entry shifted */
1170
#define R_SPARC_PC10 16
/* PC relative 10 bit truncated */
1171
#define R_SPARC_PC22 17
/* PC relative 22 bit shifted */
1172
#define R_SPARC_WPLT30 18
/* 30 bit PC relative PLT address */
1173
#define R_SPARC_COPY 19
/* Copy symbol at runtime */
1174
#define R_SPARC_GLOB_DAT 20
/* Create GOT entry */
1175
#define R_SPARC_JMP_SLOT 21
/* Create PLT entry */
1176
#define R_SPARC_RELATIVE 22
/* Adjust by program base */
1177
#define R_SPARC_UA32 23
/* Direct 32 bit unaligned */
1178
#define R_SPARC_NUM 24
1179
1180
/* MIPS R3000 specific definitions. */
1181
1182
/* Legal values for e_flags field of Elf32_Ehdr. */
1183
1184
#define EF_MIPS_NOREORDER 1
/* A .noreorder directive was used */
1185
#define EF_MIPS_PIC 2
/* Contains PIC code */
1186
#define EF_MIPS_CPIC 4
/* Uses PIC calling sequence */
1187
#define EF_MIPS_ARCH 0xf0000000
/* MIPS architecture level */
1188
1189
#if defined(__MIPS_AND_IA64_ELF_H)
1190
/*
1191
* Temporary version number for formats prior to formal release.
1192
* e_ident[EI_TVERSION]
1193
*/
1194
#define EI_TVERSION 15
1195
#define EV_T_CURRENT 1
1196
1197
#define EF_IRIX_ABI64 0x00000010
1198
/* If the bit is set (1) then this is a 64bit ABI file
1199
* If the bit is clear (0) then this is a 32bit ABI file.
1200
*
1201
* If set, this is a 64bit ABI elf file using a LP64 data model.
1202
* And if this is a WHIRL file, (ie. e_type == ET_IR) then this
1203
* holds 64bit-format WHIRL code.
1204
*
1205
* Similarly, if not set, this is a 32bit ABI elf file using a ILP32
1206
* data model. And if it is a WHIRL file, (ie. e_type == ET_IR) this
1207
* holds 32bit format WHIRL code.
1208
*
1209
* NOTE: In the past, we implied 32bit ABI vs. 64bit ABI from
1210
* the value of the ELFCLASS32 or ELFCLASS64.
1211
*/
1212
#define EF_MIPS_OPSEX EF_MIPS_NOREORDER
1213
#define EF_MIPS_XGOT 0x00000008
1214
#define EF_MIPS_OPTIONS_FIRST 0x00000080
1215
/* obsolete names */
1216
#define EF_MIPS_UGEN_ALLOC EF_MIPS_XGOT
1217
#define EF_MIPS_UGEN_RESERVED EF_MIPS_64BIT_WHIRL
1218
1219
#define EF_MIPS_ABI64 EF_IRIX_ABI64
1220
/* see explanation above for EF_IRIX_ABI64 */
1221
1222
#define EF_MIPS_64BIT_WHIRL EF_MIPS_ABI64
1223
/* This is here for compatibility with pre-v7.4 compiler objects. */
1224
1225
#define EF_MIPS_ABI2 0x00000020
1226
/* indicates n32 as opposed to o32 */
1227
1228
/*
1229
* The EF_MIPS_ARCH field of e_flags describes the ISA of the object.
1230
* size: 4 bits
1231
* type: int
1232
*/
1233
#define EF_MIPS_ARCH 0xf0000000
/* mask: 4 bit field */
1234
#define EF_MIPS_ARCH_1 0x00000000
1235
#define EF_MIPS_ARCH_2 0x10000000
1236
#define EF_MIPS_ARCH_3 0x20000000
1237
#define EF_MIPS_ARCH_4 0x30000000
1238
#define EF_MIPS_ARCH_5 0x40000000
1239
#define EF_MIPS_ARCH_6 0x50000000
1240
1241
/*
1242
* The EF_MIPS_ARCH_ASE field of e_flags describes the set of
1243
* Application Specific Extensions used by the object.
1244
* size: 4 bits
1245
* type: bit-field
1246
*/
1247
#define EF_MIPS_ARCH_ASE 0x0f000000
/* mask: 4 bit field */
1248
#define EF_MIPS_ARCH_ASE_MDMX 0x08000000
/* multi-media extensions*/
1249
#define EF_MIPS_ARCH_ASE_M16 0x04000000
/* MIPS16 isa extensions */
1250
1251
/*
1252
* Please reserve these 8 bits of e_flags for future
1253
* expansion of the EF_MIPS_ARCH_ASE field; increasing
1254
* the field from 4 bits to 12 bits.
1255
*
1256
* 0x00ff0000
1257
*
1258
* If and when we expand it, we'll redefine the EF_MIPS_ARCH_ASE
1259
* macro to be:
1260
*
1261
* 0x0fff0000.
1262
*/
1263
1264
/*
1265
* e_flags -- used by Irix on Intel
1266
*/
1267
#define EF_IA64_PIC 0x00000002
1268
/* Uses PIC calling conventions. This code can be part of
1269
* either an a.out or a dso.
1270
*/
1271
1272
#define EF_IA64_CPIC 0x00000004
1273
/* Uses CPIC (ie. Call PIC) calling conventions.
1274
* This is not currently used in Irix/ia64, but we'll reserve
1275
* the bit for future use.
1276
*/
1277
1278
#define EF_IA64_ARCH 0xff000000
1279
/* Reserved by Intel for architecture version identifier.
1280
* Intended to indicate the minimum level of the architecture
1281
* required by the object code. Currently, the only valid
1282
* value for this field is 0x00
1283
*/
1284
#define EF_IA64_ABI64 EF_IRIX_ABI64
/* 0x00000010 */
1285
/* If the bit is set (1) then this is a 64bit ABI file
1286
* If the bit is clear (0) then this is a 32bit ABI file.
1287
* See explanation in /usr/include/sys/elf.h
1288
*/
1289
1290
/*
1291
* Random constants
1292
*/
1293
1294
#define _TEXT_ALIGN 0x10000
1295
#define _DATA_ALIGN 0x10000
1296
#define ELF_IRIX_MAXPGSZ (64*1024)
1297
#define ELF_IRIX_MINPGSZ (0x1000)
1298
1299
#define ELF_IA64_MAXPGSZ ELF_IRIX_MAXPGSZ
1300
#define ELF_IA64_MINPGSZ ELF_IRIX_MINPGSZ
1301
1302
#define ELF_MIPS_MAXPGSZ ELF_IRIX_MAXPGSZ
1303
#define ELF_MIPS_MINPGSZ ELF_IRIX_MINPGSZ
1304
1305
typedef
struct
1306
{
1307
Elf64_Word
l_name
;
1308
Elf64_Word
l_time_stamp
;
1309
Elf64_Word
l_checksum
;
1310
Elf64_Word
l_version
;
1311
Elf64_Word
l_flags
;
1312
}
Elf64_Lib
;
1313
#endif
1314
1315
/* Legal values for MIPS architecture level. */
1316
1317
#define E_MIPS_ARCH_1 0x00000000
/* -mips1 code. */
1318
#define E_MIPS_ARCH_2 0x10000000
/* -mips2 code. */
1319
#define E_MIPS_ARCH_3 0x20000000
/* -mips3 code. */
1320
1321
/*
1322
* special p_flags
1323
*/
1324
1325
#define PF_MIPS_LOCAL 0x10000000
1326
1327
/* Special section indices. */
1328
1329
#define SHN_MIPS_ACOMMON 0xff00
/* Allocated common symbols */
1330
#define SHN_MIPS_TEXT 0xff01
/* Allocated test symbols. */
1331
#define SHN_MIPS_DATA 0xff02
/* Allocated data symbols. */
1332
#define SHN_MIPS_SCOMMON 0xff03
/* Small common symbols */
1333
#define SHN_MIPS_SUNDEFINED 0xff04
/* Small undefined symbols */
1334
1335
/* Legal values for sh_type field of Elf32_Shdr. */
1336
1337
#define SHT_MIPS_LIBLIST 0x70000000
/* Shared objects used in link */
1338
#define SHT_MIPS_CONFLICT 0x70000002
/* Conflicting symbols */
1339
#define SHT_MIPS_GPTAB 0x70000003
/* Global data area sizes */
1340
#define SHT_MIPS_UCODE 0x70000004
/* Reserved for SGI/MIPS compilers */
1341
#define SHT_MIPS_DEBUG 0x70000005
/* MIPS ECOFF debugging information */
1342
#define SHT_MIPS_REGINFO 0x70000006
/* Register usage information */
1343
#define SHT_MIPS_OPTIONS 0x7000000d
/* Miscellaneous options. */
1344
#define SHT_MIPS_DWARF 0x7000001e
/* DWARF debugging information. */
1345
#define SHT_MIPS_EVENTS 0x70000021
/* Event section. */
1346
#define SHT_MIPS_XLATE 0x70000024
1347
#define SHT_MIPS_XLATE_DEBUG 0x70000025
1348
#define SHT_MIPS_WHIRL 0x70000026
1349
#define SHT_MIPS_XLATE_OLD 0x70000028
1350
1351
/* Legal values for sh_flags field of Elf32_Shdr. */
1352
1353
#define SHF_MIPS_GPREL 0x10000000
/* Must be part of global data area */
1354
1355
#if defined(__MIPS_AND_IA64_ELF_H)
1356
#define SHT_IRIX_LIBLIST (SHT_LOPROC + 0)
1357
#define SHT_IRIX_MSYM (SHT_LOPROC + 1)
1358
#define SHT_IRIX_CONFLICT (SHT_LOPROC + 2)
1359
#define SHT_IRIX_GPTAB (SHT_LOPROC + 3)
1360
#define SHT_IRIX_UCODE (SHT_LOPROC + 4)
1361
#define SHT_IRIX_DEBUG (SHT_LOPROC + 5)
1362
#define SHT_IRIX_REGINFO (SHT_LOPROC + 6)
1363
1364
#ifdef __osf__
1365
#define SHT_IRIX_PACKAGE (SHT_LOPROC + 7)
1366
#define SHT_IRIX_PACKSYM (SHT_LOPROC + 8)
1367
#endif
/* __osf__ */
1368
1369
#define SHT_IRIX_RELD (SHT_LOPROC + 9)
1370
#define SHT_IRIX_DONTUSE (SHT_LOPROC + 10)
1371
1372
#define SHT_IRIX_IFACE (SHT_LOPROC + 11)
1373
#define SHT_IRIX_CONTENT (SHT_LOPROC + 12)
1374
#define SHT_IRIX_OPTIONS (SHT_LOPROC + 13)
1375
1376
#define SHT_IRIX_SHDR (SHT_LOPROC + 16)
1377
#define SHT_IRIX_FDESC (SHT_LOPROC + 17)
1378
#define SHT_IRIX_EXTSYM (SHT_LOPROC + 18)
1379
#define SHT_IRIX_DENSE (SHT_LOPROC + 19)
1380
#define SHT_IRIX_PDESC (SHT_LOPROC + 20)
1381
#define SHT_IRIX_LOCSYM (SHT_LOPROC + 21)
1382
#define SHT_IRIX_AUXSYM (SHT_LOPROC + 22)
1383
#define SHT_IRIX_OPTSYM (SHT_LOPROC + 23)
1384
#define SHT_IRIX_LOCSTR (SHT_LOPROC + 24)
1385
#define SHT_IRIX_LINE (SHT_LOPROC + 25)
1386
#define SHT_IRIX_RFDESC (SHT_LOPROC + 26)
1387
1388
#define SHT_IRIX_DELTASYM (SHT_LOPROC + 27)
1389
#define SHT_IRIX_DELTAINST (SHT_LOPROC + 28)
1390
#define SHT_IRIX_DELTACLASS (SHT_LOPROC + 29)
1391
1392
#define SHT_IRIX_DWARF (SHT_LOPROC + 30)
1393
#define SHT_IRIX_DELTADECL (SHT_LOPROC + 31)
1394
#define SHT_IRIX_SYMBOL_LIB (SHT_LOPROC + 32)
1395
#define SHT_IRIX_EVENTS (SHT_LOPROC + 33)
1396
#define SHT_IRIX_TRANSLATE (SHT_LOPROC + 34)
1397
#define SHT_IRIX_PIXIE (SHT_LOPROC + 35)
1398
#define SHT_IRIX_XLATE (SHT_LOPROC + 36)
1399
#define SHT_IRIX_XLATE_DEBUG (SHT_LOPROC + 37)
1400
#define SHT_IRIX_WHIRL (SHT_LOPROC + 38)
1401
#define SHT_IRIX_EH_REGION (SHT_LOPROC + 39)
1402
#define SHT_IRIX_XLATE_OLD (SHT_LOPROC + 40)
1403
#define SHT_IRIX_PDR_EXCEPTION (SHT_LOPROC + 41)
1404
1405
/* The next five section types are valid only on irix/ia64 */
1406
#define SHT_IRIX_EXT (SHT_LOPROC + 42)
1407
#define SHT_IRIX_UNWIND (SHT_LOPROC + 43)
1408
#define SHT_IRIX_UNWIND_INFO (SHT_LOPROC + 44)
1409
#define SHT_IRIX_PLT (SHT_LOPROC + 45)
1410
#define SHT_IRIX_PLTOFF (SHT_LOPROC + 46)
1411
#define SHT_IA64_UNWIND SHT_IRIX_UNWIND
1412
#define SHT_IA64_UNWIND_INFO SHT_IRIX_UNWIND_INFO
1413
#define SHT_IA64_OPTIONS SHT_IRIX_OPTIONS
1414
1415
1416
#define SHT_IRIX_NUM 47
1417
/* SHT_IRIX_NUM is one more than the highest offset to SHT_LOCPROC;
1418
* it is the number of extensions, but is *NOT* a section type.
1419
*/
1420
1421
#define SHT_MIPS_MSYM SHT_IRIX_MSYM
1422
#define SHT_MIPS_CONTENT SHT_IRIX_CONTENT
1423
1424
#define SHT_MIPS_DELTADECL SHT_IRIX_DELTADECL
1425
#define SHT_MIPS_SYMBOL_LIB SHT_IRIX_SYMBOL_LIB
1426
#define SHT_MIPS_TRANSLATE SHT_IRIX_TRANSLATE
1427
#define SHT_MIPS_PIXIE SHT_IRIX_PIXIE
1428
#define SHT_MIPS_EH_REGION SHT_IRIX_EH_REGION
1429
#define SHT_MIPS_PDR_EXCEPTION SHT_IRIX_PDR_EXCEPTION
1430
1431
#define SHT_MIPS_SHDR SHT_IRIX_SHDR
1432
#define SHT_MIPS_FDESC SHT_IRIX_FDESC
1433
#define SHT_MIPS_EXTSYM SHT_IRIX_EXTSYM
1434
#define SHT_MIPS_DENSE SHT_IRIX_DENSE
1435
#define SHT_MIPS_PDESC SHT_IRIX_PDESC
1436
#define SHT_MIPS_LOCSYM SHT_IRIX_LOCSYM
1437
#define SHT_MIPS_AUXSYM SHT_IRIX_AUXSYM
1438
#define SHT_MIPS_OPTSYM SHT_IRIX_OPTSYM
1439
#define SHT_MIPS_LOCSTR SHT_IRIX_LOCSTR
1440
#define SHT_MIPS_LINE SHT_IRIX_LINE
1441
#define SHT_MIPS_RFDESC SHT_IRIX_RFDESC
1442
1443
#define SHT_MIPS_DONTUSE SHT_IRIX_DONTUSE
1444
1445
/*
1446
* sh_flags
1447
*
1448
* We'll try and use the same flags for both irix/mips and irix/ia64.
1449
* If this ever becomes a problem, we'll have to split them into
1450
* two different namespaces.
1451
*/
1452
#define SHF_IRIX_GPREL 0x10000000
1453
#define SHF_IRIX_MERGE 0x20000000
1454
#define SHF_IRIX_ADDR 0x40000000
/* Reserved for future */
1455
#define SHF_IRIX_STRINGS 0x80000000
/* Reserved for future */
1456
#define SHF_IRIX_NOSTRIP 0x08000000
1457
#define SHF_IRIX_LOCAL 0x04000000
1458
#define SHF_IRIX_NAMES 0x02000000
/* Reserved for future */
1459
#define SHF_IRIX_NODUPE 0x01000000
/* Reserved for future */
1460
1461
#define SHF_MIPS_MERGE SHF_IRIX_MERGE
1462
#define SHF_MIPS_ADDR SHF_IRIX_ADDR
1463
#define SHF_MIPS_STRINGS SHF_IRIX_STRINGS
1464
#define SHF_MIPS_NOSTRIP SHF_IRIX_NOSTRIP
1465
#define SHF_MIPS_LOCAL SHF_IRIX_LOCAL
1466
#define SHF_MIPS_NAMES SHF_IRIX_NAMES
1467
#define SHF_MIPS_NODUPE SHF_IRIX_NODUPE
1468
1469
#define SHT_MIPS_IFACE SHT_IRIX_IFACE
1470
1471
/* ====================================================================
1472
*
1473
* Symbol table
1474
*
1475
* ====================================================================
1476
*/
1477
1478
/*
1479
* Special Irix st_other
1480
*/
1481
#define STO_DEFAULT 0x0
1482
#define STO_INTERNAL 0x1
1483
#define STO_HIDDEN 0x2
1484
#define STO_PROTECTED 0x3
1485
#define STO_OPTIONAL 0x4
1486
#define STO_SC_ALIGN_UNUSED 0xff
/* No longer used */
1487
1488
/*
1489
* Special Irix st_info
1490
*/
1491
#define STB_SPLIT_COMMON (STB_LOPROC+0)
1492
1493
/* ====================================================================
1494
*
1495
* Section Headers
1496
*
1497
* ====================================================================
1498
*/
1499
1500
/*
1501
* Special Irix section indices
1502
*/
1503
1504
#define SHN_IRIX_ACOMMON (SHN_LOPROC + 0)
1505
#define SHN_IRIX_TEXT (SHN_LOPROC + 1)
1506
#define SHN_IRIX_DATA (SHN_LOPROC + 2)
1507
#define SHN_IRIX_SCOMMON (SHN_LOPROC + 3)
1508
#define SHN_IRIX_SUNDEFINED (SHN_LOPROC + 4)
1509
#define SHN_IRIX_LCOMMON (SHN_LOPROC + 5)
1510
#define SHN_IRIX_LUNDEFINED (SHN_LOPROC + 6)
1511
1512
/*
1513
* Special mips section indices
1514
*/
1515
1516
#define SHN_MIPS_LCOMMON SHN_IRIX_LCOMMON
1517
#define SHN_MIPS_LUNDEFINED SHN_IRIX_LUNDEFINED
1518
1519
1520
/* Event kind -- valid for ELF-32 and ELF-64: */
1521
typedef
enum
{
1522
EK_NULL
= 0x00,
/* No valid information */
1523
EK_ADDR_RESET
= 0x01,
/* Reset offset into associated text section */
1524
EK_INCR_LOC_EXT
= 0x02,
/* Increment offset into associated text section */
1525
EK_ENTRY
= 0x03,
/* Subprogram entrypoint */
1526
EK_IF_ENTRY
= 0x04,
/* Subprogram entrypoint with associated interface offset */
1527
EK_EXIT
= 0x05,
/* Subprogram exit */
1528
EK_PEND
= 0x06,
/* Subprogram end (last instruction) */
1529
1530
EK_SWITCH_32
= 0x7,
/* jr for switch stmt, table entries are 32bit */
1531
EK_SWITCH_64
= 0x8,
/* jr for switch stmt, table entries are 64bit */
1532
EK_DUMMY
= 0x09,
/* empty slot */
1533
1534
EK_BB_START
= 0x0a,
/* Basic block beginning */
1535
EK_INCR_LOC_UNALIGNED
= 0x0b,
/* Increment unaligned byte offset */
1536
EK_GP_PROLOG_HI
= 0x0c,
/* Establish high 16bits of GP */
1537
EK_GP_PROLOG_LO
= 0x0d,
/* Establish low 16bits of GP */
1538
EK_GOT_PAGE
= 0x0e,
/* Compact relocation: GOT page pointer */
1539
EK_GOT_OFST
= 0x0f,
/* Compact relocation: GOT page offset */
1540
EK_HI
= 0x10,
/* Compact relocation: high 16bits of abs. addr */
1541
EK_LO
= 0x11,
/* Compact relocation: low 16bits of abs. addr */
1542
EK_64_HIGHEST
= 0x12,
/* Compact relocation: most significant 16 bits
1543
of a 64bit absolute address */
1544
EK_64_HIGHER
= 0x13,
/* Compact relocation: second most significant
1545
16 bits of a 64bit absolute address */
1546
EK_64_HIGH
= 0x14,
/* Compact relocation: third most significant
1547
16 bits of a 64bit absolute address */
1548
EK_64_LOW
= 0x15,
/* Compact relocation: least significant 16 bits
1549
of a 64bit absolute address */
1550
EK_GPREL
= 0x16,
/* Compact relocation: GP relative reference */
1551
1552
EK_DEF
= 0x17,
/* Define new event kind format */
1553
1554
EK_FCALL_LOCAL
= 0x18,
/* point-of-call (jalr) to a local procedure */
1555
EK_FCALL_EXTERN
= 0x19,
/* jalr to extern procedure (small got case) */
1556
EK_FCALL_EXTERN_BIG
= 0x1a,
/* jalr to extern procedure (large got case) */
1557
EK_FCALL_MULT
= 0x1b,
/* jalr to more than one procedure */
1558
EK_FCALL_MULT_PARTIAL
= 0x1c,
/* jalr to multiple + unknown procedures */
1559
1560
EK_LTR_FCALL
= 0x1d,
/* jalr to rld lazy-text res. index of
1561
symbol associated. */
1562
EK_PCREL_GOT0
= 0x1e,
/* immediate is hi 16 bits of 32-bit
1563
constant. Argument is offset to lo,
1564
in instructions, not bytes*/
1565
1566
/* The following events are reserved for supporting Purify-type tools: */
1567
EK_MEM_COPY_LOAD
= 0x1f,
/* load only for copying data */
1568
EK_MEM_COPY_STORE
= 0x20,
/* store only for copying data --
1569
LEB128 operand is word offset to
1570
paired load */
1571
EK_MEM_PARTIAL_LOAD
= 0x21,
/* load for reference to a subset of bytes --
1572
BYTE operand's 8 bits indicate which
1573
bytes are actually used */
1574
EK_MEM_EAGER_LOAD
= 0x22,
/* load is speculative */
1575
EK_MEM_VALID_LOAD
= 0x23,
/* load of data known to be valid */
1576
1577
1578
/*
1579
* Yet to be defined kinds with no fields (like EK_EXIT)
1580
*/
1581
EK_CK_UNUSED_NONE_0
= 0x50,
/* */
1582
EK_CK_UNUSED_NONE_1
= 0x51,
/* */
1583
EK_CK_UNUSED_NONE_2
= 0x52,
/* */
1584
EK_CK_UNUSED_NONE_3
= 0x53,
/* */
1585
EK_CK_UNUSED_NONE_4
= 0x54,
/* */
1586
1587
/*
1588
* Yet to be defined kinds with 1 16 bit field
1589
*/
1590
EK_CK_UNUSED_16BIT_0
= 0x55,
1591
EK_CK_UNUSED_16BIT_1
= 0x56,
1592
EK_CK_UNUSED_16BIT_2
= 0x57,
/* */
1593
EK_CK_UNUSED_16BIT_3
= 0x58,
/* */
1594
EK_CK_UNUSED_16BIT_4
= 0x59,
/* */
1595
1596
/*
1597
* Yet to be defined kinds with 1 32 bit field
1598
*/
1599
EK_CK_UNUSED_32BIT_0
= 0x5a,
/* */
1600
EK_CK_UNUSED_32BIT_1
= 0x5b,
/* */
1601
EK_CK_UNUSED_32BIT_2
= 0x5c,
/* */
1602
1603
/*
1604
* Yet to be defined kinds with 1 64 bit field
1605
*/
1606
1607
EK_CK_UNUSED_64BIT_0
= 0x5d,
1608
EK_CK_UNUSED_64BIT_1
= 0x5e,
1609
EK_CK_UNUSED_64BIT_2
= 0x5f,
/* */
1610
EK_CK_UNUSED_64BIT_3
= 0x60,
/* */
1611
EK_CK_UNUSED_64BIT_4
= 0x61,
/* */
1612
1613
/*
1614
* Yet to be defined kinds with 1 uleb128 field
1615
*/
1616
EK_CK_UNUSED_ULEB128_0
= 0x62,
/* */
1617
EK_CK_UNUSED_ULEB128_1
= 0x63,
/* */
1618
EK_CK_UNUSED_ULEB128_2
= 0x64,
/* */
1619
EK_CK_UNUSED_ULEB128_3
= 0x65,
/* */
1620
EK_CK_UNUSED_ULEB128_4
= 0x66,
/* */
1621
EK_CK_UNUSED_ULEB128_5
= 0x67,
/* */
1622
EK_CK_UNUSED_ULEB128_6
= 0x68,
/* */
1623
EK_CK_UNUSED_ULEB128_7
= 0x69,
/* */
1624
EK_CK_UNUSED_ULEB128_8
= 0x6a,
/* */
1625
EK_CK_UNUSED_ULEB128_9
= 0x6b,
/* */
1626
1627
1628
EK_INCR_LOC
= 0x80
/* Increment offset into associated text section */
1629
1630
}
Elf_MIPS_Event_Kind
;
1631
typedef
Elf_MIPS_Event_Kind
Elf_Event_Kind
;
1632
1633
/* The following defines list the various types of operands that are
1634
* supported with the EK_DEF event kind.
1635
*/
1636
#define EK_DEF_UCHAR (1)
/* unsigned char (8 bits) */
1637
#define EK_DEF_USHORT (2)
/* unsigned short (16 bits) */
1638
#define EK_DEF_UINT (3)
/* unsigned int (32 bits) */
1639
#define EK_DEF_ULONG (4)
/* unsigned long (64 bits) */
1640
#define EK_DEF_ULEB128 (5)
/* unsigned LEB128 encoded number */
1641
#define EK_DEF_CHAR (6)
/* signed char (8 bits) */
1642
#define EK_DEF_SHORT (7)
/* signed short (16 bits) */
1643
#define EK_DEF_INT (8)
/* signed int (32 bits) */
1644
#define EK_DEF_LONG (9)
/* signed long (64 bits) */
1645
#define EK_DEF_LEB128 (10)
/* signed LEB128 encoded number */
1646
#define EK_DEF_STRING (11)
/* null terminated string */
1647
#define EK_DEF_VAR (12)
/* variable length field: the first 2
1648
bytes is an unsigned short
1649
specifying the total number of bytes
1650
of this field including the first 2
1651
bytes */
1652
#define CK_DEF EK_DEF
1653
1654
#define R_MIPS_GPREL 7
1655
1656
typedef
struct
{
1657
Elf64_Word
symbol
;
/* symbol table index of subprogram, or 0 */
1658
Elf64_Half
attrs
;
/* Attributes: See list below */
1659
Elf64_Byte
pcnt
;
/* Parameter count */
1660
Elf64_Byte
fpmask
;
/* bit on indicates an FP parameter register */
1661
}
Elf_Ifd
;
1662
1663
typedef
Elf_Ifd
Elf_Interface_Descriptor
;
/* for compatibility */
1664
1665
/* Flags that can be set in the 'attrs' field of Elf_Interface_Descriptor */
1666
#define SA_PROTOTYPED 0x8000
/* Does def or ref have prototype ? */
1667
#define SA_VARARGS 0x4000
/* Is this a varargs subprogram ? */
1668
#define SA_PIC 0x2000
/* Are memory references PIC? */
1669
#define SA_DSO_ENTRY 0x1000
/* Is subprogram valid DSO entry? */
1670
#define SA_ADDRESSED 0x0800
/* Is subprogram address taken? */
1671
#define SA_FUNCTION 0x0400
/* Does subprogram return a result? */
1672
#define SA_NESTED 0x0200
/* Is subprogram nested? */
1673
#define SA_IGNORE_ERROR 0x0100
/* Ignore consistency errors? */
1674
#define SA_DEFINITION 0x0080
/* Is this a definition (no just call)? */
1675
#define SA_AT_FREE 0x0040
/* Is the at register free at all branches? */
1676
#define SA_FREE_REGS 0x0020
/* Free register mask precedes parm profile */
1677
#define SA_PARAMETERS 0x0010
/* Parameter profile follows descriptor? */
1678
#define SA_ALTINTERFACE 0x0008
/* Alternate descriptor follows? */
1679
1680
/* Fundamental Parameter Types */
1681
#define FT_unknown 0x0000
1682
#define FT_signed_char 0x0001
1683
#define FT_unsigned_char 0x0002
1684
#define FT_signed_short 0x0003
1685
#define FT_unsigned_short 0x0004
1686
#define FT_signed_int32 0x0005
1687
#define FT_unsigned_int32 0x0006
1688
#define FT_signed_int64 0x0007
1689
#define FT_unsigned_int64 0x0008
1690
#define FT_pointer32 0x0009
1691
#define FT_pointer64 0x000a
1692
#define FT_float32 0x000b
1693
#define FT_float64 0x000c
1694
#define FT_float128 0x000d
1695
#define FT_complex64 0x000e
1696
#define FT_complex128 0x000f
1697
#define FT_complex256 0x0010
1698
#define FT_void 0x0011
1699
#define FT_bool32 0x0012
1700
#define FT_bool64 0x0013
1701
#define FT_label32 0x0014
1702
#define FT_label64 0x0015
1703
#define FT_struct 0x0020
1704
#define FT_union 0x0021
1705
#define FT_enum 0x0022
1706
#define FT_typedef 0x0023
1707
#define FT_set 0x0024
1708
#define FT_range 0x0025
1709
#define FT_member_ptr 0x0026
1710
#define FT_virtual_ptr 0x0027
1711
#define FT_class 0x0028
1712
1713
/* Parameter Qualifiers (aka Modifiers) */
1714
#define MOD_pointer_to 0x01
1715
#define MOD_reference_to 0x02
1716
#define MOD_const 0x03
1717
#define MOD_volatile 0x04
1718
#define MOD_function 0x80
1719
#define MOD_array_of 0x81
1720
1721
/* Parameter descriptor masks */
1722
#define PDM_TYPE 0x00ff
/* Fundamental type of parameter */
1723
#define PDM_REFERENCE 0x4000
/* Reference parameter ? */
1724
#define PDM_SIZE 0x2000
/* Followed by explicit 32-bit byte count? */
1725
#define PDM_Qualifiers 0x0f00
/* Count of type qualifiers << 8 */
1726
1727
/* Parameter descriptor mask flags */
1728
#define PDMF_REFERENCE 0x40
1729
#define PDMF_SIZE 0x20
1730
#define PDMF_Qualifiers 0x0f
1731
#endif
1732
1733
/* Entries found in sections of type SHT_MIPS_GPTAB. */
1734
1735
typedef
union
1736
{
1737
struct
1738
{
1739
Elf32_Word
gt_current_g_value
;
/* -G value used for compilation */
1740
Elf32_Word
gt_unused
;
/* Not used */
1741
} gt_header;
/* First entry in section */
1742
struct
1743
{
1744
Elf32_Word
gt_g_value
;
/* If this value were used for -G */
1745
Elf32_Word
gt_bytes
;
/* This many bytes would be used */
1746
} gt_entry;
/* Subsequent entries in section */
1747
}
Elf32_gptab
;
1748
1749
/* Entry found in sections of type SHT_MIPS_REGINFO. */
1750
1751
typedef
struct
1752
{
1753
Elf32_Word
ri_gprmask
;
/* General registers used */
1754
Elf32_Word
ri_cprmask[4];
/* Coprocessor registers used */
1755
Elf32_Sword
ri_gp_value
;
/* $gp register value */
1756
}
Elf32_RegInfo
;
1757
1758
typedef
struct
1759
{
1760
Elf64_Word
ri_gprmask
;
/* mask of general regs used */
1761
Elf64_Word
ri_pad
;
/* for alignment */
1762
Elf64_Word
ri_cprmask[4];
/* mask of cop regs used */
1763
Elf64_Addr
ri_gp_value
;
/* initial value of gp */
1764
}
Elf64_RegInfo
;
1765
1766
/* MIPS relocs. */
1767
1768
#define R_MIPS_NONE 0
/* No reloc */
1769
#define R_MIPS_16 1
/* Direct 16 bit */
1770
#define R_MIPS_32 2
/* Direct 32 bit */
1771
#define R_MIPS_REL32 3
/* PC relative 32 bit */
1772
#define R_MIPS_26 4
/* Direct 26 bit shifted */
1773
#define R_MIPS_HI16 5
/* High 16 bit */
1774
#define R_MIPS_LO16 6
/* Low 16 bit */
1775
#define R_MIPS_GPREL16 7
/* GP relative 16 bit */
1776
#define R_MIPS_LITERAL 8
/* 16 bit literal entry */
1777
#define R_MIPS_GOT16 9
/* 16 bit GOT entry */
1778
#define R_MIPS_PC16 10
/* PC relative 16 bit */
1779
#define R_MIPS_CALL16 11
/* 16 bit GOT entry for function */
1780
#define R_MIPS_GPREL32 12
/* GP relative 32 bit */
1781
#define R_MIPS_NUM 13
1782
#define R_MIPS_SHIFT5 16
1783
#define R_MIPS_SHIFT6 17
1784
#define R_MIPS_64 18
1785
#define R_MIPS_GOT_DISP 19
1786
#define R_MIPS_GOT_PAGE 20
1787
#define R_MIPS_GOT_OFST 21
1788
#define R_MIPS_GOT_HI16 22
1789
#define R_MIPS_GOT_LO16 23
1790
#define R_MIPS_SUB 24
1791
#define R_MIPS_INSERT_A 25
1792
#define R_MIPS_INSERT_B 26
1793
#define R_MIPS_DELETE 27
1794
#define R_MIPS_HIGHER 28
1795
#define R_MIPS_HIGHEST 29
1796
#define R_MIPS_CALL_HI16 30
1797
#define R_MIPS_CALL_LO16 31
1798
#define R_MIPS_SCN_DISP 32
1799
#define R_MIPS_REL16 33
1800
#define R_MIPS_ADD_IMMEDIATE 34
1801
#define R_MIPS_PJUMP 35
1802
#define R_MIPS_RELGOT 36
1803
#define R_MIPS_JALR 37
1804
1805
1806
#define _R_MIPS_COUNT_ 38
/* Number of relocations */
1807
/* _R_MIPS_COUNT_ is not a relocation type, it is
1808
** a count of relocation types.
1809
** Must be one greater than the highest relocation
1810
** type.
1811
*/
1812
1813
/* Legal values for p_type field of Elf32_Phdr. */
1814
1815
#define PT_MIPS_REGINFO 0x70000000
/* Register usage information */
1816
1817
/*
1818
* Program header types defined by Intel
1819
*/
1820
1821
#define PT_IA64_ARCHEXT (PT_LOPROC + 0)
1822
/* This segment contains SHT_IA64_EXT sections. If this entry
1823
* is present, it must precede all entries of type PT_LOAD
1824
*/
1825
#define PT_IA64_UNWIND (PT_LOPROC + 1)
1826
/* This segment contains stack unwind tables.
1827
*/
1828
1829
/*
1830
* Program header types defined by Irix/ia64
1831
*/
1832
#define PT_IA64_OPTIONS (PT_LOPROC + 2)
1833
/* This segment contains the options section. By putting
1834
* the option section into a special segment, it makes it
1835
* easy for the kernel, exec, and/or rld to quickly find
1836
* the option section.
1837
*/
1838
1839
/*
1840
* special p_flags
1841
*/
1842
1843
#define PF_IA64_NORECOV 0x80000000
1844
/* This segment contains SHT_IA64_NORECOV sections
1845
*/
1846
/* #define PF_IA64_LOCAL 0x10000000 */
1847
/* This segment is local to a thread.
1848
*
1849
* -------- WARNING: DO NOT USE PF_IA64_LOCAL ------------
1850
*
1851
* Currently, it is only .data sections (and .bss ?)
1852
* that can marked as LOCAL. Because of this, it
1853
* seems reasonable that we should not use a p_flag but,
1854
* rather, should create new p_types for any local sections.
1855
*
1856
* The decision has not yet be made on this issue.
1857
*
1858
* TBD: Should PF_IA64_LOCAL be a flag or new p_type ?
1859
*
1860
*/
1861
1862
/* Legal values for d_tag field of Elf32_Dyn. */
1863
1864
#define DT_MIPS_RLD_VERSION 0x70000001
/* Runtime linker interface version */
1865
#define DT_MIPS_TIME_STAMP 0x70000002
/* Timestamp */
1866
#define DT_MIPS_ICHECKSUM 0x70000003
/* Checksum */
1867
#define DT_MIPS_IVERSION 0x70000004
/* Version string (string tbl index) */
1868
#define DT_MIPS_FLAGS 0x70000005
/* Flags */
1869
#define DT_MIPS_BASE_ADDRESS 0x70000006
/* Base address */
1870
#define DT_MIPS_MSYM 0x70000007
1871
#define DT_MIPS_CONFLICT 0x70000008
/* Address of CONFLICT section */
1872
#define DT_MIPS_LIBLIST 0x70000009
/* Address of LIBLIST section */
1873
#define DT_MIPS_LOCAL_GOTNO 0x7000000a
/* Number of local GOT entries */
1874
#define DT_MIPS_CONFLICTNO 0x7000000b
/* Number of CONFLICT entries */
1875
#define DT_MIPS_LIBLISTNO 0x70000010
/* Number of LIBLIST entries */
1876
#define DT_MIPS_SYMTABNO 0x70000011
/* Number of DYNSYM entries */
1877
#define DT_MIPS_UNREFEXTNO 0x70000012
/* First external DYNSYM */
1878
#define DT_MIPS_GOTSYM 0x70000013
/* First GOT entry in DYNSYM */
1879
#define DT_MIPS_HIPAGENO 0x70000014
/* Number of GOT page table entries */
1880
#define DT_MIPS_RLD_MAP 0x70000016
/* Address of run time loader map. */
1881
#define DT_MIPS_NUM 0x17
1882
1883
/* Legal values for DT_MIPS_FLAG Elf32_Dyn entry. */
1884
1885
#define RHF_NONE 0
/* No flags */
1886
#define RHF_QUICKSTART (1 << 0)
/* Use quickstart */
1887
#define RHF_NOTPOT (1 << 1)
/* Hash size not power of 2 */
1888
#define RHF_NO_LIBRARY_REPLACEMENT (1 << 2)
/* Ignore LD_LIBRARY_PATH */
1889
1890
/* Entries found in sections of type SHT_MIPS_LIBLIST. */
1891
1892
typedef
struct
1893
{
1894
Elf32_Word
l_name
;
/* Name (string table index) */
1895
Elf32_Word
l_time_stamp
;
/* Timestamp */
1896
Elf32_Word
l_checksum
;
/* Checksum */
1897
Elf32_Word
l_version
;
/* Interface version */
1898
Elf32_Word
l_flags
;
/* Flags */
1899
}
Elf32_Lib
;
1900
1901
/* Legal values for l_flags. */
1902
1903
#define LL_EXACT_MATCH (1 << 0)
/* Require exact match */
1904
#define LL_IGNORE_INT_VER (1 << 1)
/* Ignore interface version */
1905
1906
#if defined(__MIPS_AND_IA64_ELF_H)
1907
/*
1908
* l_flags These flags exist in each liblist entry.
1909
* The dynamic section flag bit RHF_SGI_ONLY
1910
* must be on for most of these to be honored by rld(1).
1911
* LL_DELAY_LOAD is honored regardless of RHF_SGI_ONLY.
1912
* If RHF_SGI_ONLY is not on no version matches are done
1913
* (just as if LL_IGNORE_INT_VER were on).
1914
*
1915
* Recall that a liblist entry has a version string with a single version,
1916
* while the dynamic section on a DSO has a version string with
1917
* possibly multiple versions listed (separated by :). man dso for
1918
* more details on multiple versions.
1919
*
1920
* By default version matches do NOT consider the minor version number.
1921
*
1922
* LL_EXACT_MATCH means (if on) that only a DSO with exactly the
1923
* checksum and timestamp and version from the liblist entry
1924
* (which were gotten at static-link time but might have
1925
* been updated by rqs(1)) will match.
1926
*
1927
* LL_REQUIRE_MINOR means (if on) that the version match must
1928
* match the minor version number.
1929
*
1930
* LL_NONE is just a convenient name requesting the default checks.
1931
*
1932
* LL_DELAY_LOAD means (if on) that rld will not load the DSO
1933
* refered to by the liblist entry till something in the DSO
1934
* is called.
1935
*
1936
* LL_EXPORTS is ignored by rld. It informs that ld exported symbols
1937
* from the liblist-entry DSO into the main DSO (that this
1938
* liblist entry is part of).
1939
*
1940
* LL_IGNORE_INT_VER means (if on) that all version checks
1941
* should be suppressed and the DSO accepted based on
1942
* name alone.
1943
*
1944
* LL_DELTA means that the DSO referenced is Delta C++.
1945
*
1946
*/
1947
1948
#define LL_NONE 0
1949
#define LL_REQUIRE_MINOR 0x4
1950
#define LL_EXPORTS 0x8
1951
#define LL_DELAY_LOAD 0x10
1952
1953
#define LL_DELTA 0x20
1954
1955
/* RHF_QUICKSTART is turned on by ld if
1956
ld determines that at link time the
1957
object is quickstartable.
1958
*/
1959
/* RHF_NOTPOT bit non-zero if elf hash
1960
table element count
1961
is NOT a Power Of Two
1962
If 0, rld uses mask, else rld uses %
1963
(mod) operator to turn hash into index.
1964
*/
1965
/* RHF_NO_LIBRARY_REPLACEMENT
1966
is set by ld -no_library_replacement
1967
and tells rld not to honor _RLD*_ROOT
1968
or _RLD*_PATH environment variables.
1969
from the time detected (during the
1970
program execution).
1971
*/
1972
1973
#define RHF_NO_MOVE 0x00000008
1974
/* If RHF_NO_MOVE is on and a DSO is moved
1975
from the address it was linked at, rld
1976
will give a fatal error and exit.
1977
If it was a dlopen()-type call, the call
1978
will fail (but the app will not exit).
1979
*/
1980
#define RHF_SGI_ONLY 0x00000010
1981
/* RHF_SGI_ONLY enables various flags, such as the
1982
liblist flags so that rld pays
1983
attention tothe flags
1984
*/
1985
1986
1987
#define RHF_GUARANTEE_INIT 0x00000020
1988
/* RHF_GUARANTEE_INIT, if on, provokes a fatal
1989
error if rld detects a call into a DSO
1990
for which the -init code has not been run.
1991
1992
This could happen if dso B has dso C on B's
1993
liblist and DSO C's init code calls something
1994
int DSO B and DSO B has RHF_GUARANTEE_INIT on.
1995
This was designed to help implement C++
1996
initializations in an early C++ release (5.3?).
1997
Not used by C++ for quite some time.
1998
*/
1999
#define RHF_DELTA_C_PLUS_PLUS 0x00000040
2000
/* RHF_DELTA_C_PLUS_PLUS tells rld that the
2001
executable/DSO is Delta C++.
2002
*/
2003
#define RHF_GUARANTEE_START_INIT 0x00000080
2004
/* RHF_GUARANTEE_START_INIT, if on, causes rld to
2005
run a target DSO's -init code
2006
in result of a call into that DSO.
2007
2008
This could happen if dso B has dso C on B's
2009
liblist and DSO C's init code calls something
2010
int DSO B and DSO B has
2011
RHF_GUARANTEE_START_INIT on.
2012
rld will start running DSO C's -init code and
2013
when that calls a DSO B function,
2014
DSO B's -init code is run before the
2015
call to B is allowed to run.
2016
*/
2017
2018
#define RHF_PIXIE 0x00000100
2019
/* RHF_PIXIE is set in pixified DSOs/executables.
2020
Notifies rld(1) to do special handling of
2021
dlopen() strings and to save/restore pixie
2022
registers (which save/restore is actually not
2023
needed as of SpeedShop 1.3).
2024
*/
2025
2026
2027
#define RHF_DEFAULT_DELAY_LOAD 0x00000200
2028
/* If DSO B is linked into DSO A
2029
and RHF_DEFAULT_DELAY_LOAD is on in DSO B,
2030
ld will mark (in the liblist of DSO A) that
2031
DSO B should be delay-loaded by rld, not
2032
loaded at the same time A is.
2033
(data-dependencies may turn the delay-load off).
2034
*/
2035
#define RHF_REQUICKSTART 0x00000400
2036
/* If RHF_REQUICKSTART is on, rqs will
2037
process the object. If off,
2038
rqs will not process the object unless
2039
-force_requickstart option used.
2040
Set by ld or rqs.
2041
ld sets it if ld believes the object should
2042
allow rqs-ing. -abi objects do not have
2043
this turned on by ld.
2044
*/
2045
#define RHF_REQUICKSTARTED 0x00000800
2046
/* RHF_REQUICKSTARTED bit non-zero if
2047
rqs has processed the object
2048
Set by rqs.
2049
*/
2050
#define RHF_CORD 0x00001000
2051
/* RHF_CORD bit is non-zero if
2052
the object has been cord(1)ed
2053
set by cord.
2054
*/
2055
#define RHF_NO_UNRES_UNDEF 0x00002000
2056
/* RHF_NO_UNRES_UNDEF is non-zero if
2057
every external symbol is resolved
2058
(ie, no externals are undefined)
2059
Set by ld or rqs.
2060
*/
2061
#define RHF_RLD_ORDER_SAFE 0x00004000
2062
/* If on, RHF_RLD_ORDER_SAFE tells rld it
2063
can stop searching for UNDEFineds to
2064
resolve when the
2065
first non-ABS, non-UNDEF is found
2066
(saving time in rld).
2067
Set by ld.
2068
*/
2069
2070
#define DT_IRIX_LTR 0x70000033
2071
#define DT_IRIX_LPT 0x70000034
2072
#define DT_IRIX_LPT_IDX 0x70000035
2073
#define DT_IRIX_LPT_NO 0x70000036
2074
#define DT_IRIX_PLT 0x70000037
2075
#define DT_IRIX_PLT_NON_PREEMPT_IDX 0x70000038
2076
#define DT_IRIX_PLT_NON_PREEMPT_NO 0x70000039
2077
#define DT_IRIX_PLT_IN_DYNSYM_IDX 0x7000003A
2078
#define DT_IRIX_PLT_IN_DYMSYM_NO 0x7000003B
2079
#define DT_IRIX_PLT_PROTECTED_IDX 0x7000003C
2080
#define DT_IRIX_PLT_PROTECTED_NO 0x7000003D
2081
#define DT_IRIX_PLT_PREEMPT_IDX 0x7000003E
2082
#define DT_IRIX_PLT_PREEMPT_NO 0x7000003F
2083
#define DT_IRIX_DLT 0x70000040
2084
#define DT_IRIX_DLT_NON_PREEMPT_IDX 0x70000041
2085
#define DT_IRIX_DLT_NON_PREEMPT_NO 0x70000042
2086
#define DT_IRIX_DLT_IN_DYNSYM_IDX 0x70000043
2087
#define DT_IRIX_DLT_IN_DYMSYM_NO 0x70000044
2088
#define DT_IRIX_DLT_PROTECTED_IDX 0x70000045
2089
#define DT_IRIX_DLT_PROTECTED_NO 0x70000046
2090
#define DT_IRIX_DLT_PREEMPT_IDX 0x70000047
2091
#define DT_IRIX_DLT_PREEMPT_NO 0x70000048
2092
#define DT_IRIX_DSYM_PLT_IDX 0x70000049
2093
#define DT_IRIX_DSYM_DLT_IDX 0x7000004A
2094
2095
/* ====================================================================
2096
*
2097
* .dynamic Section
2098
*
2099
* --- WARNING ---- WARNING ---- WARNING ---- WARNING ---- WARNING ----
2100
*
2101
* TBD: The .dynamic section has not yet been prepared for
2102
* use in both Irix/mips and Irix/ia64
2103
*
2104
* I believe that most of the tags will be the same in both
2105
* Irix/mips and Irix/ia64, but it still needs to be reviewed.
2106
*
2107
* For now, we'll document them only in mips/elf.h
2108
* ====================================================================
2109
*/
2110
2111
#ifndef __osf__
2112
2113
#define DT_MIPS_70000015 0x70000015
/* reserved */
2114
2115
/*
2116
* The following tags are for DELTA_C_PLUS_PLUS only
2117
* and are obsolete.
2118
*/
2119
#if (defined(_DELTA_C_PLUS_PLUS) && (_DELTA_C_PLUS_PLUS==1))
2120
2121
#define DT_MIPS_DELTA_CLASS 0x70000017
/* DCC class definitions */
2122
#define DT_MIPS_DELTA_CLASS_NO 0x70000018
/* No. DCC class definitions */
2123
#define DT_MIPS_DELTA_INSTANCE 0x70000019
/* DCC class instances */
2124
#define DT_MIPS_DELTA_INSTANCE_NO 0x7000001A
/* No. DCC class instances */
2125
#define DT_MIPS_DELTA_RELOC 0x7000001B
/* DCC relocations */
2126
#define DT_MIPS_DELTA_RELOC_NO 0x7000001C
/* No. DCC relocations */
2127
#define DT_MIPS_DELTA_SYM 0x7000001D
/* DCC symbols Refered to by
2128
* DCC relocations */
2129
#define DT_MIPS_DELTA_SYM_NO 0x7000001E
/* No. DCC symbols */
2130
#define DT_MIPS_DELTA_CLASSSYM 0x70000020
/* DCC class declarations */
2131
#define DT_MIPS_DELTA_CLASSSYM_NO 0x70000021
/* No. DCC class declarations */
2132
2133
#endif
/* _DELTA_C_PLUS_PLUS */
2134
2135
2136
#define DT_MIPS_CXX_FLAGS 0x70000022
/* Flags: C++ flavor */
2137
#define DT_MIPS_PIXIE_INIT 0x70000023
/* Init code for pixie */
2138
#define DT_MIPS_SYMBOL_LIB 0x70000024
2139
#define DT_MIPS_LOCALPAGE_GOTIDX 0x70000025
2140
#define DT_MIPS_LOCAL_GOTIDX 0x70000026
2141
#define DT_MIPS_HIDDEN_GOTIDX 0x70000027
2142
#define DT_MIPS_PROTECTED_GOTIDX 0x70000028
2143
#define DT_MIPS_OPTIONS 0x70000029
/* Address of .options */
2144
#define DT_MIPS_INTERFACE 0x7000002a
/* Address of .interface */
2145
#define DT_MIPS_DYNSTR_ALIGN 0x7000002b
2146
#define DT_MIPS_INTERFACE_SIZE 0x7000002c
/* size of the .interface */
2147
#define DT_MIPS_RLD_TEXT_RESOLVE_ADDR 0x7000002d
/* Addr of rld_text_resolve */
2148
#define DT_MIPS_PERF_SUFFIX 0x7000002e
/* suffix to be added to dso
2149
* name before dlopen() call */
2150
#define DT_MIPS_COMPACT_SIZE 0x7000002f
/* (O32)Size of .compact_rel */
2151
#define DT_MIPS_GP_VALUE 0x70000030
/* gp value for aux gots */
2152
#define DT_MIPS_AUX_DYNAMIC 0x70000031
/* Address of aux .dynamic */
2153
2154
#else
/* __osf__ */
2155
2156
#define DT_MIPS_PACKAGE 0x70000014
2157
#define DT_MIPS_PACKAGENO 0x70000015
2158
#define DT_MIPS_PACKSYM 0x70000016
2159
#define DT_MIPS_PACKSYMNO 0x70000017
2160
#define DT_MIPS_IMPACKNO 0x70000018
2161
#define DT_MIPS_EXPACKNO 0x70000019
2162
#define DT_MIPS_IMPSYMNO 0x7000001A
2163
#define DT_MIPS_EXPSYMNO 0x7000001B
2164
#ifndef DT_MIPS_HIPAGENO
/* eraxxon alpha hack */
2165
#define DT_MIPS_HIPAGENO 0x7000001C
2166
#endif
2167
2168
#endif
/* __osf__ */
2169
/*
2170
* Elf_Options.kind == ODK_IA64_REGINFO
2171
*
2172
* masks for Elf_Options.info
2173
*/
2174
typedef
struct
2175
{
2176
Elf64_Addr
ri_gp_value
;
/* initial value of gp */
2177
2178
/* TBD: define rest of Elf_IA64_RegInfo record */
2179
2180
}
2181
Elf_IA64_RegInfo
;
2182
#endif
2183
2184
/* Entries found in sections of type SHT_MIPS_CONFLICT. */
2185
2186
typedef
Elf32_Addr
Elf32_Conflict
;
2187
2188
typedef
Elf64_Addr
Elf64_Conflict
;
2189
2190
extern
Elf64_Conflict
_ConflictList64
[];
2191
2192
#define RLD_VERSION 1
2193
2194
2195
/* HPPA specific definitions. */
2196
2197
/* Legal values for sh_type field of Elf32_Shdr. */
2198
2199
#define SHT_PARISC_GOT 0x70000000
/* GOT for external data. */
2200
#define SHT_PARISC_ARCH 0x70000001
/* Architecture extensions. */
2201
#define SHT_PARISC_GLOBAL 0x70000002
/* Definition of $global$. */
2202
#define SHT_PARISC_MILLI 0x70000003
/* Millicode routines. */
2203
#define SHT_PARISC_UNWIND 0x70000004
/* Unwind information. */
2204
#define SHT_PARISC_PLT 0x70000005
/* Procedure linkage table. */
2205
#define SHT_PARISC_SDATA 0x70000006
/* Short initialized data. */
2206
#define SHT_PARISC_SBSS 0x70000007
/* Short uninitialized data. */
2207
#define SHT_PARISC_SYMEXTN 0x70000008
/* Argument/relocation info. */
2208
#define SHT_PARISC_STUBS 0x70000009
/* Linker stubs. */
2209
2210
/* Legal values for sh_flags field of Elf32_Shdr. */
2211
2212
#define SHF_PARISC_SHORT 0x20000000
/* Section with short addressing. */
2213
2214
/* Legal values for ST_TYPE subfield of st_info (symbol type). */
2215
2216
#define STT_PARISC_MILLICODE 13
/* Millicode function entry point. */
2217
2218
2219
/* Alpha specific declarations. */
2220
2221
/* Alpha relocs. */
2222
2223
#define R_ALPHA_NONE 0
/* No reloc */
2224
#define R_ALPHA_REFLONG 1
/* Direct 32 bit */
2225
#define R_ALPHA_REFQUAD 2
/* Direct 64 bit */
2226
#define R_ALPHA_GPREL32 3
/* GP relative 32 bit */
2227
#define R_ALPHA_LITERAL 4
/* GP relative 16 bit w/optimization */
2228
#define R_ALPHA_LITUSE 5
/* Optimization hint for LITERAL */
2229
#define R_ALPHA_GPDISP 6
/* Add displacement to GP */
2230
#define R_ALPHA_BRADDR 7
/* PC+4 relative 23 bit shifted */
2231
#define R_ALPHA_HINT 8
/* PC+4 relative 16 bit shifted */
2232
#define R_ALPHA_SREL16 9
/* PC relative 16 bit */
2233
#define R_ALPHA_SREL32 10
/* PC relative 32 bit */
2234
#define R_ALPHA_SREL64 11
/* PC relative 64 bit */
2235
#define R_ALPHA_OP_PUSH 12
/* OP stack push */
2236
#define R_ALPHA_OP_STORE 13
/* OP stack pop and store */
2237
#define R_ALPHA_OP_PSUB 14
/* OP stack subtract */
2238
#define R_ALPHA_OP_PRSHIFT 15
/* OP stack right shift */
2239
#define R_ALPHA_GPVALUE 16
2240
#define R_ALPHA_GPRELHIGH 17
2241
#define R_ALPHA_GPRELLOW 18
2242
#define R_ALPHA_IMMED_GP_16 19
2243
#define R_ALPHA_IMMED_GP_HI32 20
2244
#define R_ALPHA_IMMED_SCN_HI32 21
2245
#define R_ALPHA_IMMED_BR_HI32 22
2246
#define R_ALPHA_IMMED_LO32 23
2247
#define R_ALPHA_COPY 24
/* Copy symbol at runtime */
2248
#define R_ALPHA_GLOB_DAT 25
/* Create GOT entry */
2249
#define R_ALPHA_JMP_SLOT 26
/* Create PLT entry */
2250
#define R_ALPHA_RELATIVE 27
/* Adjust by program base */
2251
#define R_ALPHA_NUM 28
2252
2253
__END_DECLS
2254
2255
2256
#endif
/* MIPS */
2257
2258
/***************************************************************************/
2259
2260
#ifndef EM_IA_64
2261
# define EM_IA_64 50
/* from Linux <elf.h> */
2262
#endif
2263
2264
/* from be/com/ipa_lno_file.cxx (extra comment: Change SHT_MIPS_NUM to 42.) */
2265
#define SHT_MIPS_IPALNO (SHT_LOPROC + 42)
2266
2267
/* from be/com/ia64/sections.cxx */
2268
#define SHF_IA_64_SHORT SHF_MIPS_GPREL
2269
2270
/***************************************************************************/
2271
2272
#endif
/* elf.h */
Open64
osprey1.0
include
elf.h
Generated on Fri Mar 14 2014 04:23:05 for OpenADFortTk (including Open64 and OpenAnalysis references) by
1.8.4