X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=include%2Fcoff%2Fxcoff.h;h=a645acce059eaf2ebab618a3686a1e84272ec6be;hb=9e790a80160676e7fd3fb8be6cf3c1c77d9ded81;hp=e9dbaf212afc5cf649022497d4ba3efd62625930;hpb=67fdeebeb2246ec95449f9b1428ae000f7744e92;p=deliverable%2Fbinutils-gdb.git diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h index e9dbaf212a..a645acce05 100644 --- a/include/coff/xcoff.h +++ b/include/coff/xcoff.h @@ -1,14 +1,13 @@ /* Internal format of XCOFF object file data structures for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 - Free Software Foundation, Inc. + Copyright (C) 1995-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor , Cygnus Support. This file is part of BFD, the Binary File Descriptor library. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -18,11 +17,29 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, + MA 02110-1301, USA. */ #ifndef _INTERNAL_XCOFF_H #define _INTERNAL_XCOFF_H +/* XCOFF specific f_flags. */ + +/* File was profiled with fdpr. */ +#define F_FDPR_PROF 0x0010 + +/* File was reordered with fdpr. */ +#define F_FDPR_OPTI 0x0020 + +/* File use very large program support. */ +#define F_DSA 0x0040 + +/* One aux header specifying medium page sizes is non-zero. */ +#define F_VARPG 0x0100 + +/* Read/write sections are non-executable. */ +#define F_NONEXEC 0x8000 + /* Linker */ /* Names of "special" sections. */ @@ -34,25 +51,44 @@ #define _EXCEPT ".except" #define _TYPCHK ".typchk" -/* XCOFF uses a special .loader section with type STYP_LOADER. */ -#define STYP_LOADER 0x1000 +/* XCOFF uses special .dwXXX sections with the type STYP_DWARF. */ +#define STYP_DWARF 0x0010 -/* XCOFF uses a special .debug section with type STYP_DEBUG. */ -#define STYP_DEBUG 0x2000 +/* High-order 16-bits dwarf subtypes. */ +#define SSUBTYP_DWINFO 0x10000 +#define SSUBTYP_DWLINE 0x20000 +#define SSUBTYP_DWPBNMS 0x30000 +#define SSUBTYP_DWPBTYP 0x40000 +#define SSUBTYP_DWARNGE 0x50000 +#define SSUBTYP_DWABREV 0x60000 +#define SSUBTYP_DWSTR 0x70000 +#define SSUBTYP_DWRNGES 0x80000 -/* XCOFF handles line number or relocation overflow by creating - another section header with STYP_OVRFLO set. */ -#define STYP_OVRFLO 0x8000 +/* XCOFF uses a special .loader section with type STYP_LOADER. */ +#define STYP_LOADER 0x1000 /* Specifies an exception section. A section of this type provides information to identify the reason that a trap or ececptin occured within and executable object program */ #define STYP_EXCEPT 0x0100 +/* Specifies an initialized thread-local data section. */ +#define STYP_TDATA 0x0400 + +/* Specifies an uninitialized thread-local data section. */ +#define STYP_TBSS 0x0800 + +/* XCOFF uses a special .debug section with type STYP_DEBUG. */ +#define STYP_DEBUG 0x2000 + /* Specifies a type check section. A section of this type contains parameter argument type check strings used by the AIX binder. */ #define STYP_TYPCHK 0x4000 +/* XCOFF handles line number or relocation overflow by creating + another section header with STYP_OVRFLO set. */ +#define STYP_OVRFLO 0x8000 + #define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */ #define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */ #define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */ @@ -83,6 +119,14 @@ #define R_RBAC (0x19) #define R_RBR (0x1a) #define R_RBRC (0x1b) +#define R_TLS (0x20) +#define R_TLS_IE (0x21) +#define R_TLS_LD (0x22) +#define R_TLS_LE (0x23) +#define R_TLSM (0x24) +#define R_TLSML (0x25) +#define R_TOCU (0x30) +#define R_TOCL (0x31) /* Storage class #defines, from /usr/include/storclass.h that are not already defined in internal.h */ @@ -90,6 +134,9 @@ /* Comment string in .info section */ #define C_INFO 110 +/* Dwarf symbol. */ +#define C_DWARF 112 + /* Auxillary Symbol Entries */ /* x_smtyp values: */ @@ -123,6 +170,10 @@ #define XMC_TD 16 /* Read-write data in TOC */ #define XMC_SV64 17 /* Read-only 64 bit supervisor call */ #define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */ +/* 19 ??? */ +#define XMC_TL 20 /* Read-write initialized TLS data */ +#define XMC_TU 21 /* Read-write uninitialized TLS data */ +#define XMC_TE 22 /* Same as XMC_TC but mapped after it */ /* The ldhdr structure. This appears at the start of the .loader section. */ @@ -214,6 +265,8 @@ struct internal_ldsym #define L_ENTRY (0x20) /* Exported symbol. */ #define L_EXPORT (0x10) +/* Weak symbol. */ +#define L_WEAK (0x08) /* The ldrel structure. This is used to represent a reloc in the .loader section. */ @@ -291,11 +344,12 @@ struct xcoff_link_hash_entry #define XCOFF_LDREL 0x00000008 /* Symbol is the entry point. */ #define XCOFF_ENTRY 0x00000010 -/* Symbol is called; this is, it appears in a R_BR reloc. */ +/* Symbol is for a function and is the target of a relocation. + The relocation may or may not be a branch-type relocation. */ #define XCOFF_CALLED 0x00000020 /* Symbol needs the TOC entry filled in. */ #define XCOFF_SET_TOC 0x00000040 -/* Symbol is explicitly imported. */ +/* Symbol is implicitly or explicitly imported. */ #define XCOFF_IMPORT 0x00000080 /* Symbol is explicitly exported. */ #define XCOFF_EXPORT 0x00000100 @@ -315,6 +369,10 @@ struct xcoff_link_hash_entry #define XCOFF_SYSCALL32 0x00008000 /* Symbol is an imported 64 bit syscall. */ #define XCOFF_SYSCALL64 0x00010000 +/* Symbol was not explicitly defined by the time it was marked. */ +#define XCOFF_WAS_UNDEFINED 0x00020000 +/* We have assigned an output XCOFF entry to this symbol. */ +#define XCOFF_ALLOCATED 0x00040000 /* The XCOFF linker hash table. */ @@ -326,64 +384,9 @@ struct xcoff_link_hash_entry #define XCOFF_SPECIAL_SECTION_END 4 #define XCOFF_SPECIAL_SECTION_END2 5 -struct xcoff_link_hash_table -{ - struct bfd_link_hash_table root; - - /* The .debug string hash table. We need to compute this while - reading the input files, so that we know how large the .debug - section will be before we assign section positions. */ - struct bfd_strtab_hash *debug_strtab; - - /* The .debug section we will use for the final output. */ - asection *debug_section; - - /* The .loader section we will use for the final output. */ - asection *loader_section; - - /* A count of non TOC relative relocs which will need to be - allocated in the .loader section. */ - size_t ldrel_count; - - /* The .loader section header. */ - struct internal_ldhdr ldhdr; - - /* The .gl section we use to hold global linkage code. */ - asection *linkage_section; - - /* The .tc section we use to hold toc entries we build for global - linkage code. */ - asection *toc_section; - - /* The .ds section we use to hold function descriptors which we - create for exported symbols. */ - asection *descriptor_section; - - /* The list of import files. */ - struct xcoff_import_file *imports; - - /* Required alignment of sections within the output file. */ - unsigned long file_align; - - /* Whether the .text section must be read-only. */ - boolean textro; - - /* Whether garbage collection was done. */ - boolean gc; - - /* A linked list of symbols for which we have size information. */ - struct xcoff_link_size_list - { - struct xcoff_link_size_list *next; - struct xcoff_link_hash_entry *h; - bfd_size_type size; - } - *size_list; - - /* Magic sections: _text, _etext, _data, _edata, _end, end. */ - asection *special_sections[XCOFF_NUMBER_OF_SPECIAL_SECTIONS]; -}; - +/* These flags indicate which of -bexpall and -bexpfull are in effect. */ +#define XCOFF_EXPALL 1 +#define XCOFF_EXPFULL 2 /* This structure is used to pass information through xcoff_link_hash_traverse. */ @@ -391,7 +394,7 @@ struct xcoff_link_hash_table struct xcoff_loader_info { /* Set if a problem occurred. */ - boolean failed; + bfd_boolean failed; /* Output BFD. */ bfd *output_bfd; @@ -399,8 +402,8 @@ struct xcoff_loader_info /* Link information structure. */ struct bfd_link_info *info; - /* Whether all defined symbols should be exported. */ - boolean export_defineds; + /* A mask of XCOFF_EXPALL and XCOFF_EXPFULL flags. */ + unsigned int auto_export_flags; /* Number of ldsym structures. */ size_t ldsym_count; @@ -409,7 +412,7 @@ struct xcoff_loader_info size_t string_size; /* String table. */ - bfd_byte *strings; + char *strings; /* Allocated size of string table. */ size_t string_alc; @@ -424,7 +427,7 @@ struct __rtinit { /* Pointer to runtime linker. XXX: Is the parameter really void? */ - int (*rtl) PARAMS ((void)); + int (*rtl) (void); /* Offset to array of init functions, 0 if none. */ int init_offset; @@ -459,6 +462,10 @@ struct __rtinit_descriptor #define XCOFFARMAGBIG "\012" #define SXCOFFARMAG 8 +/* The size of the ascii archive elements */ +#define XCOFFARMAG_ELEMENT_SIZE 12 +#define XCOFFARMAGBIG_ELEMENT_SIZE 20 + /* This terminates an XCOFF archive member name. */ #define XCOFFARFMAG "`\012" @@ -472,23 +479,23 @@ struct xcoff_ar_file_hdr char magic[SXCOFFARMAG]; /* Offset of the member table (decimal ASCII string). */ - char memoff[12]; + char memoff[XCOFFARMAG_ELEMENT_SIZE]; /* Offset of the global symbol table (decimal ASCII string). */ - char symoff[12]; + char symoff[XCOFFARMAG_ELEMENT_SIZE]; /* Offset of the first member in the archive (decimal ASCII string). */ - char firstmemoff[12]; + char firstmemoff[XCOFFARMAG_ELEMENT_SIZE]; /* Offset of the last member in the archive (decimal ASCII string). */ - char lastmemoff[12]; + char lastmemoff[XCOFFARMAG_ELEMENT_SIZE]; /* Offset of the first member on the free list (decimal ASCII string). */ - char freeoff[12]; + char freeoff[XCOFFARMAG_ELEMENT_SIZE]; }; -#define SIZEOF_AR_FILE_HDR (5 * 12 + SXCOFFARMAG) +#define SIZEOF_AR_FILE_HDR (SXCOFFARMAG + 5 * XCOFFARMAG_ELEMENT_SIZE) /* This is the equivalent data structure for the big archive format. */ @@ -498,42 +505,41 @@ struct xcoff_ar_file_hdr_big char magic[SXCOFFARMAG]; /* Offset of the member table (decimal ASCII string). */ - char memoff[20]; + char memoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* Offset of the global symbol table for 32-bit objects (decimal ASCII string). */ - char symoff[20]; + char symoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* Offset of the global symbol table for 64-bit objects (decimal ASCII string). */ - char symoff64[20]; + char symoff64[XCOFFARMAGBIG_ELEMENT_SIZE]; /* Offset of the first member in the archive (decimal ASCII string). */ - char firstmemoff[20]; + char firstmemoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* Offset of the last member in the archive (decimal ASCII string). */ - char lastmemoff[20]; + char lastmemoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* Offset of the first member on the free list (decimal ASCII string). */ - char freeoff[20]; + char freeoff[XCOFFARMAGBIG_ELEMENT_SIZE]; }; -#define SIZEOF_AR_FILE_HDR_BIG (6 * 20 + SXCOFFARMAG) - +#define SIZEOF_AR_FILE_HDR_BIG (SXCOFFARMAG + 6 * XCOFFARMAGBIG_ELEMENT_SIZE) /* Each XCOFF archive member starts with this (printable) structure. */ struct xcoff_ar_hdr { /* File size not including the header (decimal ASCII string). */ - char size[12]; + char size[XCOFFARMAG_ELEMENT_SIZE]; /* File offset of next archive member (decimal ASCII string). */ - char nextoff[12]; + char nextoff[XCOFFARMAG_ELEMENT_SIZE]; /* File offset of previous archive member (decimal ASCII string). */ - char prevoff[12]; + char prevoff[XCOFFARMAG_ELEMENT_SIZE]; /* File mtime (decimal ASCII string). */ char date[12]; @@ -558,20 +564,20 @@ struct xcoff_ar_hdr bytes is given in the size field. */ }; -#define SIZEOF_AR_HDR (7 * 12 + 4) +#define SIZEOF_AR_HDR (3 * XCOFFARMAG_ELEMENT_SIZE + 4 * 12 + 4) /* The equivalent for the big archive format. */ struct xcoff_ar_hdr_big { /* File size not including the header (decimal ASCII string). */ - char size[20]; + char size[XCOFFARMAGBIG_ELEMENT_SIZE]; /* File offset of next archive member (decimal ASCII string). */ - char nextoff[20]; + char nextoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* File offset of previous archive member (decimal ASCII string). */ - char prevoff[20]; + char prevoff[XCOFFARMAGBIG_ELEMENT_SIZE]; /* File mtime (decimal ASCII string). */ char date[12]; @@ -596,15 +602,27 @@ struct xcoff_ar_hdr_big bytes is given in the size field. */ }; -#define SIZEOF_AR_HDR_BIG (3 * 20 + 4 * 12 + 4) +#define SIZEOF_AR_HDR_BIG (3 * XCOFFARMAGBIG_ELEMENT_SIZE + 4 * 12 + 4) /* We often have to distinguish between the old and big file format. Make it a bit cleaner. We can use `xcoff_ardata' here because the - `hdr' member has the same size and position in both formats. */ + `hdr' member has the same size and position in both formats. + is the default format, return TRUE even when xcoff_ardata is + NULL. */ +#ifndef SMALL_ARCHIVE +/* Creates big archives by default */ #define xcoff_big_format_p(abfd) \ - ((NULL != bfd_ardata(abfd)) && \ - (NULL != xcoff_ardata(abfd)) && \ - (xcoff_ardata (abfd)->magic[1] == 'b')) + ((NULL != bfd_ardata (abfd) && NULL == xcoff_ardata (abfd)) || \ + ((NULL != bfd_ardata (abfd)) && \ + (NULL != xcoff_ardata (abfd)) && \ + (xcoff_ardata (abfd)->magic[1] == 'b'))) +#else +/* Creates small archives by default. */ +#define xcoff_big_format_p(abfd) \ + (((NULL != bfd_ardata (abfd)) && \ + (NULL != xcoff_ardata (abfd)) && \ + (xcoff_ardata (abfd)->magic[1] == 'b'))) +#endif /* We store a copy of the xcoff_ar_file_hdr in the tdata field of the artdata structure. Similar for the big archive. */ @@ -621,4 +639,8 @@ struct xcoff_ar_hdr_big #define arch_xhdr_big(bfd) \ ((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header) +/* True if symbols of class CLASS are external. */ +#define EXTERN_SYM_P(CLASS) \ + ((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT) + #endif /* _INTERNAL_XCOFF_H */