2001-05-25 04:32:58 +08:00
|
|
|
/* Internal format of XCOFF object file data structures for BFD.
|
|
|
|
|
2009-09-02 15:21:40 +08:00
|
|
|
Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005,
|
|
|
|
2009 Free Software Foundation, Inc.
|
2001-05-25 04:32:58 +08:00
|
|
|
Written by Ian Lance Taylor <ian@cygnus.com>, 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
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2005-05-10 18:21:13 +08:00
|
|
|
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
#ifndef _INTERNAL_XCOFF_H
|
|
|
|
#define _INTERNAL_XCOFF_H
|
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Linker */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Names of "special" sections. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define _TEXT ".text"
|
|
|
|
#define _DATA ".data"
|
|
|
|
#define _BSS ".bss"
|
|
|
|
#define _PAD ".pad"
|
|
|
|
#define _LOADER ".loader"
|
2001-12-18 06:41:02 +08:00
|
|
|
#define _EXCEPT ".except"
|
|
|
|
#define _TYPCHK ".typchk"
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* XCOFF uses a special .loader section with type STYP_LOADER. */
|
|
|
|
#define STYP_LOADER 0x1000
|
|
|
|
|
|
|
|
/* XCOFF uses a special .debug section with type STYP_DEBUG. */
|
|
|
|
#define STYP_DEBUG 0x2000
|
|
|
|
|
|
|
|
/* XCOFF handles line number or relocation overflow by creating
|
|
|
|
another section header with STYP_OVRFLO set. */
|
|
|
|
#define STYP_OVRFLO 0x8000
|
|
|
|
|
2001-12-18 08:32:32 +08:00
|
|
|
/* 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 a type check section. A section of this type contains parameter
|
|
|
|
argument type check strings used by the AIX binder. */
|
|
|
|
#define STYP_TYPCHK 0x4000
|
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
#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 */
|
|
|
|
|
|
|
|
/* XCOFF relocation types.
|
|
|
|
The relocations are described in the function
|
|
|
|
xcoff[64]_ppc_relocate_section in coff64-rs6000.c and coff-rs6000.c */
|
|
|
|
|
|
|
|
#define R_POS (0x00)
|
|
|
|
#define R_NEG (0x01)
|
|
|
|
#define R_REL (0x02)
|
|
|
|
#define R_TOC (0x03)
|
|
|
|
#define R_RTB (0x04)
|
|
|
|
#define R_GL (0x05)
|
|
|
|
#define R_TCL (0x06)
|
|
|
|
#define R_BA (0x08)
|
|
|
|
#define R_BR (0x0a)
|
|
|
|
#define R_RL (0x0c)
|
|
|
|
#define R_RLA (0x0d)
|
|
|
|
#define R_REF (0x0f)
|
|
|
|
#define R_TRL (0x12)
|
|
|
|
#define R_TRLA (0x13)
|
|
|
|
#define R_RRTBI (0x14)
|
|
|
|
#define R_RRTBA (0x15)
|
|
|
|
#define R_CAI (0x16)
|
|
|
|
#define R_CREL (0x17)
|
|
|
|
#define R_RBA (0x18)
|
|
|
|
#define R_RBAC (0x19)
|
|
|
|
#define R_RBR (0x1a)
|
|
|
|
#define R_RBRC (0x1b)
|
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Storage class #defines, from /usr/include/storclass.h that are not already
|
|
|
|
defined in internal.h */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Comment string in .info section */
|
|
|
|
#define C_INFO 110
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Auxillary Symbol Entries */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* x_smtyp values: */
|
|
|
|
#define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */
|
|
|
|
#define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */
|
|
|
|
/* Symbol type values: */
|
|
|
|
#define XTY_ER 0 /* External reference */
|
|
|
|
#define XTY_SD 1 /* Csect definition */
|
|
|
|
#define XTY_LD 2 /* Label definition */
|
|
|
|
#define XTY_CM 3 /* .BSS */
|
|
|
|
#define XTY_EM 4 /* Error message */
|
|
|
|
#define XTY_US 5 /* "Reserved for internal use" */
|
|
|
|
|
|
|
|
/* x_smclas values: */
|
|
|
|
#define XMC_PR 0 /* Read-only program code */
|
|
|
|
#define XMC_RO 1 /* Read-only constant */
|
|
|
|
#define XMC_DB 2 /* Read-only debug dictionary table */
|
|
|
|
#define XMC_TC 3 /* Read-write general TOC entry */
|
|
|
|
#define XMC_UA 4 /* Read-write unclassified */
|
|
|
|
#define XMC_RW 5 /* Read-write data */
|
|
|
|
#define XMC_GL 6 /* Read-only global linkage */
|
|
|
|
#define XMC_XO 7 /* Read-only extended operation */
|
|
|
|
#define XMC_SV 8 /* Read-only supervisor call */
|
|
|
|
#define XMC_BS 9 /* Read-write BSS */
|
|
|
|
#define XMC_DS 10 /* Read-write descriptor csect */
|
|
|
|
#define XMC_UC 11 /* Read-write unnamed Fortran common */
|
|
|
|
#define XMC_TI 12 /* Read-only traceback index csect */
|
|
|
|
#define XMC_TB 13 /* Read-only traceback table csect */
|
|
|
|
/* 14 ??? */
|
|
|
|
#define XMC_TC0 15 /* Read-write TOC anchor */
|
|
|
|
#define XMC_TD 16 /* Read-write data in TOC */
|
2001-09-06 23:20:00 +08:00
|
|
|
#define XMC_SV64 17 /* Read-only 64 bit supervisor call */
|
|
|
|
#define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* The ldhdr structure. This appears at the start of the .loader
|
|
|
|
section. */
|
|
|
|
|
|
|
|
struct internal_ldhdr
|
|
|
|
{
|
2001-12-17 21:13:33 +08:00
|
|
|
/* The version number:
|
|
|
|
1 : 32 bit
|
|
|
|
2 : 64 bit */
|
2001-05-25 04:32:58 +08:00
|
|
|
unsigned long l_version;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The number of symbol table entries. */
|
|
|
|
bfd_size_type l_nsyms;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The number of relocation table entries. */
|
|
|
|
bfd_size_type l_nreloc;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The length of the import file string table. */
|
|
|
|
bfd_size_type l_istlen;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The number of import files. */
|
|
|
|
bfd_size_type l_nimpid;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The offset from the start of the .loader section to the first
|
|
|
|
entry in the import file table. */
|
|
|
|
bfd_size_type l_impoff;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The length of the string table. */
|
|
|
|
bfd_size_type l_stlen;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The offset from the start of the .loader section to the first
|
|
|
|
entry in the string table. */
|
|
|
|
bfd_size_type l_stoff;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The offset to start of the symbol table, only in XCOFF64 */
|
|
|
|
bfd_vma l_symoff;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The offset to the start of the relocation table, only in XCOFF64 */
|
|
|
|
bfd_vma l_rldoff;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* The ldsym structure. This is used to represent a symbol in the
|
|
|
|
.loader section. */
|
|
|
|
|
|
|
|
struct internal_ldsym
|
|
|
|
{
|
|
|
|
union
|
2001-12-17 21:13:33 +08:00
|
|
|
{
|
|
|
|
/* The symbol name if <= SYMNMLEN characters. */
|
|
|
|
char _l_name[SYMNMLEN];
|
|
|
|
struct
|
2001-05-25 04:32:58 +08:00
|
|
|
{
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Zero if the symbol name is more than SYMNMLEN characters. */
|
|
|
|
long _l_zeroes;
|
|
|
|
|
|
|
|
/* The offset in the string table if the symbol name is more
|
|
|
|
than SYMNMLEN characters. */
|
|
|
|
long _l_offset;
|
|
|
|
}
|
|
|
|
_l_l;
|
|
|
|
}
|
|
|
|
_l;
|
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The symbol value. */
|
|
|
|
bfd_vma l_value;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The symbol section number. */
|
|
|
|
short l_scnum;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The symbol type and flags. */
|
|
|
|
char l_smtype;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The symbol storage class. */
|
|
|
|
char l_smclas;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The import file ID. */
|
|
|
|
bfd_size_type l_ifile;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Offset to the parameter type check string. */
|
|
|
|
bfd_size_type l_parm;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* These flags are for the l_smtype field (the lower three bits are an
|
|
|
|
XTY_* value). */
|
|
|
|
|
|
|
|
/* Imported symbol. */
|
|
|
|
#define L_IMPORT (0x40)
|
|
|
|
/* Entry point. */
|
|
|
|
#define L_ENTRY (0x20)
|
|
|
|
/* Exported symbol. */
|
|
|
|
#define L_EXPORT (0x10)
|
include/coff/
* internal.h (C_AIX_WEAKEXT): New macro.
(C_WEAKEXT): Use the GNU definition in the generic part of the file,
and conditionally reset it to C_AIX_WEAKEXT in the XCOFF part of
the file.
(CSECT_SYM_P): New macro.
* xcoff.h (L_WEAK): Define.
(EXTERN_SYM_P): New macro.
bfd/
* coffcode.h (coff_pointerize_aux_hook): Update CSECT_SYM_P to
check whether a symbol has csect information.
(coff_print_aux): Likewise.
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxillary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff_swap_aux_out): Likewise.
(xcoff_reloc_type_br): Handle defweak symbols too.
* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxillary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff64_swap_aux_out): Likewise.
(xcoff64_reloc_type_br): Handle defweak symbols too.
* coffgen.c (coff_print_symbol): Handle auxillary function
information for C_AIX_WEAKEXT too.
* xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Set BSF_WEAK
instead of BSF_GLOBAL if the L_WEAK flag is set.
(xcoff_dynamic_definition_p): New function.
(xcoff_link_add_dynamic_symbols): Use it to decide whether ldsym
defines h. Don't change h if ldsym isn't the definition. Otherwise,
always take the symbol class from the ldsym. Use weak bfd symbol
types for weak ldsyms.
(xcoff_link_add_symbols): Use CSECT_SYM_P and EXTERN_SYM_P.
Fix the check for whether a definition is from a shared object.
Allow redefinitions of weak symbols.
(xcoff_link_check_ar_symbols): Use EXTERN_SYM_P.
(xcoff_keep_symbol_p): Likewise.
(bfd_xcoff_size_dynamic_sections): Use CSECT_SYM_P.
(xcoff_link_input_bfd): Use CSECT_SYM_P and EXTERN_SYM_P.
Add .loader entries for C_AIX_WEAKEXT as well as C_EXT symbols,
but mark them as L_WEAK.
(xcoff_write_global_symbol): Treat weak symbols as C_AIX_WEAKEXT
instead of C_EXT if C_AIX_WEAKEXT == C_WEAKEXT.
gas/
* config/tc-ppc.c (ppc_frob_symbol): Add csect information for
C_AIX_WEAKEXT too.
ld/testsuite/
* ld-powerpc/aix-glink-2a.s, ld-powerpc/aix-glink-2a.ex,
ld-powerpc/aix-glink-2b.s, ld-powerpc/aix-glink-2c.s,
ld-powerpc/aix-glink-2c.ex, ld-powerpc/aix-glink-2d.s,
ld-powerpc/aix-glink-2-32.dd, ld-powerpc/aix-glink-2-64.dd,
ld-powerpc/aix-weak-1a.s, ld-powerpc/aix-weak-1b.s,
ld-powerpc/aix-weak-1-rel.hd, ld-powerpc/aix-weak-1-rel.nd,
ld-powerpc/aix-weak-1-dso.hd, ld-powerpc/aix-weak-1-dso.nd,
ld-powerpc/aix-weak-1-dso.dnd, ld-powerpc/aix-weak-1.ex,
ld-powerpc/aix-weak-2a.s, ld-powerpc/aix-weak-2a.ex,
ld-powerpc/aix-weak-2a.nd, ld-powerpc/aix-weak-2b.s,
ld-powerpc/aix-weak-2b.nd, ld-powerpc/aix-weak-2c.s,
ld-powerpc/aix-weak-2c.ex, ld-powerpc/aix-weak-2c.nd,
ld-powerpc/aix-weak-2c.od, ld-powerpc/aix-weak-3a.s,
ld-powerpc/aix-weak-3a.ex, ld-powerpc/aix-weak-3b.s,
ld-powerpc/aix-weak-3b.ex, ld-powerpc/aix-weak-3-32.d,
ld-powerpc/aix-weak-3-32.dd, ld-powerpc/aix-weak-3-64.d,
ld-powerpc/aix-weak-3-64.dd: New tests.
* ld-powerpc/aix52.exp: Run them. Replace tmp/aix-* with
tmp/aix64-* in 64-bit ld options.
2009-03-14 17:34:26 +08:00
|
|
|
/* Weak symbol. */
|
|
|
|
#define L_WEAK (0x08)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* The ldrel structure. This is used to represent a reloc in the
|
|
|
|
.loader section. */
|
|
|
|
|
|
|
|
struct internal_ldrel
|
|
|
|
{
|
|
|
|
/* The reloc address. */
|
|
|
|
bfd_vma l_vaddr;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The symbol table index in the .loader section symbol table. */
|
|
|
|
bfd_size_type l_symndx;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The relocation type and size. */
|
|
|
|
short l_rtype;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* The section number this relocation applies to. */
|
|
|
|
short l_rsecnm;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* An entry in the XCOFF linker hash table. */
|
|
|
|
struct xcoff_link_hash_entry
|
|
|
|
{
|
|
|
|
struct bfd_link_hash_entry root;
|
|
|
|
|
|
|
|
/* Symbol index in output file. Set to -1 initially. Set to -2 if
|
|
|
|
there is a reloc against this symbol. */
|
|
|
|
long indx;
|
|
|
|
|
|
|
|
/* If we have created a TOC entry for this symbol, this is the .tc
|
|
|
|
section which holds it. */
|
|
|
|
asection *toc_section;
|
|
|
|
|
|
|
|
union
|
2001-12-17 21:13:33 +08:00
|
|
|
{
|
|
|
|
/* If we have created a TOC entry (the XCOFF_SET_TOC flag is
|
|
|
|
set), this is the offset in toc_section. */
|
|
|
|
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. */
|
|
|
|
long toc_indx;
|
|
|
|
}
|
|
|
|
u;
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* If this symbol is a function entry point which is called, this
|
|
|
|
field holds a pointer to the function descriptor. If this symbol
|
|
|
|
is a function descriptor, this field holds a pointer to the
|
|
|
|
function entry point. */
|
|
|
|
struct xcoff_link_hash_entry *descriptor;
|
|
|
|
|
|
|
|
/* The .loader symbol table entry, if there is one. */
|
|
|
|
struct internal_ldsym *ldsym;
|
|
|
|
|
|
|
|
/* If XCOFF_BUILT_LDSYM is set, this is the .loader symbol table
|
|
|
|
index. If XCOFF_BUILD_LDSYM is clear, and XCOFF_IMPORT is set,
|
|
|
|
this is the l_ifile value. */
|
|
|
|
long ldindx;
|
|
|
|
|
|
|
|
/* Some linker flags. */
|
|
|
|
unsigned long flags;
|
|
|
|
|
|
|
|
/* The storage mapping class. */
|
|
|
|
unsigned char smclas;
|
|
|
|
};
|
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Flags for xcoff_link_hash_entry. */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is referenced by a regular object. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_REF_REGULAR 0x00000001
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is defined by a regular object. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_DEF_REGULAR 0x00000002
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is defined by a dynamic object. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_DEF_DYNAMIC 0x00000004
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is used in a reloc being copied into the .loader section. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_LDREL 0x00000008
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is the entry point. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_ENTRY 0x00000010
|
include/coff/
* xcoff.h (XCOFF_CALLED, XCOFF_IMPORT): Update comments.
(XCOFF_WAS_UNDEFINED): New flag.
(xcoff_link_hash_table): Add an "rtld" field.
bfd/
* coff-rs6000.c (xcoff_ppc_relocate_section): Report relocations
against undefined symbols if the symbol's XCOFF_WAS_UNDEFINED
flag is set. Assert that all undefined symbols are either
imported or defined by a dynamic object.
* coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Extend function-symbol
handling to all relocations. Only set XCOFF_CALLED for function
symbols.
(xcoff_find_function): New function, split out from...
(bfd_xcoff_export_symbol) ...here.
(xcoff_set_import_path): New function, split out from...
(bfd_xcoff_import_symbol): ...here. Remove assertion for old
meaning of XCOFF_CALLED.
(xcoff_mark_symbol): If we mark an undefined and unimported
symbol, find some way of defining it. If the symbol is a function
descriptor, fill in its definition automatically. If the symbol
is a function, mark its descriptor and allocate room for global
linkage code. Otherwise mark the symbol as implicitly imported.
Move the code for creating function descriptors from...
(xcoff_build_ldsyms): ...here. Use XCOFF_WAS_UNDEFINED to
check for symbols that were implicitly defined.
(xcoff_mark): Don't count any dynamic relocations against
function symbols.
(bfd_xcoff_size_dynamic_sections): Save the rtld parameter
in the xcoff link info.
(xcoff_link_input_bfd): Remove handling of undefined and
unexported symbols.
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_handle_option): Make
-berok and -bernotok control link_info.unresolved_syms_in_objects
and link_info.unresolved_syms_in_shared_libs instead of
force_make_executable.
ld/testsuite/
* ld-powerpc/aix-glink-1.ex, ld-powerpc/aix-glink-1.s,
ld-powerpc/aix-glink-1-32.dd, ld-powerpc/aix-glink-1-64.dd,
ld-powerpc/aix-glink-1-32.d, ld-powerpc/aix-glink-1-64.d: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:17:31 +08:00
|
|
|
/* Symbol is for a function and is the target of a relocation.
|
|
|
|
The relocation may or may not be a branch-type relocation. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_CALLED 0x00000020
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol needs the TOC entry filled in. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_SET_TOC 0x00000040
|
include/coff/
* xcoff.h (XCOFF_CALLED, XCOFF_IMPORT): Update comments.
(XCOFF_WAS_UNDEFINED): New flag.
(xcoff_link_hash_table): Add an "rtld" field.
bfd/
* coff-rs6000.c (xcoff_ppc_relocate_section): Report relocations
against undefined symbols if the symbol's XCOFF_WAS_UNDEFINED
flag is set. Assert that all undefined symbols are either
imported or defined by a dynamic object.
* coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Extend function-symbol
handling to all relocations. Only set XCOFF_CALLED for function
symbols.
(xcoff_find_function): New function, split out from...
(bfd_xcoff_export_symbol) ...here.
(xcoff_set_import_path): New function, split out from...
(bfd_xcoff_import_symbol): ...here. Remove assertion for old
meaning of XCOFF_CALLED.
(xcoff_mark_symbol): If we mark an undefined and unimported
symbol, find some way of defining it. If the symbol is a function
descriptor, fill in its definition automatically. If the symbol
is a function, mark its descriptor and allocate room for global
linkage code. Otherwise mark the symbol as implicitly imported.
Move the code for creating function descriptors from...
(xcoff_build_ldsyms): ...here. Use XCOFF_WAS_UNDEFINED to
check for symbols that were implicitly defined.
(xcoff_mark): Don't count any dynamic relocations against
function symbols.
(bfd_xcoff_size_dynamic_sections): Save the rtld parameter
in the xcoff link info.
(xcoff_link_input_bfd): Remove handling of undefined and
unexported symbols.
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_handle_option): Make
-berok and -bernotok control link_info.unresolved_syms_in_objects
and link_info.unresolved_syms_in_shared_libs instead of
force_make_executable.
ld/testsuite/
* ld-powerpc/aix-glink-1.ex, ld-powerpc/aix-glink-1.s,
ld-powerpc/aix-glink-1-32.dd, ld-powerpc/aix-glink-1-64.dd,
ld-powerpc/aix-glink-1-32.d, ld-powerpc/aix-glink-1-64.d: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:17:31 +08:00
|
|
|
/* Symbol is implicitly or explicitly imported. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_IMPORT 0x00000080
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is explicitly exported. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_EXPORT 0x00000100
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol has been processed by xcoff_build_ldsyms. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_BUILT_LDSYM 0x00000200
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is mentioned by a section which was not garbage collected. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_MARK 0x00000400
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol size is recorded in size_list list from hash table. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_HAS_SIZE 0x00000800
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is a function descriptor. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_DESCRIPTOR 0x00001000
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Multiple definitions have been for the symbol. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_MULTIPLY_DEFINED 0x00002000
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is the __rtinit symbol. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define XCOFF_RTINIT 0x00004000
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is an imported 32 bit syscall. */
|
2001-09-06 23:20:00 +08:00
|
|
|
#define XCOFF_SYSCALL32 0x00008000
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Symbol is an imported 64 bit syscall. */
|
2001-09-06 23:20:00 +08:00
|
|
|
#define XCOFF_SYSCALL64 0x00010000
|
include/coff/
* xcoff.h (XCOFF_CALLED, XCOFF_IMPORT): Update comments.
(XCOFF_WAS_UNDEFINED): New flag.
(xcoff_link_hash_table): Add an "rtld" field.
bfd/
* coff-rs6000.c (xcoff_ppc_relocate_section): Report relocations
against undefined symbols if the symbol's XCOFF_WAS_UNDEFINED
flag is set. Assert that all undefined symbols are either
imported or defined by a dynamic object.
* coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise.
* xcofflink.c (xcoff_link_add_symbols): Extend function-symbol
handling to all relocations. Only set XCOFF_CALLED for function
symbols.
(xcoff_find_function): New function, split out from...
(bfd_xcoff_export_symbol) ...here.
(xcoff_set_import_path): New function, split out from...
(bfd_xcoff_import_symbol): ...here. Remove assertion for old
meaning of XCOFF_CALLED.
(xcoff_mark_symbol): If we mark an undefined and unimported
symbol, find some way of defining it. If the symbol is a function
descriptor, fill in its definition automatically. If the symbol
is a function, mark its descriptor and allocate room for global
linkage code. Otherwise mark the symbol as implicitly imported.
Move the code for creating function descriptors from...
(xcoff_build_ldsyms): ...here. Use XCOFF_WAS_UNDEFINED to
check for symbols that were implicitly defined.
(xcoff_mark): Don't count any dynamic relocations against
function symbols.
(bfd_xcoff_size_dynamic_sections): Save the rtld parameter
in the xcoff link info.
(xcoff_link_input_bfd): Remove handling of undefined and
unexported symbols.
ld/
* emultempl/aix.em (gld${EMULATION_NAME}_handle_option): Make
-berok and -bernotok control link_info.unresolved_syms_in_objects
and link_info.unresolved_syms_in_shared_libs instead of
force_make_executable.
ld/testsuite/
* ld-powerpc/aix-glink-1.ex, ld-powerpc/aix-glink-1.s,
ld-powerpc/aix-glink-1-32.dd, ld-powerpc/aix-glink-1-64.dd,
ld-powerpc/aix-glink-1-32.d, ld-powerpc/aix-glink-1-64.d: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:17:31 +08:00
|
|
|
/* Symbol was not explicitly defined by the time it was marked. */
|
|
|
|
#define XCOFF_WAS_UNDEFINED 0x00020000
|
include/coff/
* xcoff.h (XCOFF_ALLOCATED): New flag.
bfd/
* xcofflink.c (xcoff_mark): When walking the relocations,
only mark the target symbol or the target section, not both.
(xcoff_final_definition_p): New function.
(xcoff_keep_symbol_p): Use it to check whether an external XCOFF
symbol is a valid definition of the associated output symbol.
Use XCOFF_ALLOCATED to stop the same hash table entry having
two output symbols.
(bfd_xcoff_size_dynamic_sections): Set XCOFF_ALLOCATED when
keeping a symbol.
(xcoff_link_input_bfd): Use xcoff_final_definition_p.
ld/testsuite/
* ld-powerpc/aix-no-dup-syms-1a.s, ld-powerpc/aix-no-dup-syms-1b.s,
ld-powerpc/aix-no-dup-syms-1.ex, ld-powerpc/aix-no-dup-syms-1.im,
ld-powerpc/aix-no-dup-syms-1-dso.dnd,
ld-powerpc/aix-no-dup-syms-1-dso.drd,
ld-powerpc/aix-no-dup-syms-1-dso.nd,
ld-powerpc/aix-no-dup-syms-1-dso.rd,
ld-powerpc/aix-no-dup-syms-1-rel.nd,
ld-powerpc/aix-no-dup-syms-1-rel.rd: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:33:38 +08:00
|
|
|
/* We have assigned an output XCOFF entry to this symbol. */
|
|
|
|
#define XCOFF_ALLOCATED 0x00040000
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* The XCOFF linker hash table. */
|
|
|
|
|
|
|
|
#define XCOFF_NUMBER_OF_SPECIAL_SECTIONS 6
|
|
|
|
#define XCOFF_SPECIAL_SECTION_TEXT 0
|
|
|
|
#define XCOFF_SPECIAL_SECTION_ETEXT 1
|
|
|
|
#define XCOFF_SPECIAL_SECTION_DATA 2
|
|
|
|
#define XCOFF_SPECIAL_SECTION_EDATA 3
|
|
|
|
#define XCOFF_SPECIAL_SECTION_END 4
|
|
|
|
#define XCOFF_SPECIAL_SECTION_END2 5
|
|
|
|
|
include/coff/
* xcoff.h (XCOFF_EXPALL, XCOFF_EXPFULL): New flags.
(xcoff_loader_info): Add auto_export_flags.
bfd/
* bfd-in.h (bfd_xcoff_size_dynamic_sections): Replace the
bfd_boolean export_defineds parameter with an unsigned int
auto_export_flags parameter.
* bfd-in2.h: Regenerate.
* xcofflink.c (xcoff_archive_contains_shared_object_p): New function,
split out from xcoff_build_ldsyms.
(xcoff_covered_by_expall_p): New function.
(xcoff_auto_export_p): New function, split out from xcoff_build_ldsyms
but with extra code to handle -bexpfull and -bexpall.
(xcoff_mark_auto_exports): New function.
(xcoff_build_ldsyms): Use xcoff_auto_export_p to decide whether
a function should be automatically exported.
(bfd_xcoff_size_dynamic_sections): Replace the export_defineds
parameter with an auto_export_flags parameter. Update ldinfo
accordingly. Use xcoff_mark_auto_exports to mark all automatically-
exported symbols.
ld/
* emultempl/aix.em (auto_export_flags): New variable.
(explicit_auto_export_flags): Likewise.
(OPTION_EXPALL, OPTION_EXPFULL): New enum values.
(OPTION_NOEXPALL, OPTION_NOEXPFULL): Likewise.
(gld${EMULATION_NAME}_add_options): Add -bexpall, -bexpfull,
-bnoexpall and -bnoexpfull.
(gld${EMULATION_NAME}_handle_option): Handle them.
(gld${EMULATION_NAME}_before_allocation): Update the call to
bfd_size_dynamic_sections.
ld/testsuite/
* ld-powerpc/aix-export-1-all.dd, ld-powerpc/aix-export-1-full.dd,
ld-powerpc/aix-export-1a.s, ld-powerpc/aix-export-1b.s: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:35:45 +08:00
|
|
|
/* These flags indicate which of -bexpall and -bexpfull are in effect. */
|
|
|
|
#define XCOFF_EXPALL 1
|
|
|
|
#define XCOFF_EXPFULL 2
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* This structure is used to pass information through
|
|
|
|
xcoff_link_hash_traverse. */
|
|
|
|
|
|
|
|
struct xcoff_loader_info
|
|
|
|
{
|
|
|
|
/* Set if a problem occurred. */
|
2002-11-30 16:39:45 +08:00
|
|
|
bfd_boolean failed;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Output BFD. */
|
|
|
|
bfd *output_bfd;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Link information structure. */
|
|
|
|
struct bfd_link_info *info;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
include/coff/
* xcoff.h (XCOFF_EXPALL, XCOFF_EXPFULL): New flags.
(xcoff_loader_info): Add auto_export_flags.
bfd/
* bfd-in.h (bfd_xcoff_size_dynamic_sections): Replace the
bfd_boolean export_defineds parameter with an unsigned int
auto_export_flags parameter.
* bfd-in2.h: Regenerate.
* xcofflink.c (xcoff_archive_contains_shared_object_p): New function,
split out from xcoff_build_ldsyms.
(xcoff_covered_by_expall_p): New function.
(xcoff_auto_export_p): New function, split out from xcoff_build_ldsyms
but with extra code to handle -bexpfull and -bexpall.
(xcoff_mark_auto_exports): New function.
(xcoff_build_ldsyms): Use xcoff_auto_export_p to decide whether
a function should be automatically exported.
(bfd_xcoff_size_dynamic_sections): Replace the export_defineds
parameter with an auto_export_flags parameter. Update ldinfo
accordingly. Use xcoff_mark_auto_exports to mark all automatically-
exported symbols.
ld/
* emultempl/aix.em (auto_export_flags): New variable.
(explicit_auto_export_flags): Likewise.
(OPTION_EXPALL, OPTION_EXPFULL): New enum values.
(OPTION_NOEXPALL, OPTION_NOEXPFULL): Likewise.
(gld${EMULATION_NAME}_add_options): Add -bexpall, -bexpfull,
-bnoexpall and -bnoexpfull.
(gld${EMULATION_NAME}_handle_option): Handle them.
(gld${EMULATION_NAME}_before_allocation): Update the call to
bfd_size_dynamic_sections.
ld/testsuite/
* ld-powerpc/aix-export-1-all.dd, ld-powerpc/aix-export-1-full.dd,
ld-powerpc/aix-export-1a.s, ld-powerpc/aix-export-1b.s: New tests.
* ld-powerpc/aix52.exp: Run them.
2009-03-14 17:35:45 +08:00
|
|
|
/* A mask of XCOFF_EXPALL and XCOFF_EXPFULL flags. */
|
|
|
|
unsigned int auto_export_flags;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Number of ldsym structures. */
|
|
|
|
size_t ldsym_count;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Size of string table. */
|
|
|
|
size_t string_size;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* String table. */
|
2005-02-20 22:59:05 +08:00
|
|
|
char *strings;
|
2001-12-17 21:13:33 +08:00
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* Allocated size of string table. */
|
|
|
|
size_t string_alc;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value
|
|
|
|
from smaller values. Start with zero, widen, *then* decrement. */
|
2001-09-18 18:01:08 +08:00
|
|
|
#define MINUS_ONE (((bfd_vma) 0) - 1)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* __rtinit, from /usr/include/rtinit.h. */
|
|
|
|
struct __rtinit
|
|
|
|
{
|
|
|
|
/* Pointer to runtime linker.
|
|
|
|
XXX: Is the parameter really void? */
|
2003-06-29 21:52:02 +08:00
|
|
|
int (*rtl) (void);
|
2001-12-17 21:13:33 +08:00
|
|
|
|
|
|
|
/* Offset to array of init functions, 0 if none. */
|
|
|
|
int init_offset;
|
|
|
|
|
|
|
|
/* Offset to array of fini functions, 0 if none. */
|
|
|
|
int fini_offset;
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Size of __RTINIT_DESCRIPTOR. This value should be used instead of
|
|
|
|
sizeof(__RTINIT_DESCRIPTOR). */
|
|
|
|
int __rtinit_descriptor_size;
|
2001-05-25 04:32:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#define RTINIT_DESCRIPTOR_SIZE (12)
|
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
struct __rtinit_descriptor
|
|
|
|
{
|
|
|
|
/* Init/fini function. */
|
|
|
|
int f;
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Offset, relative to the start of the __rtinit symbol, to name of the
|
|
|
|
function. */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
int name_offset;
|
|
|
|
|
|
|
|
/* Flags */
|
|
|
|
unsigned char flags;
|
|
|
|
};
|
2001-05-25 04:32:58 +08:00
|
|
|
|
2001-12-17 21:13:33 +08:00
|
|
|
/* Archive */
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
#define XCOFFARMAG "<aiaff>\012"
|
|
|
|
#define XCOFFARMAGBIG "<bigaf>\012"
|
|
|
|
#define SXCOFFARMAG 8
|
|
|
|
|
2001-12-31 12:06:14 +08:00
|
|
|
/* The size of the ascii archive elements */
|
|
|
|
#define XCOFFARMAG_ELEMENT_SIZE 12
|
|
|
|
#define XCOFFARMAGBIG_ELEMENT_SIZE 20
|
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
/* This terminates an XCOFF archive member name. */
|
|
|
|
|
|
|
|
#define XCOFFARFMAG "`\012"
|
|
|
|
#define SXCOFFARFMAG 2
|
|
|
|
|
|
|
|
/* XCOFF archives start with this (printable) structure. */
|
|
|
|
|
|
|
|
struct xcoff_ar_file_hdr
|
|
|
|
{
|
|
|
|
/* Magic string. */
|
|
|
|
char magic[SXCOFFARMAG];
|
|
|
|
|
|
|
|
/* Offset of the member table (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char memoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the global symbol table (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char symoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the first member in the archive (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char firstmemoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the last member in the archive (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char lastmemoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the first member on the free list (decimal ASCII
|
|
|
|
string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char freeoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
};
|
|
|
|
|
2001-12-31 12:06:14 +08:00
|
|
|
#define SIZEOF_AR_FILE_HDR (SXCOFFARMAG + 5 * XCOFFARMAG_ELEMENT_SIZE)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* This is the equivalent data structure for the big archive format. */
|
|
|
|
|
|
|
|
struct xcoff_ar_file_hdr_big
|
|
|
|
{
|
|
|
|
/* Magic string. */
|
|
|
|
char magic[SXCOFFARMAG];
|
|
|
|
|
|
|
|
/* Offset of the member table (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char memoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the global symbol table for 32-bit objects (decimal ASCII
|
|
|
|
string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char symoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the global symbol table for 64-bit objects (decimal ASCII
|
|
|
|
string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char symoff64[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the first member in the archive (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char firstmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the last member in the archive (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char lastmemoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Offset of the first member on the free list (decimal ASCII
|
|
|
|
string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char freeoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
};
|
|
|
|
|
2001-12-31 12:06:14 +08:00
|
|
|
#define SIZEOF_AR_FILE_HDR_BIG (SXCOFFARMAG + 6 * XCOFFARMAGBIG_ELEMENT_SIZE)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* Each XCOFF archive member starts with this (printable) structure. */
|
|
|
|
|
|
|
|
struct xcoff_ar_hdr
|
|
|
|
{
|
|
|
|
/* File size not including the header (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char size[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File offset of next archive member (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char nextoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File offset of previous archive member (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char prevoff[XCOFFARMAG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File mtime (decimal ASCII string). */
|
|
|
|
char date[12];
|
|
|
|
|
|
|
|
/* File UID (decimal ASCII string). */
|
|
|
|
char uid[12];
|
|
|
|
|
|
|
|
/* File GID (decimal ASCII string). */
|
|
|
|
char gid[12];
|
|
|
|
|
|
|
|
/* File mode (octal ASCII string). */
|
|
|
|
char mode[12];
|
|
|
|
|
|
|
|
/* Length of file name (decimal ASCII string). */
|
|
|
|
char namlen[4];
|
|
|
|
|
|
|
|
/* This structure is followed by the file name. The length of the
|
|
|
|
name is given in the namlen field. If the length of the name is
|
|
|
|
odd, the name is followed by a null byte. The name and optional
|
|
|
|
null byte are followed by XCOFFARFMAG, which is not included in
|
|
|
|
namlen. The contents of the archive member follow; the number of
|
|
|
|
bytes is given in the size field. */
|
|
|
|
};
|
|
|
|
|
2001-12-31 12:06:14 +08:00
|
|
|
#define SIZEOF_AR_HDR (3 * XCOFFARMAG_ELEMENT_SIZE + 4 * 12 + 4)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* The equivalent for the big archive format. */
|
|
|
|
|
|
|
|
struct xcoff_ar_hdr_big
|
|
|
|
{
|
|
|
|
/* File size not including the header (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char size[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File offset of next archive member (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char nextoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File offset of previous archive member (decimal ASCII string). */
|
2001-12-31 12:06:14 +08:00
|
|
|
char prevoff[XCOFFARMAGBIG_ELEMENT_SIZE];
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* File mtime (decimal ASCII string). */
|
|
|
|
char date[12];
|
|
|
|
|
|
|
|
/* File UID (decimal ASCII string). */
|
|
|
|
char uid[12];
|
|
|
|
|
|
|
|
/* File GID (decimal ASCII string). */
|
|
|
|
char gid[12];
|
|
|
|
|
|
|
|
/* File mode (octal ASCII string). */
|
|
|
|
char mode[12];
|
|
|
|
|
|
|
|
/* Length of file name (decimal ASCII string). */
|
|
|
|
char namlen[4];
|
|
|
|
|
|
|
|
/* This structure is followed by the file name. The length of the
|
|
|
|
name is given in the namlen field. If the length of the name is
|
|
|
|
odd, the name is followed by a null byte. The name and optional
|
|
|
|
null byte are followed by XCOFFARFMAG, which is not included in
|
|
|
|
namlen. The contents of the archive member follow; the number of
|
|
|
|
bytes is given in the size field. */
|
|
|
|
};
|
|
|
|
|
2001-12-31 12:06:14 +08:00
|
|
|
#define SIZEOF_AR_HDR_BIG (3 * XCOFFARMAGBIG_ELEMENT_SIZE + 4 * 12 + 4)
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* 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
|
2001-12-31 12:06:14 +08:00
|
|
|
`hdr' member has the same size and position in both formats.
|
2002-11-30 16:39:45 +08:00
|
|
|
<bigaf> is the default format, return TRUE even when xcoff_ardata is
|
2001-12-31 12:06:14 +08:00
|
|
|
NULL. */
|
2002-02-01 13:47:14 +08:00
|
|
|
#ifndef SMALL_ARCHIVE
|
|
|
|
/* Creates big archives by default */
|
2001-12-31 12:06:14 +08:00
|
|
|
#define xcoff_big_format_p(abfd) \
|
|
|
|
((NULL != bfd_ardata (abfd) && NULL == xcoff_ardata (abfd)) || \
|
|
|
|
((NULL != bfd_ardata (abfd)) && \
|
|
|
|
(NULL != xcoff_ardata (abfd)) && \
|
|
|
|
(xcoff_ardata (abfd)->magic[1] == 'b')))
|
2002-02-01 13:47:14 +08:00
|
|
|
#else
|
|
|
|
/* Creates small archives by default. */
|
2001-05-25 04:32:58 +08:00
|
|
|
#define xcoff_big_format_p(abfd) \
|
2001-12-31 12:06:14 +08:00
|
|
|
(((NULL != bfd_ardata (abfd)) && \
|
|
|
|
(NULL != xcoff_ardata (abfd)) && \
|
2002-02-01 13:47:14 +08:00
|
|
|
(xcoff_ardata (abfd)->magic[1] == 'b')))
|
|
|
|
#endif
|
2001-05-25 04:32:58 +08:00
|
|
|
|
|
|
|
/* We store a copy of the xcoff_ar_file_hdr in the tdata field of the
|
|
|
|
artdata structure. Similar for the big archive. */
|
|
|
|
#define xcoff_ardata(abfd) \
|
|
|
|
((struct xcoff_ar_file_hdr *) bfd_ardata (abfd)->tdata)
|
|
|
|
#define xcoff_ardata_big(abfd) \
|
|
|
|
((struct xcoff_ar_file_hdr_big *) bfd_ardata (abfd)->tdata)
|
|
|
|
|
|
|
|
/* We store a copy of the xcoff_ar_hdr in the arelt_data field of an
|
|
|
|
archive element. Similar for the big archive. */
|
|
|
|
#define arch_eltdata(bfd) ((struct areltdata *) ((bfd)->arelt_data))
|
|
|
|
#define arch_xhdr(bfd) \
|
|
|
|
((struct xcoff_ar_hdr *) arch_eltdata (bfd)->arch_header)
|
|
|
|
#define arch_xhdr_big(bfd) \
|
|
|
|
((struct xcoff_ar_hdr_big *) arch_eltdata (bfd)->arch_header)
|
|
|
|
|
include/coff/
* internal.h (C_AIX_WEAKEXT): New macro.
(C_WEAKEXT): Use the GNU definition in the generic part of the file,
and conditionally reset it to C_AIX_WEAKEXT in the XCOFF part of
the file.
(CSECT_SYM_P): New macro.
* xcoff.h (L_WEAK): Define.
(EXTERN_SYM_P): New macro.
bfd/
* coffcode.h (coff_pointerize_aux_hook): Update CSECT_SYM_P to
check whether a symbol has csect information.
(coff_print_aux): Likewise.
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxillary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff_swap_aux_out): Likewise.
(xcoff_reloc_type_br): Handle defweak symbols too.
* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxillary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff64_swap_aux_out): Likewise.
(xcoff64_reloc_type_br): Handle defweak symbols too.
* coffgen.c (coff_print_symbol): Handle auxillary function
information for C_AIX_WEAKEXT too.
* xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Set BSF_WEAK
instead of BSF_GLOBAL if the L_WEAK flag is set.
(xcoff_dynamic_definition_p): New function.
(xcoff_link_add_dynamic_symbols): Use it to decide whether ldsym
defines h. Don't change h if ldsym isn't the definition. Otherwise,
always take the symbol class from the ldsym. Use weak bfd symbol
types for weak ldsyms.
(xcoff_link_add_symbols): Use CSECT_SYM_P and EXTERN_SYM_P.
Fix the check for whether a definition is from a shared object.
Allow redefinitions of weak symbols.
(xcoff_link_check_ar_symbols): Use EXTERN_SYM_P.
(xcoff_keep_symbol_p): Likewise.
(bfd_xcoff_size_dynamic_sections): Use CSECT_SYM_P.
(xcoff_link_input_bfd): Use CSECT_SYM_P and EXTERN_SYM_P.
Add .loader entries for C_AIX_WEAKEXT as well as C_EXT symbols,
but mark them as L_WEAK.
(xcoff_write_global_symbol): Treat weak symbols as C_AIX_WEAKEXT
instead of C_EXT if C_AIX_WEAKEXT == C_WEAKEXT.
gas/
* config/tc-ppc.c (ppc_frob_symbol): Add csect information for
C_AIX_WEAKEXT too.
ld/testsuite/
* ld-powerpc/aix-glink-2a.s, ld-powerpc/aix-glink-2a.ex,
ld-powerpc/aix-glink-2b.s, ld-powerpc/aix-glink-2c.s,
ld-powerpc/aix-glink-2c.ex, ld-powerpc/aix-glink-2d.s,
ld-powerpc/aix-glink-2-32.dd, ld-powerpc/aix-glink-2-64.dd,
ld-powerpc/aix-weak-1a.s, ld-powerpc/aix-weak-1b.s,
ld-powerpc/aix-weak-1-rel.hd, ld-powerpc/aix-weak-1-rel.nd,
ld-powerpc/aix-weak-1-dso.hd, ld-powerpc/aix-weak-1-dso.nd,
ld-powerpc/aix-weak-1-dso.dnd, ld-powerpc/aix-weak-1.ex,
ld-powerpc/aix-weak-2a.s, ld-powerpc/aix-weak-2a.ex,
ld-powerpc/aix-weak-2a.nd, ld-powerpc/aix-weak-2b.s,
ld-powerpc/aix-weak-2b.nd, ld-powerpc/aix-weak-2c.s,
ld-powerpc/aix-weak-2c.ex, ld-powerpc/aix-weak-2c.nd,
ld-powerpc/aix-weak-2c.od, ld-powerpc/aix-weak-3a.s,
ld-powerpc/aix-weak-3a.ex, ld-powerpc/aix-weak-3b.s,
ld-powerpc/aix-weak-3b.ex, ld-powerpc/aix-weak-3-32.d,
ld-powerpc/aix-weak-3-32.dd, ld-powerpc/aix-weak-3-64.d,
ld-powerpc/aix-weak-3-64.dd: New tests.
* ld-powerpc/aix52.exp: Run them. Replace tmp/aix-* with
tmp/aix64-* in 64-bit ld options.
2009-03-14 17:34:26 +08:00
|
|
|
/* True if symbols of class CLASS are external. */
|
|
|
|
#define EXTERN_SYM_P(CLASS) \
|
|
|
|
((CLASS) == C_EXT || (CLASS) == C_AIX_WEAKEXT)
|
|
|
|
|
2001-05-25 04:32:58 +08:00
|
|
|
#endif /* _INTERNAL_XCOFF_H */
|