Clean up formatting of xcoff.h

This commit is contained in:
Tom Rix 2001-12-17 13:13:33 +00:00
parent a318eb217d
commit 7b96e69ac5
2 changed files with 115 additions and 127 deletions

View File

@ -1,3 +1,7 @@
2001-12-16 Tom Rix <trix@redhat.com>
* xcoff.h : Clean up formatting.
2001-11-11 Timothy Wall <twall@alum.mit.edu> 2001-11-11 Timothy Wall <twall@alum.mit.edu>
* ti.h: Move arch-specific stuff from here... * ti.h: Move arch-specific stuff from here...

View File

@ -23,13 +23,9 @@
#ifndef _INTERNAL_XCOFF_H #ifndef _INTERNAL_XCOFF_H
#define _INTERNAL_XCOFF_H #define _INTERNAL_XCOFF_H
/* /* Linker */
* LINKER
*/
/* /* Names of "special" sections. */
* names of "special" sections
*/
#define _TEXT ".text" #define _TEXT ".text"
#define _DATA ".data" #define _DATA ".data"
#define _BSS ".bss" #define _BSS ".bss"
@ -50,7 +46,6 @@
#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */ #define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */ #define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
/* XCOFF relocation types. /* XCOFF relocation types.
The relocations are described in the function The relocations are described in the function
xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c */ xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c */
@ -78,22 +73,15 @@
#define R_RBR (0x1a) #define R_RBR (0x1a)
#define R_RBRC (0x1b) #define R_RBRC (0x1b)
/* Storage class #defines, from /usr/include/storclass.h that are not already
defined in internal.h */
/* /* Comment string in .info section */
* Storage class #defines, from /usr/include/storclass.h #define C_INFO 110
* That are not already defined in internal.h
*/
#define C_INFO 110 /* Comment string in .info section */
/* Auxillary Symbol Entries */
/*
* AUXILLARY SYMBOL ENTRIES
*
* auxemt
*/
/* x_smtyp values: */ /* x_smtyp values: */
#define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */ #define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */
#define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */ #define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */
/* Symbol type values: */ /* Symbol type values: */
@ -105,7 +93,6 @@
#define XTY_US 5 /* "Reserved for internal use" */ #define XTY_US 5 /* "Reserved for internal use" */
/* x_smclas values: */ /* x_smclas values: */
#define XMC_PR 0 /* Read-only program code */ #define XMC_PR 0 /* Read-only program code */
#define XMC_RO 1 /* Read-only constant */ #define XMC_RO 1 /* Read-only constant */
#define XMC_DB 2 /* Read-only debug dictionary table */ #define XMC_DB 2 /* Read-only debug dictionary table */
@ -131,30 +118,37 @@
struct internal_ldhdr struct internal_ldhdr
{ {
/* /* The version number:
* The version number: 1 : 32 bit
* 1 : 32 bit 2 : 64 bit */
* 2 : 64 bit
*/
unsigned long l_version; unsigned long l_version;
/* The number of symbol table entries. */ /* The number of symbol table entries. */
bfd_size_type l_nsyms; bfd_size_type l_nsyms;
/* The number of relocation table entries. */ /* The number of relocation table entries. */
bfd_size_type l_nreloc; bfd_size_type l_nreloc;
/* The length of the import file string table. */ /* The length of the import file string table. */
bfd_size_type l_istlen; bfd_size_type l_istlen;
/* The number of import files. */ /* The number of import files. */
bfd_size_type l_nimpid; bfd_size_type l_nimpid;
/* The offset from the start of the .loader section to the first /* The offset from the start of the .loader section to the first
entry in the import file table. */ entry in the import file table. */
bfd_size_type l_impoff; bfd_size_type l_impoff;
/* The length of the string table. */ /* The length of the string table. */
bfd_size_type l_stlen; bfd_size_type l_stlen;
/* The offset from the start of the .loader section to the first /* The offset from the start of the .loader section to the first
entry in the string table. */ entry in the string table. */
bfd_size_type l_stoff; bfd_size_type l_stoff;
/* The offset to start of the symbol table, only in XCOFF64 */ /* The offset to start of the symbol table, only in XCOFF64 */
bfd_vma l_symoff; bfd_vma l_symoff;
/* The offset to the start of the relocation table, only in XCOFF64 */ /* The offset to the start of the relocation table, only in XCOFF64 */
bfd_vma l_rldoff; bfd_vma l_rldoff;
}; };
@ -165,28 +159,37 @@ struct internal_ldhdr
struct internal_ldsym struct internal_ldsym
{ {
union union
{
/* The symbol name if <= SYMNMLEN characters. */
char _l_name[SYMNMLEN];
struct
{ {
/* The symbol name if <= SYMNMLEN characters. */ /* Zero if the symbol name is more than SYMNMLEN characters. */
char _l_name[SYMNMLEN]; long _l_zeroes;
struct
{ /* The offset in the string table if the symbol name is more
/* Zero if the symbol name is more than SYMNMLEN characters. */ than SYMNMLEN characters. */
long _l_zeroes; long _l_offset;
/* The offset in the string table if the symbol name is more }
than SYMNMLEN characters. */ _l_l;
long _l_offset; }
} _l_l; _l;
} _l;
/* The symbol value. */ /* The symbol value. */
bfd_vma l_value; bfd_vma l_value;
/* The symbol section number. */ /* The symbol section number. */
short l_scnum; short l_scnum;
/* The symbol type and flags. */ /* The symbol type and flags. */
char l_smtype; char l_smtype;
/* The symbol storage class. */ /* The symbol storage class. */
char l_smclas; char l_smclas;
/* The import file ID. */ /* The import file ID. */
bfd_size_type l_ifile; bfd_size_type l_ifile;
/* Offset to the parameter type check string. */ /* Offset to the parameter type check string. */
bfd_size_type l_parm; bfd_size_type l_parm;
}; };
@ -208,10 +211,13 @@ struct internal_ldrel
{ {
/* The reloc address. */ /* The reloc address. */
bfd_vma l_vaddr; bfd_vma l_vaddr;
/* The symbol table index in the .loader section symbol table. */ /* The symbol table index in the .loader section symbol table. */
bfd_size_type l_symndx; bfd_size_type l_symndx;
/* The relocation type and size. */ /* The relocation type and size. */
short l_rtype; short l_rtype;
/* The section number this relocation applies to. */ /* The section number this relocation applies to. */
short l_rsecnm; short l_rsecnm;
}; };
@ -230,14 +236,16 @@ struct xcoff_link_hash_entry
asection *toc_section; asection *toc_section;
union union
{ {
/* If we have created a TOC entry (the XCOFF_SET_TOC flag is /* If we have created a TOC entry (the XCOFF_SET_TOC flag is
set), this is the offset in toc_section. */ set), this is the offset in toc_section. */
bfd_vma toc_offset; bfd_vma toc_offset;
/* If the TOC entry comes from an input file, this is set to the
symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */ /* If the TOC entry comes from an input file, this is set to the
long toc_indx; symbol index of the C_HIDEXT XMC_TC or XMC_TD symbol. */
} u; long toc_indx;
}
u;
/* If this symbol is a function entry point which is called, this /* If this symbol is a function entry point which is called, this
field holds a pointer to the function descriptor. If this symbol field holds a pointer to the function descriptor. If this symbol
@ -260,77 +268,41 @@ struct xcoff_link_hash_entry
unsigned char smclas; unsigned char smclas;
}; };
/* /* Flags for xcoff_link_hash_entry. */
* #define for xcoff_link_hash_entry.flags
*
* XCOFF_REF_REGULAR
* Symbol is referenced by a regular object.
*
* XCOFF_DEF_REGULAR
* Symbol is defined by a regular object.
*
* XCOFF_DEF_DYNAMIC
* Symbol is defined by a dynamic object.
*
* XCOFF_LDREL
* Symbol is used in a reloc being copied into the .loader section.
*
* XCOFF_ENTRY
* Symbol is the entry point.
*
* XCOFF_CALLED
* Symbol is called; this is, it appears in a R_BR reloc.
*
* XCOFF_SET_TOC
* Symbol needs the TOC entry filled in.
*
* XCOFF_IMPORT
* Symbol is explicitly imported.
*
* XCOFF_EXPORT
* Symbol is explicitly exported.
*
* XCOFF_BUILT_LDSYM
* Symbol has been processed by xcoff_build_ldsyms.
*
* XCOFF_MARK
* Symbol is mentioned by a section which was not garbage collected.
*
* XCOFF_HAS_SIZE
* Symbol size is recorded in size_list list from hash table.
*
* XCOFF_DESCRIPTOR
* Symbol is a function descriptor.
*
* XCOFF_MULTIPLY_DEFINED
* Multiple definitions have been for the symbol.
*
* XCOFF_RTINIT
* Symbol is the __rtinit symbol
*
* XCOFF_SYSCALL32
* Symbol is an imported 32 bit syscall
*
* XCOFF_SYSCALL64
* Symbol is an imported 64 bit syscall
*/
/* Symbol is referenced by a regular object. */
#define XCOFF_REF_REGULAR 0x00000001 #define XCOFF_REF_REGULAR 0x00000001
/* Symbol is defined by a regular object. */
#define XCOFF_DEF_REGULAR 0x00000002 #define XCOFF_DEF_REGULAR 0x00000002
/* Symbol is defined by a dynamic object. */
#define XCOFF_DEF_DYNAMIC 0x00000004 #define XCOFF_DEF_DYNAMIC 0x00000004
/* Symbol is used in a reloc being copied into the .loader section. */
#define XCOFF_LDREL 0x00000008 #define XCOFF_LDREL 0x00000008
/* Symbol is the entry point. */
#define XCOFF_ENTRY 0x00000010 #define XCOFF_ENTRY 0x00000010
/* Symbol is called; this is, it appears in a R_BR reloc. */
#define XCOFF_CALLED 0x00000020 #define XCOFF_CALLED 0x00000020
/* Symbol needs the TOC entry filled in. */
#define XCOFF_SET_TOC 0x00000040 #define XCOFF_SET_TOC 0x00000040
/* Symbol is explicitly imported. */
#define XCOFF_IMPORT 0x00000080 #define XCOFF_IMPORT 0x00000080
/* Symbol is explicitly exported. */
#define XCOFF_EXPORT 0x00000100 #define XCOFF_EXPORT 0x00000100
/* Symbol has been processed by xcoff_build_ldsyms. */
#define XCOFF_BUILT_LDSYM 0x00000200 #define XCOFF_BUILT_LDSYM 0x00000200
/* Symbol is mentioned by a section which was not garbage collected. */
#define XCOFF_MARK 0x00000400 #define XCOFF_MARK 0x00000400
/* Symbol size is recorded in size_list list from hash table. */
#define XCOFF_HAS_SIZE 0x00000800 #define XCOFF_HAS_SIZE 0x00000800
/* Symbol is a function descriptor. */
#define XCOFF_DESCRIPTOR 0x00001000 #define XCOFF_DESCRIPTOR 0x00001000
/* Multiple definitions have been for the symbol. */
#define XCOFF_MULTIPLY_DEFINED 0x00002000 #define XCOFF_MULTIPLY_DEFINED 0x00002000
/* Symbol is the __rtinit symbol. */
#define XCOFF_RTINIT 0x00004000 #define XCOFF_RTINIT 0x00004000
/* Symbol is an imported 32 bit syscall. */
#define XCOFF_SYSCALL32 0x00008000 #define XCOFF_SYSCALL32 0x00008000
/* Symbol is an imported 64 bit syscall. */
#define XCOFF_SYSCALL64 0x00010000 #define XCOFF_SYSCALL64 0x00010000
/* The XCOFF linker hash table. */ /* The XCOFF linker hash table. */
@ -390,11 +362,12 @@ struct xcoff_link_hash_table
/* A linked list of symbols for which we have size information. */ /* A linked list of symbols for which we have size information. */
struct xcoff_link_size_list struct xcoff_link_size_list
{ {
struct xcoff_link_size_list *next; struct xcoff_link_size_list *next;
struct xcoff_link_hash_entry *h; struct xcoff_link_hash_entry *h;
bfd_size_type size; bfd_size_type size;
} *size_list; }
*size_list;
/* Magic sections: _text, _etext, _data, _edata, _end, end. */ /* Magic sections: _text, _etext, _data, _edata, _end, end. */
asection *special_sections[XCOFF_NUMBER_OF_SPECIAL_SECTIONS]; asection *special_sections[XCOFF_NUMBER_OF_SPECIAL_SECTIONS];
@ -408,18 +381,25 @@ struct xcoff_loader_info
{ {
/* Set if a problem occurred. */ /* Set if a problem occurred. */
boolean failed; boolean failed;
/* Output BFD. */ /* Output BFD. */
bfd *output_bfd; bfd *output_bfd;
/* Link information structure. */ /* Link information structure. */
struct bfd_link_info *info; struct bfd_link_info *info;
/* Whether all defined symbols should be exported. */ /* Whether all defined symbols should be exported. */
boolean export_defineds; boolean export_defineds;
/* Number of ldsym structures. */ /* Number of ldsym structures. */
size_t ldsym_count; size_t ldsym_count;
/* Size of string table. */ /* Size of string table. */
size_t string_size; size_t string_size;
/* String table. */ /* String table. */
bfd_byte *strings; bfd_byte *strings;
/* Allocated size of string table. */ /* Allocated size of string table. */
size_t string_alc; size_t string_alc;
}; };
@ -428,37 +408,41 @@ struct xcoff_loader_info
from smaller values. Start with zero, widen, *then* decrement. */ from smaller values. Start with zero, widen, *then* decrement. */
#define MINUS_ONE (((bfd_vma) 0) - 1) #define MINUS_ONE (((bfd_vma) 0) - 1)
/* __rtinit, from /usr/include/rtinit.h. */
struct __rtinit
{
/* Pointer to runtime linker.
XXX: Is the parameter really void? */
int (*rtl) PARAMS ((void));
/* /* Offset to array of init functions, 0 if none. */
* __rtinit int init_offset;
* from /usr/include/rtinit.h
*/ /* Offset to array of fini functions, 0 if none. */
struct __rtinit { int fini_offset;
int (*rtl) PARAMS ((void)); /* Pointer to runtime linker.
XXX: Is the parameter really void? */ /* Size of __RTINIT_DESCRIPTOR. This value should be used instead of
int init_offset; /* Offset to array of init functions sizeof(__RTINIT_DESCRIPTOR). */
(0 if none). */ int __rtinit_descriptor_size;
int fini_offset; /* Offset to array of fini functions
(0 if none). */
int __rtinit_descriptor_size; /* Size of __RTINIT_DESCRIPTOR.
This value should be used instead
of sizeof(__RTINIT_DESCRIPTOR). */
}; };
#define RTINIT_DESCRIPTOR_SIZE (12) #define RTINIT_DESCRIPTOR_SIZE (12)
struct __rtinit_descriptor { struct __rtinit_descriptor
int f; /* Init/fini function. */ {
int name_offset; /* Offset (within __rtinit symbol) /* Init/fini function. */
to name of function. */ int f;
unsigned char flags; /* Flags */
/* Offset, relative to the start of the __rtinit symbol, to name of the
function. */
int name_offset;
/* Flags */
unsigned char flags;
}; };
/* Archive */
/*
* ARCHIVE
*/
#define XCOFFARMAG "<aiaff>\012" #define XCOFFARMAG "<aiaff>\012"
#define XCOFFARMAGBIG "<bigaf>\012" #define XCOFFARMAGBIG "<bigaf>\012"