3 //! These definitions are independent of read/write support, although we do implement
4 //! some traits useful for those.
6 //! This module is the equivalent of /usr/include/xcoff.h, and is based heavily on it.
8 #![allow(missing_docs)]
10 use crate::endian
::{BigEndian as BE, I16, U16, U32, U64}
;
13 /// The header at the start of every 32-bit XCOFF file.
14 #[derive(Debug, Clone, Copy)]
16 pub struct FileHeader32
{
17 /// Magic number. Must be 0x01DF.
19 /// Number of sections.
21 /// Time and date of file creation.
22 pub f_timdat
: U32
<BE
>,
23 /// Byte offset to symbol table start.
24 pub f_symptr
: U32
<BE
>,
25 /// Number of entries in symbol table.
27 /// Number of bytes in optional header
28 pub f_opthdr
: U16
<BE
>,
33 /// The header at the start of every 64-bit XCOFF file.
34 #[derive(Debug, Clone, Copy)]
36 pub struct FileHeader64
{
37 /// Magic number. Must be 0x01F7.
39 /// Number of sections.
41 /// Time and date of file creation
42 pub f_timdat
: U32
<BE
>,
43 /// Byte offset to symbol table start.
44 pub f_symptr
: U64
<BE
>,
45 /// Number of bytes in optional header
46 pub f_opthdr
: U16
<BE
>,
49 /// Number of entries in symbol table.
53 // Values for `f_magic`.
55 /// the 64-bit mach magic number
56 pub const MAGIC_64
: u16 = 0x01F7;
57 /// the 32-bit mach magic number
58 pub const MAGIC_32
: u16 = 0x01DF;
60 // Values for `f_flags`.
62 /// Indicates that the relocation information for binding has been removed from
64 pub const F_RELFLG
: u16 = 0x0001;
65 /// Indicates that the file is executable. No unresolved external references exist.
66 pub const F_EXEC
: u16 = 0x0002;
67 /// Indicates that line numbers have been stripped from the file by a utility program.
68 pub const F_LNNO
: u16 = 0x0004;
69 /// Indicates that the file was profiled with the fdpr command.
70 pub const F_FDPR_PROF
: u16 = 0x0010;
71 /// Indicates that the file was reordered with the fdpr command.
72 pub const F_FDPR_OPTI
: u16 = 0x0020;
73 /// Indicates that the file uses Very Large Program Support.
74 pub const F_DSA
: u16 = 0x0040;
75 /// Indicates that one of the members of the auxiliary header specifying the
76 /// medium page sizes is non-zero.
77 pub const F_VARPG
: u16 = 0x0100;
78 /// Indicates the file is dynamically loadable and executable. External references
79 /// are resolved by way of imports, and the file might contain exports and loader
81 pub const F_DYNLOAD
: u16 = 0x1000;
82 /// Indicates the file is a shared object (shared library). The file is separately
83 /// loadable. That is, it is not normally bound with other objects, and its loader
84 /// exports symbols are used as automatic import symbols for other object files.
85 pub const F_SHROBJ
: u16 = 0x2000;
86 /// If the object file is a member of an archive, it can be loaded by the system
87 /// loader, but the member is ignored by the binder. If the object file is not in
88 /// an archive, this flag has no effect.
89 pub const F_LOADONLY
: u16 = 0x4000;
91 /// The auxiliary header immediately following file header. If the value of the
92 /// f_opthdr field in the file header is 0, the auxiliary header does not exist.
93 #[derive(Debug, Clone, Copy)]
95 pub struct AuxHeader32
{
99 pub o_vstamp
: U16
<BE
>,
100 /// Text size in bytes.
101 pub o_tsize
: U32
<BE
>,
102 /// Initialized data size in bytes.
103 pub o_dsize
: U32
<BE
>,
104 /// Uninitialized data size in bytes.
105 pub o_bsize
: U32
<BE
>,
106 /// Entry point descriptor (virtual address).
107 pub o_entry
: U32
<BE
>,
108 /// Base address of text (virtual address).
109 pub o_text_start
: U32
<BE
>,
110 /// Base address of data (virtual address).
111 pub o_data_start
: U32
<BE
>,
112 /// Address of TOC anchor.
114 /// Section number for entry point.
115 pub o_snentry
: U16
<BE
>,
116 /// Section number for .text.
117 pub o_sntext
: U16
<BE
>,
118 /// Section number for .data.
119 pub o_sndata
: U16
<BE
>,
120 /// Section number for TOC.
121 pub o_sntoc
: U16
<BE
>,
122 /// Section number for loader data.
123 pub o_snloader
: U16
<BE
>,
124 /// Section number for .bss.
125 pub o_snbss
: U16
<BE
>,
126 /// Maximum alignment for .text.
127 pub o_algntext
: U16
<BE
>,
128 /// Maximum alignment for .data.
129 pub o_algndata
: U16
<BE
>,
130 /// Module type field.
131 pub o_modtype
: U16
<BE
>,
132 /// Bit flags - cpu types of objects.
134 /// Reserved for CPU type.
136 /// Maximum stack size allowed (bytes).
137 pub o_maxstack
: U32
<BE
>,
138 /// Maximum data size allowed (bytes).
139 pub o_maxdata
: U32
<BE
>,
140 /// Reserved for debuggers.
141 pub o_debugger
: U32
<BE
>,
142 /// Requested text page size.
144 /// Requested data page size.
146 /// Requested stack page size.
147 pub o_stackpsize
: u8,
148 /// Flags and thread-local storage alignment.
150 /// Section number for .tdata.
151 pub o_sntdata
: U16
<BE
>,
152 /// Section number for .tbss.
153 pub o_sntbss
: U16
<BE
>,
156 /// The auxiliary header immediately following file header. If the value of the
157 /// f_opthdr field in the file header is 0, the auxiliary header does not exist.
158 #[derive(Debug, Clone, Copy)]
160 pub struct AuxHeader64
{
162 pub o_mflag
: U16
<BE
>,
164 pub o_vstamp
: U16
<BE
>,
165 /// Reserved for debuggers.
166 pub o_debugger
: U32
<BE
>,
167 /// Base address of text (virtual address).
168 pub o_text_start
: U64
<BE
>,
169 /// Base address of data (virtual address).
170 pub o_data_start
: U64
<BE
>,
171 /// Address of TOC anchor.
173 /// Section number for entry point.
174 pub o_snentry
: U16
<BE
>,
175 /// Section number for .text.
176 pub o_sntext
: U16
<BE
>,
177 /// Section number for .data.
178 pub o_sndata
: U16
<BE
>,
179 /// Section number for TOC.
180 pub o_sntoc
: U16
<BE
>,
181 /// Section number for loader data.
182 pub o_snloader
: U16
<BE
>,
183 /// Section number for .bss.
184 pub o_snbss
: U16
<BE
>,
185 /// Maximum alignment for .text.
186 pub o_algntext
: U16
<BE
>,
187 /// Maximum alignment for .data.
188 pub o_algndata
: U16
<BE
>,
189 /// Module type field.
190 pub o_modtype
: U16
<BE
>,
191 /// Bit flags - cpu types of objects.
193 /// Reserved for CPU type.
195 /// Requested text page size.
197 /// Requested data page size.
199 /// Requested stack page size.
200 pub o_stackpsize
: u8,
201 /// Flags and thread-local storage alignment.
203 /// Text size in bytes.
204 pub o_tsize
: U64
<BE
>,
205 /// Initialized data size in bytes.
206 pub o_dsize
: U64
<BE
>,
207 /// Uninitialized data size in bytes.
208 pub o_bsize
: U64
<BE
>,
209 /// Entry point descriptor (virtual address).
210 pub o_entry
: U64
<BE
>,
211 /// Maximum stack size allowed (bytes).
212 pub o_maxstack
: U64
<BE
>,
213 /// Maximum data size allowed (bytes).
214 pub o_maxdata
: U64
<BE
>,
215 /// Section number for .tdata.
216 pub o_sntdata
: U16
<BE
>,
217 /// Section number for .tbss.
218 pub o_sntbss
: U16
<BE
>,
220 pub o_x64flags
: U16
<BE
>,
222 pub o_resv3a
: U16
<BE
>,
224 pub o_resv3
: [U32
<BE
>; 2],
227 /// Some AIX programs generate auxiliary headers for 32-bit object files that
228 /// end after the data_start field.
229 pub const AOUTHSZ_SHORT
: u16 = 28;
232 #[derive(Debug, Clone, Copy)]
234 pub struct SectionHeader32
{
237 /// Physical address.
238 pub s_paddr
: U32
<BE
>,
239 /// Virtual address (same as physical address).
240 pub s_vaddr
: U32
<BE
>,
243 /// Offset in file to raw data for section.
244 pub s_scnptr
: U32
<BE
>,
245 /// Offset in file to relocation entries for section.
246 pub s_relptr
: U32
<BE
>,
247 /// Offset in file to line number entries for section.
248 pub s_lnnoptr
: U32
<BE
>,
249 /// Number of relocation entries.
250 pub s_nreloc
: U16
<BE
>,
251 /// Number of line number entries.
252 pub s_nlnno
: U16
<BE
>,
253 /// Flags to define the section type.
254 pub s_flags
: U32
<BE
>,
258 #[derive(Debug, Clone, Copy)]
260 pub struct SectionHeader64
{
263 /// Physical address.
264 pub s_paddr
: U64
<BE
>,
265 /// Virtual address (same as physical address).
266 pub s_vaddr
: U64
<BE
>,
269 /// Offset in file to raw data for section.
270 pub s_scnptr
: U64
<BE
>,
271 /// Offset in file to relocation entries for section.
272 pub s_relptr
: U64
<BE
>,
273 /// Offset in file to line number entries for section.
274 pub s_lnnoptr
: U64
<BE
>,
275 /// Number of relocation entries.
276 pub s_nreloc
: U32
<BE
>,
277 /// Number of line number entries.
278 pub s_nlnno
: U32
<BE
>,
279 /// Flags to define the section type.
280 pub s_flags
: U32
<BE
>,
282 pub s_reserve
: U32
<BE
>,
285 // Values for `s_flags`.
287 /// "regular" section
288 pub const STYP_REG
: u16 = 0x00;
289 /// Specifies a pad section. A section of this type is used to provide alignment
290 /// padding between sections within an XCOFF executable object file. This section
291 /// header type is obsolete since padding is allowed in an XCOFF file without a
292 /// corresponding pad section header.
293 pub const STYP_PAD
: u16 = 0x08;
294 /// Specifies a DWARF debugging section, which provide source file and symbol
295 /// information for the symbolic debugger.
296 pub const STYP_DWARF
: u16 = 0x10;
297 /// Specifies an executable text (code) section. A section of this type contains
298 /// the executable instructions of a program.
299 pub const STYP_TEXT
: u16 = 0x20;
300 /// Specifies an initialized data section. A section of this type contains the
301 /// initialized data and the TOC of a program.
302 pub const STYP_DATA
: u16 = 0x40;
303 /// Specifies an uninitialized data section. A section header of this type
304 /// defines the uninitialized data of a program.
305 pub const STYP_BSS
: u16 = 0x80;
306 /// Specifies an exception section. A section of this type provides information
307 /// to identify the reason that a trap or exception occurred within an executable
309 pub const STYP_EXCEPT
: u16 = 0x0100;
310 /// Specifies a comment section. A section of this type provides comments or data
311 /// to special processing utility programs.
312 pub const STYP_INFO
: u16 = 0x0200;
313 /// Specifies an initialized thread-local data section.
314 pub const STYP_TDATA
: u16 = 0x0400;
315 /// Specifies an uninitialized thread-local data section.
316 pub const STYP_TBSS
: u16 = 0x0800;
317 /// Specifies a loader section. A section of this type contains object file
318 /// information for the system loader to load an XCOFF executable. The information
319 /// includes imported symbols, exported symbols, relocation data, type-check
320 /// information, and shared object names.
321 pub const STYP_LOADER
: u16 = 0x1000;
322 /// Specifies a debug section. A section of this type contains stabstring
323 /// information used by the symbolic debugger.
324 pub const STYP_DEBUG
: u16 = 0x2000;
325 /// Specifies a type-check section. A section of this type contains
326 /// parameter/argument type-check strings used by the binder.
327 pub const STYP_TYPCHK
: u16 = 0x4000;
328 /// Specifies a relocation or line-number field overflow section. A section
329 /// header of this type contains the count of relocation entries and line
330 /// number entries for some other section. This section header is required
331 /// when either of the counts exceeds 65,534.
332 pub const STYP_OVRFLO
: u16 = 0x8000;
334 pub const SIZEOF_SYMBOL
: usize = 18;
336 #[derive(Debug, Clone, Copy)]
338 pub struct SymbolBytes(pub [u8; SIZEOF_SYMBOL
]);
340 /// Symbol table entry.
341 #[derive(Debug, Clone, Copy)]
343 pub struct Symbol32
{
346 /// If first 4 bytes are 0, then second 4 bytes are offset into string table.
348 /// Symbol value; storage class-dependent.
349 pub n_value
: U32
<BE
>,
350 /// Section number of symbol.
351 pub n_scnum
: I16
<BE
>,
352 /// Basic and derived type specification.
354 /// Storage class of symbol.
356 /// Number of auxiliary entries.
360 /// Symbol table entry.
361 #[derive(Debug, Clone, Copy)]
363 pub struct Symbol64
{
364 /// Symbol value; storage class-dependent.
365 pub n_value
: U64
<BE
>,
366 /// Offset of the name in string table or .debug section.
367 pub n_offset
: U32
<BE
>,
368 /// Section number of symbol.
369 pub n_scnum
: I16
<BE
>,
370 /// Basic and derived type specification.
372 /// Storage class of symbol.
374 /// Number of auxiliary entries.
378 // Values for `n_scnum`.
380 /// A special symbolic debugging symbol.
381 pub const N_DEBUG
: i16 = -2;
382 /// An absolute symbol. The symbol has a value but is not relocatable.
383 pub const N_ABS
: i16 = -1;
384 /// An undefined external symbol.
385 pub const N_UNDEF
: i16 = 0;
387 // Vlaues for `n_type`.
389 /// Values for visibility as they would appear when encoded in the high 4 bits
390 /// of the 16-bit unsigned n_type field of symbol table entries. Valid for
391 /// 32-bit XCOFF only when the o_vstamp in the auxiliary header is greater than 1.
392 pub const SYM_V_MASK
: u16 = 0xF000;
393 pub const SYM_V_INTERNAL
: u16 = 0x1000;
394 pub const SYM_V_HIDDEN
: u16 = 0x2000;
395 pub const SYM_V_PROTECTED
: u16 = 0x3000;
396 pub const SYM_V_EXPORTED
: u16 = 0x4000;
398 // Values for `n_sclass`.
400 // Storage classes used for symbolic debugging symbols.
402 /// Source file name and compiler information.
403 pub const C_FILE
: u8 = 103;
404 /// Beginning of include file.
405 pub const C_BINCL
: u8 = 108;
406 /// Ending of include file.
407 pub const C_EINCL
: u8 = 109;
409 pub const C_GSYM
: u8 = 128;
410 /// Statically allocated symbol.
411 pub const C_STSYM
: u8 = 133;
412 /// Beginning of common block.
413 pub const C_BCOMM
: u8 = 135;
414 /// End of common block.
415 pub const C_ECOMM
: u8 = 137;
417 pub const C_ENTRY
: u8 = 141;
418 /// Beginning of static block.
419 pub const C_BSTAT
: u8 = 143;
420 /// End of static block.
421 pub const C_ESTAT
: u8 = 144;
422 /// Global thread-local variable.
423 pub const C_GTLS
: u8 = 145;
424 /// Static thread-local variable.
425 pub const C_STTLS
: u8 = 146;
426 /// DWARF section symbol.
427 pub const C_DWARF
: u8 = 112;
429 // Storage classes used for absolute symbols.
431 /// Automatic variable allocated on stack.
432 pub const C_LSYM
: u8 = 129;
433 /// Argument to subroutine allocated on stack.
434 pub const C_PSYM
: u8 = 130;
435 /// Register variable.
436 pub const C_RSYM
: u8 = 131;
437 /// Argument to function or procedure stored in register.
438 pub const C_RPSYM
: u8 = 132;
439 /// Local member of common block.
440 pub const C_ECOML
: u8 = 136;
441 /// Function or procedure.
442 pub const C_FUN
: u8 = 142;
444 // Storage classes used for undefined external symbols or symbols of general sections.
447 pub const C_EXT
: u8 = 2;
448 /// Weak external symbol.
449 pub const C_WEAKEXT
: u8 = 111;
451 // Storage classes used for symbols of general sections.
453 /// Symbol table entry marked for deletion.
454 pub const C_NULL
: u8 = 0;
456 pub const C_STAT
: u8 = 3;
457 /// Beginning or end of inner block.
458 pub const C_BLOCK
: u8 = 100;
459 /// Beginning or end of function.
460 pub const C_FCN
: u8 = 101;
461 /// Un-named external symbol.
462 pub const C_HIDEXT
: u8 = 107;
463 /// Comment string in .info section.
464 pub const C_INFO
: u8 = 110;
465 /// Declaration of object (type).
466 pub const C_DECL
: u8 = 140;
468 // Storage classes - Obsolete/Undocumented.
470 /// Automatic variable.
471 pub const C_AUTO
: u8 = 1;
472 /// Register variable.
473 pub const C_REG
: u8 = 4;
474 /// External definition.
475 pub const C_EXTDEF
: u8 = 5;
477 pub const C_LABEL
: u8 = 6;
479 pub const C_ULABEL
: u8 = 7;
480 /// Member of structure.
481 pub const C_MOS
: u8 = 8;
482 /// Function argument.
483 pub const C_ARG
: u8 = 9;
485 pub const C_STRTAG
: u8 = 10;
487 pub const C_MOU
: u8 = 11;
489 pub const C_UNTAG
: u8 = 12;
491 pub const C_TPDEF
: u8 = 13;
492 /// Undefined static.
493 pub const C_USTATIC
: u8 = 14;
495 pub const C_ENTAG
: u8 = 15;
496 /// Member of enumeration.
497 pub const C_MOE
: u8 = 16;
498 /// Register parameter.
499 pub const C_REGPARM
: u8 = 17;
501 pub const C_FIELD
: u8 = 18;
502 /// End of structure.
503 pub const C_EOS
: u8 = 102;
505 pub const C_ALIAS
: u8 = 105;
506 /// Special storage class for external.
507 pub const C_HIDDEN
: u8 = 106;
508 /// Physical end of function.
509 pub const C_EFCN
: u8 = 255;
511 pub const C_TCSYM
: u8 = 134;
513 /// File Auxiliary Entry for C_FILE Symbols.
514 #[derive(Debug, Clone, Copy)]
516 pub struct FileAux32
{
517 /// The source file name or compiler-related string.
519 /// If first 4 bytes are 0, then second 4 bytes are offset into string table.
520 pub x_fname
: [u8; 8],
521 /// Pad size for file name.
523 /// The source-file string type.
526 pub x_freserve
: [u8; 3],
529 /// File Auxiliary Entry for C_FILE Symbols.
530 #[derive(Debug, Clone, Copy)]
532 pub struct FileAux64
{
533 /// The source file name or compiler-related string.
535 /// If first 4 bytes are 0, then second 4 bytes are offset into string table.
536 pub x_fname
: [u8; 8],
537 /// Pad size for file name.
539 /// The source-file string type.
542 pub x_freserve
: [u8; 2],
543 /// Specifies the type of auxiliary entry. Contains _AUX_FILE for this auxiliary entry.
547 // Values for `x_ftype`.
549 /// Specifies the source-file name.
550 pub const XFT_FN
: u8 = 0;
551 /// Specifies the compiler time stamp.
552 pub const XFT_CT
: u8 = 1;
553 /// Specifies the compiler version number.
554 pub const XFT_CV
: u8 = 2;
555 /// Specifies compiler-defined information.
556 pub const XFT_CD
: u8 = 128;
558 /// Csect auxiliary entry for C_EXT, C_WEAKEXT, and C_HIDEXT symbols.
559 #[derive(Debug, Clone, Copy)]
561 pub struct CsectAux32
{
563 pub x_scnlen
: U32
<BE
>,
564 /// Offset of parameter type-check hash in .typchk section.
565 pub x_parmhash
: U32
<BE
>,
566 /// .typchk section number.
567 pub x_snhash
: U16
<BE
>,
568 /// Symbol alignment and type.
570 /// Storage mapping class.
575 pub x_snstab
: U16
<BE
>,
578 /// Csect auxiliary entry for C_EXT, C_WEAKEXT, and C_HIDEXT symbols.
579 #[derive(Debug, Clone, Copy)]
581 pub struct CsectAux64
{
582 /// Low 4 bytes of section length.
583 pub x_scnlen_lo
: U32
<BE
>,
584 /// Offset of parameter type-check hash in .typchk section.
585 pub x_parmhash
: U32
<BE
>,
586 /// .typchk section number.
587 pub x_snhash
: U16
<BE
>,
588 /// Symbol alignment and type.
590 /// Storage mapping class.
592 /// High 4 bytes of section length.
593 pub x_scnlen_hi
: U32
<BE
>,
596 /// Contains _AUX_CSECT; indicates type of auxiliary entry.
600 // Values for `x_smtyp`.
602 /// External reference.
603 pub const XTY_ER
: u8 = 0;
604 /// Csect definition for initialized storage.
605 pub const XTY_SD
: u8 = 1;
606 /// Defines an entry point to an initialized csect.
607 pub const XTY_LD
: u8 = 2;
608 /// Common csect definition. For uninitialized storage.
609 pub const XTY_CM
: u8 = 3;
611 // Values for `x_smclas`.
616 pub const XMC_PR
: u8 = 0;
617 /// Read Only Constant
618 pub const XMC_RO
: u8 = 1;
619 /// Debug Dictionary Table
620 pub const XMC_DB
: u8 = 2;
621 /// Global Linkage (Interfile Interface Code)
622 pub const XMC_GL
: u8 = 6;
623 /// Extended Operation (Pseudo Machine Instruction)
624 pub const XMC_XO
: u8 = 7;
625 /// Supervisor Call (32-bit process only)
626 pub const XMC_SV
: u8 = 8;
627 /// Supervisor Call for 64-bit process
628 pub const XMC_SV64
: u8 = 17;
629 /// Supervisor Call for both 32- and 64-bit processes
630 pub const XMC_SV3264
: u8 = 18;
631 /// Traceback Index csect
632 pub const XMC_TI
: u8 = 12;
633 /// Traceback Table csect
634 pub const XMC_TB
: u8 = 13;
636 // READ WRITE CLASSES
639 pub const XMC_RW
: u8 = 5;
640 /// TOC Anchor for TOC Addressability
641 pub const XMC_TC0
: u8 = 15;
643 pub const XMC_TC
: u8 = 3;
644 /// Scalar data item in the TOC
645 pub const XMC_TD
: u8 = 16;
647 pub const XMC_DS
: u8 = 10;
648 /// Unclassified - Treated as Read Write
649 pub const XMC_UA
: u8 = 4;
650 /// BSS class (uninitialized static internal)
651 pub const XMC_BS
: u8 = 9;
652 /// Un-named Fortran Common
653 pub const XMC_UC
: u8 = 11;
654 /// Initialized thread-local variable
655 pub const XMC_TL
: u8 = 20;
656 /// Uninitialized thread-local variable
657 pub const XMC_UL
: u8 = 21;
658 /// Symbol mapped at the end of TOC
659 pub const XMC_TE
: u8 = 22;
661 /// Function auxiliary entry.
662 #[derive(Debug, Clone, Copy)]
664 pub struct FunAux32
{
665 /// File offset to exception table entry.
666 pub x_exptr
: U32
<BE
>,
667 /// Size of function in bytes.
668 pub x_fsize
: U32
<BE
>,
669 /// File pointer to line number
670 pub x_lnnoptr
: U32
<BE
>,
671 /// Symbol table index of next entry beyond this function.
672 pub x_endndx
: U32
<BE
>,
677 /// Function auxiliary entry.
678 #[derive(Debug, Clone, Copy)]
680 pub struct FunAux64
{
681 /// File pointer to line number
682 pub x_lnnoptr
: U64
<BE
>,
683 /// Size of function in bytes.
684 pub x_fsize
: U32
<BE
>,
685 /// Symbol table index of next entry beyond this function.
686 pub x_endndx
: U32
<BE
>,
689 /// Contains _AUX_FCN; Type of auxiliary entry.
693 /// Exception auxiliary entry. (XCOFF64 only)
694 #[derive(Debug, Clone, Copy)]
697 /// File offset to exception table entry.
698 pub x_exptr
: U64
<BE
>,
699 /// Size of function in bytes.
700 pub x_fsize
: U32
<BE
>,
701 /// Symbol table index of next entry beyond this function.
702 pub x_endndx
: U32
<BE
>,
705 /// Contains _AUX_EXCEPT; Type of auxiliary entry
709 /// Block auxiliary entry for the C_BLOCK and C_FCN Symbols.
710 #[derive(Debug, Clone, Copy)]
712 pub struct BlockAux32
{
715 /// High-order 2 bytes of the source line number.
716 pub x_lnnohi
: U16
<BE
>,
717 /// Low-order 2 bytes of the source line number.
718 pub x_lnnolo
: U16
<BE
>,
723 /// Block auxiliary entry for the C_BLOCK and C_FCN Symbols.
724 #[derive(Debug, Clone, Copy)]
726 pub struct BlockAux64
{
727 /// Source line number.
731 /// Contains _AUX_SYM; Type of auxiliary entry.
735 /// Section auxiliary entry for the C_STAT Symbol. (XCOFF32 Only)
736 #[derive(Debug, Clone, Copy)]
740 pub x_scnlen
: U32
<BE
>,
741 /// Number of relocation entries.
742 pub x_nreloc
: U16
<BE
>,
743 /// Number of line numbers.
744 pub x_nlinno
: U16
<BE
>,
749 /// Section auxiliary entry Format for C_DWARF symbols.
750 #[derive(Debug, Clone, Copy)]
752 pub struct DwarfAux32
{
753 /// Length of portion of section represented by symbol.
754 pub x_scnlen
: U32
<BE
>,
757 /// Number of relocation entries in section.
758 pub x_nreloc
: U32
<BE
>,
763 /// Section auxiliary entry Format for C_DWARF symbols.
764 #[derive(Debug, Clone, Copy)]
766 pub struct DwarfAux64
{
767 /// Length of portion of section represented by symbol.
768 pub x_scnlen
: U64
<BE
>,
769 /// Number of relocation entries in section.
770 pub x_nreloc
: U64
<BE
>,
773 /// Contains _AUX_SECT; Type of Auxillary entry.
777 // Values for `x_auxtype`
779 /// Identifies an exception auxiliary entry.
780 pub const AUX_EXCEPT
: u8 = 255;
781 /// Identifies a function auxiliary entry.
782 pub const AUX_FCN
: u8 = 254;
783 /// Identifies a symbol auxiliary entry.
784 pub const AUX_SYM
: u8 = 253;
785 /// Identifies a file auxiliary entry.
786 pub const AUX_FILE
: u8 = 252;
787 /// Identifies a csect auxiliary entry.
788 pub const AUX_CSECT
: u8 = 251;
789 /// Identifies a SECT auxiliary entry.
790 pub const AUX_SECT
: u8 = 250;
792 /// Relocation table entry
793 #[derive(Debug, Clone, Copy)]
796 /// Virtual address (position) in section to be relocated.
797 pub r_vaddr
: U32
<BE
>,
798 /// Symbol table index of item that is referenced.
799 pub r_symndx
: U32
<BE
>,
800 /// Relocation size and information.
806 /// Relocation table entry
807 #[derive(Debug, Clone, Copy)]
810 /// Virtual address (position) in section to be relocated.
811 pub r_vaddr
: U64
<BE
>,
812 /// Symbol table index of item that is referenced.
813 pub r_symndx
: U32
<BE
>,
814 /// Relocation size and information.
820 // Values for `r_rtype`.
822 /// Positive relocation.
823 pub const R_POS
: u8 = 0x00;
824 /// Positive indirect load relocation.
825 pub const R_RL
: u8 = 0x0c;
826 /// Positive load address relocation. Modifiable instruction.
827 pub const R_RLA
: u8 = 0x0d;
828 /// Negative relocation.
829 pub const R_NEG
: u8 = 0x01;
830 /// Relative to self relocation.
831 pub const R_REL
: u8 = 0x02;
832 /// Relative to the TOC relocation.
833 pub const R_TOC
: u8 = 0x03;
834 /// TOC relative indirect load relocation.
835 pub const R_TRL
: u8 = 0x12;
836 /// Relative to the TOC or to the thread-local storage base relocation.
837 pub const R_TRLA
: u8 = 0x13;
838 /// Global linkage-external TOC address relocation.
839 pub const R_GL
: u8 = 0x05;
840 /// Local object TOC address relocation.
841 pub const R_TCL
: u8 = 0x06;
842 /// A non-relocating relocation.
843 pub const R_REF
: u8 = 0x0f;
844 /// Branch absolute relocation. References a non-modifiable instruction.
845 pub const R_BA
: u8 = 0x08;
846 /// Branch relative to self relocation. References a non-modifiable instruction.
847 pub const R_BR
: u8 = 0x0a;
848 /// Branch absolute relocation. References a modifiable instruction.
849 pub const R_RBA
: u8 = 0x18;
850 /// Branch relative to self relocation. References a modifiable instruction.
851 pub const R_RBR
: u8 = 0x1a;
852 /// General-dynamic reference to TLS symbol.
853 pub const R_TLS
: u8 = 0x20;
854 /// Initial-exec reference to TLS symbol.
855 pub const R_TLS_IE
: u8 = 0x21;
856 /// Local-dynamic reference to TLS symbol.
857 pub const R_TLS_LD
: u8 = 0x22;
858 /// Local-exec reference to TLS symbol.
859 pub const R_TLS_LE
: u8 = 0x23;
860 /// Module reference to TLS.
861 pub const R_TLSM
: u8 = 0x24;
862 /// Module reference to the local TLS storage.
863 pub const R_TLSML
: u8 = 0x25;
864 /// Relative to TOC upper.
865 pub const R_TOCU
: u8 = 0x30;
866 /// Relative to TOC lower.
867 pub const R_TOCL
: u8 = 0x31;