diff options
author | cvs2svn <> | 2002-02-09 22:54:17 +0000 |
---|---|---|
committer | cvs2svn <> | 2002-02-09 22:54:17 +0000 |
commit | 34124a07180b9c8c7479517436c49292cfd12dcd (patch) | |
tree | 75b8ab96fbc6007f3c2f5289a74119190b1c246c /include/coff | |
parent | 53c570dbbc783190848fb72380c42664c4a5e808 (diff) | |
download | cygnal-34124a07180b9c8c7479517436c49292cfd12dcd.tar.gz cygnal-34124a07180b9c8c7479517436c49292cfd12dcd.tar.bz2 cygnal-34124a07180b9c8c7479517436c49292cfd12dcd.zip |
This commit was manufactured by cvs2svn to create branch 'binutils-binutils-2_12-branchpoint
2_12-branch'.
Sprout from gdb_5_1-2001-07-29-branch 2001-07-26 14:20:06 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch'
Cherrypick from master 2002-02-09 22:54:16 UTC Richard Henderson <rth@redhat.com> ' * alpha.h (R_ALPHA_BRSGP): New.':
COPYING.NEWLIB
ChangeLog
MAINTAINERS
Makefile.in
config.guess
config.sub
configure
configure.in
etc/ChangeLog
etc/Makefile.in
gettext.m4
include/ChangeLog
include/ansidecl.h
include/aout/ChangeLog
include/aout/aout64.h
include/aout/hp300hpux.h
include/bfdlink.h
include/coff/ChangeLog
include/coff/arm.h
include/coff/external.h
include/coff/internal.h
include/coff/m88k.h
include/coff/or32.h
include/coff/ti.h
include/coff/tic54x.h
include/coff/xcoff.h
include/demangle.h
include/dis-asm.h
include/dyn-string.h
include/elf/ChangeLog
include/elf/alpha.h
include/elf/arm.h
include/elf/common.h
include/elf/dwarf2.h
include/elf/external.h
include/elf/h8.h
include/elf/ia64.h
include/elf/internal.h
include/elf/mips.h
include/elf/mmix.h
include/elf/or32.h
include/elf/ppc.h
include/elf/sh.h
include/elf/xstormy16.h
include/fibheap.h
include/filenames.h
include/floatformat.h
include/hashtab.h
include/libiberty.h
include/nlm/ChangeLog
include/nlm/common.h
include/objalloc.h
include/opcode/ChangeLog
include/opcode/alpha.h
include/opcode/arc.h
include/opcode/avr.h
include/opcode/cgen.h
include/opcode/d10v.h
include/opcode/d30v.h
include/opcode/h8300.h
include/opcode/hppa.h
include/opcode/i386.h
include/opcode/mips.h
include/opcode/mmix.h
include/opcode/or32.h
include/opcode/ppc.h
include/opcode/tic54x.h
include/opcode/v850.h
include/partition.h
include/safe-ctype.h
include/sort.h
include/splay-tree.h
include/xregex.h
libtool.m4
ltcf-c.sh
ltcf-cxx.sh
ltcf-gcj.sh
ltconfig
ltmain.sh
symlink-tree
Diffstat (limited to 'include/coff')
-rw-r--r-- | include/coff/ChangeLog | 67 | ||||
-rw-r--r-- | include/coff/arm.h | 3 | ||||
-rw-r--r-- | include/coff/external.h | 8 | ||||
-rw-r--r-- | include/coff/internal.h | 6 | ||||
-rw-r--r-- | include/coff/m88k.h | 30 | ||||
-rw-r--r-- | include/coff/or32.h | 287 | ||||
-rw-r--r-- | include/coff/ti.h | 189 | ||||
-rw-r--r-- | include/coff/tic54x.h | 27 | ||||
-rw-r--r-- | include/coff/xcoff.h | 320 |
9 files changed, 675 insertions, 262 deletions
diff --git a/include/coff/ChangeLog b/include/coff/ChangeLog index 712ecc117..79e8e184c 100644 --- a/include/coff/ChangeLog +++ b/include/coff/ChangeLog @@ -1,3 +1,70 @@ +2002-02-01 Tom Rix <trix@redhat.com> + + * xcoff.h: Conditionally support <aiaff> for pre AIX 4.3. + +2002-01-31 Ivan Guzvinec <ivang@opencores.org> + + * or32.h: New file. + +2001-12-24 Tom Rix <trix@redhat.com> + + * xcoff.h (xcoff_big_format_p): Make <bigaf> the default archive + format. + (XCOFFARMAG_ELEMENT_SIZE, XCOFFARMAGBIG_ELEMENT_SIZE): Define for + archive header ascii elements. + +2001-12-17 Tom Rix <trix@redhat.com> + + * xcoff.h : Add .except and .typchk section string and styp flags. + Fix xcoff_big_format_p macro. + +2001-12-16 Tom Rix <trix@redhat.com> + + * xcoff.h : Clean up formatting. + +2002-01-15 Richard Earnshaw <rearnsha@arm.com> + + * arm.h (F_VFP_FLOAT): Define. + +2001-11-11 Timothy Wall <twall@alum.mit.edu> + + * ti.h: Move arch-specific stuff from here... + (COFF_ADJUST_SYM_IN/OUT): Optionally put page flag into symbol + value. + * tic54x.h: ...to here. + +2001-10-26 Christian Groessler <cpg@aladdin.de> + + * external.h (GET_LINENO_LNNO): Fix usage of H_GET_32/16. + (PUT_LINENO_LNNO): Likewise with H_PUT_32/16. + +2001-09-21 Nick Clifton <nickc@cambridge.redhat.com> + + * ti.h (GET_SCNHDR_PAGE): Fix compile time warning. + +2001-09-18 Alan Modra <amodra@bigpond.net.au> + + * external.h (GET_LINENO_LNNO): Use H_GET_32/16. + (PUT_LINENO_LNNO): Use H_PUT_32/16. + * m88k.h (GET_LNSZ_SIZE, GET_LNSZ_LNNO, GET_SCN_NRELOC, + GET_SCN_NLINNO): Use H_GET_32. + (PUT_LNSZ_LNNO, PUT_LNSZ_SIZE, PUT_SCN_NRELOC, PUT_SCN_NLINNO): + Use H_PUT_32. + * ti.h: Formatting fixes. Make use of H_GET_* and H_PUT_* throughout. + * xcoff.h: White space changes. + +2001-09-05 Tom Rix <trix@redhat.com> + + * xcoff.h : Add XCOFF_SYSCALL32 and XCOFF_SYSCALL64 hash table flags. + +2001-08-27 Andreas Jaeger <aj@suse.de> + + * xcoff.h (struct __rtinit): Make proper prototype for rtl. + +Fri Aug 24 01:18:51 2001 J"orn Rennecke <amylaar@redhat.com> + + * internal.h (R_JMP2, R_JMPL2, R_MOVL2): Comment spelling fix. + 2001-04-05 Tom Rix <trix@redhat.com> * rs6000.h : move xcoff32 external structures from xcofflink. diff --git a/include/coff/arm.h b/include/coff/arm.h index 77830ca1f..bcfdcbe47 100644 --- a/include/coff/arm.h +++ b/include/coff/arm.h @@ -1,5 +1,5 @@ /* ARM COFF support for BFD. - Copyright 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1998, 1999, 2000, 2002 Free Software Foundation, Inc. This file is part of BFD, the Binary File Descriptor library. @@ -50,6 +50,7 @@ #define F_APCS_26 (0x0400) #define F_APCS_SET (0x0800) #define F_SOFT_FLOAT (0x2000) +#define F_VFP_FLOAT (0x4000) /* Bits stored in flags field of the internal_f structure */ diff --git a/include/coff/external.h b/include/coff/external.h index 6fd41f19c..19636dab7 100644 --- a/include/coff/external.h +++ b/include/coff/external.h @@ -113,12 +113,12 @@ struct external_lineno #define LINESZ (4 + L_LNNO_SIZE) #if L_LNNO_SIZE == 4 -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_32 (abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd, val, ext) bfd_h_put_32 (abfd, val, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO(abfd, ext) H_GET_32 (abfd, (ext->l_lnno)) +#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_32 (abfd, val, (ext->l_lnno)) #endif #if L_LNNO_SIZE == 2 -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16 (abfd, (bfd_byte *) (ext->l_lnno)); -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16 (abfd,val, (bfd_byte *) (ext->l_lnno)); +#define GET_LINENO_LNNO(abfd, ext) H_GET_16 (abfd, (ext->l_lnno)) +#define PUT_LINENO_LNNO(abfd, val, ext) H_PUT_16 (abfd, val, (ext->l_lnno)) #endif #endif /* not DO_NOT_DEFINE_LINENO */ diff --git a/include/coff/internal.h b/include/coff/internal.h index bc62b06f9..4babbd4de 100644 --- a/include/coff/internal.h +++ b/include/coff/internal.h @@ -639,7 +639,7 @@ struct internal_reloc #define R_JMP1 0x43 /* This reloc identifies a bra with an 8-bit pc-relative - target that was formerlly a jmp insn with a 16bit target. */ + target that was formerly a jmp insn with a 16bit target. */ #define R_JMP2 0x44 /* ??? */ @@ -651,7 +651,7 @@ struct internal_reloc #define R_JMPL1 0x46 /* This reloc identifies a bra with an 8-bit pc-relative - target that was formerlly a jmp insn with a 24bit target. */ + target that was formerly a jmp insn with a 24bit target. */ #define R_JMPL2 0x47 /* This reloc identifies mov.b instructions with a 24bit absolute @@ -679,7 +679,7 @@ struct internal_reloc insn with a 16bit absolute address. */ #define R_MOVL1 0x4c -/* This reloc identifies mov.[wl] insns which formerlly had +/* This reloc identifies mov.[wl] insns which formerly had a 32/24bit absolute address and now have a 16bit absolute address. */ #define R_MOVL2 0x4d diff --git a/include/coff/m88k.h b/include/coff/m88k.h index 3863564a0..331d97c92 100644 --- a/include/coff/m88k.h +++ b/include/coff/m88k.h @@ -158,20 +158,22 @@ union external_auxent } x_tv; /* info about .tv section (in auxent of symbol .tv)) */ }; -#define GET_FCN_LNNOPTR(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *)ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define GET_FCN_ENDNDX(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define PUT_FCN_LNNOPTR(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_lnnoptr) -#define PUT_FCN_ENDNDX(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_fcnary.x_fcn.x_endndx) -#define GET_LNSZ_SIZE(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_LNSZ_LNNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_LNNO(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_lnno) -#define PUT_LNSZ_SIZE(abfd, in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_sym.x_misc.x_lnsz.x_size) -#define GET_SCN_SCNLEN(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_scnlen) -#define GET_SCN_NRELOC(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nreloc) -#define GET_SCN_NLINNO(abfd, ext) bfd_h_get_32(abfd, (bfd_byte *) ext->x_scn.x_nlinno) -#define PUT_SCN_SCNLEN(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *) ext->x_scn.x_scnlen) -#define PUT_SCN_NRELOC(abfd,in, ext) bfd_h_put_32(abfd, in, (bfd_byte *)ext->x_scn.x_nreloc) -#define PUT_SCN_NLINNO(abfd,in, ext) bfd_h_put_32(abfd,in, (bfd_byte *) ext->x_scn.x_nlinno) +#define GET_LNSZ_SIZE(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_LNSZ_LNNO(abfd, ext) \ + H_GET_32 (abfd, ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_LNNO(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_lnno) +#define PUT_LNSZ_SIZE(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_sym.x_misc.x_lnsz.x_size) +#define GET_SCN_NRELOC(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_nreloc) +#define GET_SCN_NLINNO(abfd, ext) \ + H_GET_32 (abfd, ext->x_scn.x_nlinno) +#define PUT_SCN_NRELOC(abfd, in, ext) \ + H_PUT_32 (abfd, in, ext->x_scn.x_nreloc) +#define PUT_SCN_NLINNO(abfd, in, ext) \ + H_PUT_32 (abfd,in, ext->x_scn.x_nlinno) #define SYMENT struct external_syment #define SYMESZ 20 diff --git a/include/coff/or32.h b/include/coff/or32.h new file mode 100644 index 000000000..c2797aa90 --- /dev/null +++ b/include/coff/or32.h @@ -0,0 +1,287 @@ +/* COFF specification for OpenRISC 1000. + Copyright (C) 1993-2000, 2002 Free Software Foundation, Inc. + Contributed by David Wood @ New York University. + Modified by Johan Rydberg, <johan.rydberg@netinsight.se> + + 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 + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +#ifndef OR32 +# define OR32 +#endif + +/* File Header and related definitions. */ +struct external_filehdr +{ + char f_magic[2]; /* magic number */ + char f_nscns[2]; /* number of sections */ + char f_timdat[4]; /* time & date stamp */ + char f_symptr[4]; /* file pointer to symtab */ + char f_nsyms[4]; /* number of symtab entries */ + char f_opthdr[2]; /* sizeof(optional hdr) */ + char f_flags[2]; /* flags */ +}; + +#define FILHDR struct external_filehdr +#define FILHSZ 20 + +/* Magic numbers for OpenRISC 1000. As it is know we use the + numbers for Am29000. + + (AT&T will assign the "real" magic number). */ +#define SIPFBOMAGIC 0572 /* Am29000 (Byte 0 is MSB). */ +#define SIPRBOMAGIC 0573 /* Am29000 (Byte 0 is LSB). */ + +#define OR32_MAGIC_BIG SIPFBOMAGIC +#define OR32_MAGIC_LITTLE SIPRBOMAGIC +#define OR32BADMAG(x) (((x).f_magic!=OR32_MAGIC_BIG) && \ + ((x).f_magic!=OR32_MAGIC_LITTLE)) + +#define OMAGIC OR32_MAGIC_BIG + +/* Optional (a.out) header. */ +typedef struct external_aouthdr +{ + char magic[2]; /* type of file */ + char vstamp[2]; /* version stamp */ + char tsize[4]; /* text size in bytes, padded to FW bdry */ + char dsize[4]; /* initialized data " " */ + char bsize[4]; /* uninitialized data " " */ + char entry[4]; /* entry pt. */ + char text_start[4]; /* base of text used for this file */ + char data_start[4]; /* base of data used for this file */ +} AOUTHDR; + +#define AOUTSZ 28 +#define AOUTHDRSZ 28 + +/* aouthdr magic numbers. */ +#define NMAGIC 0410 /* separate i/d executable. */ +#define SHMAGIC 0406 /* NYU/Ultra3 shared data executable + (writable text). */ + +#define _ETEXT "_etext" + +/* Section header and related definitions. */ +struct external_scnhdr +{ + char s_name[8]; /* section name */ + char s_paddr[4]; /* physical address, aliased s_nlib */ + char s_vaddr[4]; /* virtual address */ + char s_size[4]; /* section size */ + char s_scnptr[4]; /* file ptr to raw data for section */ + char s_relptr[4]; /* file ptr to relocation */ + char s_lnnoptr[4]; /* file ptr to line numbers */ + char s_nreloc[2]; /* number of relocation entries */ + char s_nlnno[2]; /* number of line number entries */ + char s_flags[4]; /* flags */ +}; + +#define SCNHDR struct external_scnhdr +#define SCNHSZ 40 + +/* Names of "special" sections: */ +#define _TEXT ".text" +#define _DATA ".data" +#define _BSS ".bss" +#define _LIT ".lit" + +/* Section types - with additional section type for global + registers which will be relocatable for the OpenRISC 1000. + + In instances where it is necessary for a linker to produce an + output file which contains text or data not based at virtual + address 0, e.g. for a ROM, then the linker should accept + address base information as command input and use PAD sections + to skip over unused addresses. */ +#define STYP_BSSREG 0x1200 /* Global register area (like STYP_INFO) */ +#define STYP_ENVIR 0x2200 /* Environment (like STYP_INFO) */ +#define STYP_ABS 0x4000 /* Absolute (allocated, not reloc, loaded) */ + +/* Relocation information declaration and related definitions: */ +struct external_reloc +{ + char r_vaddr[4]; /* (virtual) address of reference */ + char r_symndx[4]; /* index into symbol table */ + char r_type[2]; /* relocation type */ +}; + +#define RELOC struct external_reloc +#define RELSZ 10 /* sizeof (RELOC) */ + +/* Relocation types for the OpenRISC 1000: */ + +#define R_ABS 0 /* reference is absolute */ +#define R_IREL 030 /* instruction relative (jmp/call) */ +#define R_IABS 031 /* instruction absolute (jmp/call) */ +#define R_ILOHALF 032 /* instruction low half (const) */ +#define R_IHIHALF 033 /* instruction high half (consth) part 1 */ +#define R_IHCONST 034 /* instruction high half (consth) part 2 */ + /* constant offset of R_IHIHALF relocation */ +#define R_BYTE 035 /* relocatable byte value */ +#define R_HWORD 036 /* relocatable halfword value */ +#define R_WORD 037 /* relocatable word value */ + +#define R_IGLBLRC 040 /* instruction global register RC */ +#define R_IGLBLRA 041 /* instruction global register RA */ +#define R_IGLBLRB 042 /* instruction global register RB */ + +/* + NOTE: + All the "I" forms refer to 29000 instruction formats. The linker is + expected to know how the numeric information is split and/or aligned + within the instruction word(s). R_BYTE works for instructions, too. + + If the parameter to a CONSTH instruction is a relocatable type, two + relocation records are written. The first has an r_type of R_IHIHALF + (33 octal) and a normal r_vaddr and r_symndx. The second relocation + record has an r_type of R_IHCONST (34 octal), a normal r_vaddr (which + is redundant), and an r_symndx containing the 32-bit constant offset + to the relocation instead of the actual symbol table index. This + second record is always written, even if the constant offset is zero. + The constant fields of the instruction are set to zero. */ + +/* Line number entry declaration and related definitions: */ +struct external_lineno +{ + union + { + char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/ + char l_paddr[4]; /* (physical) address of line number */ + } + l_addr; + + char l_lnno[2]; /* line number */ +}; + +#define LINENO struct external_lineno +#define LINESZ 6 /* sizeof (LINENO) */ + +/* Symbol entry declaration and related definitions: */ +#define E_SYMNMLEN 8 /* Number of characters in a symbol name */ + +struct external_syment +{ + union + { + char e_name[E_SYMNMLEN]; + struct + { + char e_zeroes[4]; + char e_offset[4]; + } + e; + } + e; + + char e_value[4]; + char e_scnum[2]; + char e_type[2]; + char e_sclass[1]; + char e_numaux[1]; +}; + +#define SYMENT struct external_syment +#define SYMESZ 18 + +/* Storage class definitions - new classes for global registers: */ +#define C_GLBLREG 19 /* global register */ +#define C_EXTREG 20 /* external global register */ +#define C_DEFREG 21 /* ext. def. of global register */ + +/* Derived symbol mask/shifts: */ +#define N_BTMASK (0xf) +#define N_BTSHFT (4) +#define N_TMASK (0x30) +#define N_TSHIFT (2) + +/* Auxiliary symbol table entry declaration and related + definitions. */ +#define E_FILNMLEN 14 /* # characters in a file name */ +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +union external_auxent +{ + struct + { + char x_tagndx[4]; /* str, un, or enum tag indx */ + union + { + struct + { + char x_lnno[2]; /* declaration line number */ + char x_size[2]; /* str/union/array size */ + } + x_lnsz; + + char x_fsize[4]; /* size of function */ + } + x_misc; + + union + { + struct /* if ISFCN, tag, or .bb */ + { + char x_lnnoptr[4]; /* ptr to fcn line # */ + char x_endndx[4]; /* entry ndx past block end */ + } + x_fcn; + + struct /* if ISARY, up to 4 dimen. */ + { + char x_dimen[E_DIMNUM][2]; + } + x_ary; + } + x_fcnary; + + char x_tvndx[2]; /* tv index */ + } + x_sym; + + union + { + char x_fname[E_FILNMLEN]; + + struct + { + char x_zeroes[4]; + char x_offset[4]; + } + x_n; + } + x_file; + + struct + { + char x_scnlen[4]; /* section length */ + char x_nreloc[2]; /* # relocation entries */ + char x_nlinno[2]; /* # line numbers */ + } + x_scn; + + struct + { + char x_tvfill[4]; /* tv fill value */ + char x_tvlen[2]; /* length of .tv */ + char x_tvran[2][2]; /* tv range */ + } + x_tv; /* info about .tv section + (in auxent of symbol .tv)) */ +}; + +#define AUXENT union external_auxent +#define AUXESZ 18 diff --git a/include/coff/ti.h b/include/coff/ti.h index 57e0dec80..d98fc89bd 100644 --- a/include/coff/ti.h +++ b/include/coff/ti.h @@ -91,17 +91,23 @@ struct external_filehdr /* we need to read/write an extra field in the coff file header */ #ifndef COFF_ADJUST_FILEHDR_IN_POST -#define COFF_ADJUST_FILEHDR_IN_POST(abfd,src,dst) \ -do { ((struct internal_filehdr *)(dst))->f_target_id = \ -bfd_h_get_16(abfd, (bfd_byte *)(((FILHDR *)(src))->f_target_id)); \ -} while(0) +#define COFF_ADJUST_FILEHDR_IN_POST(abfd, src, dst) \ + do \ + { \ + ((struct internal_filehdr *)(dst))->f_target_id = \ + H_GET_16 (abfd, ((FILHDR *)(src))->f_target_id); \ + } \ + while (0) #endif #ifndef COFF_ADJUST_FILEHDR_OUT_POST -#define COFF_ADJUST_FILEHDR_OUT_POST(abfd,src,dst) \ -do { bfd_h_put_16(abfd, ((struct internal_filehdr *)(src))->f_target_id, \ - (bfd_byte *)(((FILHDR *)(dst))->f_target_id)); \ -} while(0) +#define COFF_ADJUST_FILEHDR_OUT_POST(abfd, src, dst) \ + do \ + { \ + H_PUT_16 (abfd, ((struct internal_filehdr *)(src))->f_target_id, \ + ((FILHDR *)(dst))->f_target_id); \ + } \ + while (0) #endif #define FILHDR struct external_filehdr @@ -200,74 +206,59 @@ struct external_scnhdr { Assume we're dealing with the COFF2 scnhdr structure, and adjust accordingly */ -#define GET_SCNHDR_NRELOC(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, PTR)) -#define PUT_SCNHDR_NRELOC(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,PTR)) -#define GET_SCNHDR_NLNNO(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-2)) -#define PUT_SCNHDR_NLNNO(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-2)) -#define GET_SCNHDR_FLAGS(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_32 (ABFD,PTR) : bfd_h_get_16 (ABFD, (PTR)-4)) -#define PUT_SCNHDR_FLAGS(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_32 (ABFD,VAL,PTR) : bfd_h_put_16 (ABFD,VAL,(PTR)-4)) -#define GET_SCNHDR_PAGE(ABFD,PTR) \ -(COFF2_P(ABFD) ? bfd_h_get_16 (ABFD,PTR) : bfd_h_get_8 (ABFD, (PTR)-7)) +#define GET_SCNHDR_NRELOC(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, PTR)) +#define PUT_SCNHDR_NRELOC(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, PTR)) +#define GET_SCNHDR_NLNNO(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -2)) +#define PUT_SCNHDR_NLNNO(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -2)) +#define GET_SCNHDR_FLAGS(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_32 (ABFD, PTR) : H_GET_16 (ABFD, (PTR) -4)) +#define PUT_SCNHDR_FLAGS(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) ? H_PUT_32 (ABFD, VAL, PTR) : H_PUT_16 (ABFD, VAL, (PTR) -4)) +#define GET_SCNHDR_PAGE(ABFD, PTR) \ + (COFF2_P (ABFD) ? H_GET_16 (ABFD, PTR) : (unsigned) H_GET_8 (ABFD, (PTR) -7)) /* on output, make sure that the "reserved" field is zero */ -#define PUT_SCNHDR_PAGE(ABFD,VAL,PTR) \ -(COFF2_P(ABFD) ? bfd_h_put_16 (ABFD,VAL,PTR) : \ -bfd_h_put_8 (ABFD,VAL,(PTR)-7), bfd_h_put_8 (ABFD, 0, (PTR)-8)) +#define PUT_SCNHDR_PAGE(ABFD, VAL, PTR) \ + (COFF2_P (ABFD) \ + ? H_PUT_16 (ABFD, VAL, PTR) \ + : H_PUT_8 (ABFD, VAL, (PTR) -7), H_PUT_8 (ABFD, 0, (PTR) -8)) /* TI COFF stores section size as number of bytes (address units, not octets), so adjust to be number of octets, which is what BFD expects */ -#define GET_SCNHDR_SIZE(ABFD,SZP) \ -(bfd_h_get_32(ABFD,SZP)*bfd_octets_per_byte(ABFD)) -#define PUT_SCNHDR_SIZE(ABFD,SZ,SZP) \ -bfd_h_put_32(ABFD,(SZ)/bfd_octets_per_byte(ABFD),SZP) - -#define COFF_ADJUST_SCNHDR_IN_POST(ABFD,EXT,INT) \ -do { ((struct internal_scnhdr *)(INT))->s_page = \ -GET_SCNHDR_PAGE(ABFD,(bfd_byte *)((SCNHDR *)(EXT))->s_page); \ -} while(0) +#define GET_SCNHDR_SIZE(ABFD, SZP) \ + (H_GET_32 (ABFD, SZP) * bfd_octets_per_byte (ABFD)) +#define PUT_SCNHDR_SIZE(ABFD, SZ, SZP) \ + H_PUT_32 (ABFD, (SZ) / bfd_octets_per_byte (ABFD), SZP) + +#define COFF_ADJUST_SCNHDR_IN_POST(ABFD, EXT, INT) \ + do \ + { \ + ((struct internal_scnhdr *)(INT))->s_page = \ + GET_SCNHDR_PAGE (ABFD, ((SCNHDR *)(EXT))->s_page); \ + } \ + while (0) /* The line number and reloc overflow checking in coff_swap_scnhdr_out in coffswap.h doesn't use PUT_X for s_nlnno and s_nreloc. Due to different sized v0/v1/v2 section headers, we have to re-write these fields. */ -#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD,INT,EXT) \ -do { \ -PUT_SCNHDR_NLNNO(ABFD,((struct internal_scnhdr *)(INT))->s_nlnno,\ - (bfd_byte *)((SCNHDR *)(EXT))->s_nlnno); \ -PUT_SCNHDR_NRELOC(ABFD,((struct internal_scnhdr *)(INT))->s_nreloc,\ - (bfd_byte *)((SCNHDR *)(EXT))->s_nreloc); \ -PUT_SCNHDR_FLAGS(ABFD,((struct internal_scnhdr *)(INT))->s_flags, \ - (bfd_byte *)((SCNHDR *)(EXT))->s_flags); \ -PUT_SCNHDR_PAGE(ABFD,((struct internal_scnhdr *)(INT))->s_page, \ - (bfd_byte *)((SCNHDR *)(EXT))->s_page); \ -} while(0) - -/* Page macros - - The first GDB port requires flags in its remote memory access commands to - distinguish between data/prog space. Hopefully we can make this go away - eventually. Stuff the page in the upper bits of a 32-bit address, since - the c5x family only uses 16 or 23 bits. - - c2x, c5x and most c54x devices have 16-bit addresses, but the c548 has - 23-bit program addresses. Make sure the page flags don't interfere. - These flags are used by GDB to identify the destination page for - addresses. -*/ - -/* recognized load pages */ -#define PG_PROG 0x0 /* PROG page */ -#define PG_DATA 0x1 /* DATA page */ - -#define ADDR_MASK 0x00FFFFFF -#define PG_TO_FLAG(p) (((unsigned long)(p) & 0xFF) << 24) -#define FLAG_TO_PG(f) (((f) >> 24) & 0xFF) +#define COFF_ADJUST_SCNHDR_OUT_POST(ABFD, INT, EXT) \ + do \ + { \ + PUT_SCNHDR_NLNNO (ABFD, ((struct internal_scnhdr *)(INT))->s_nlnno, \ + ((SCNHDR *)(EXT))->s_nlnno); \ + PUT_SCNHDR_NRELOC (ABFD, ((struct internal_scnhdr *)(INT))->s_nreloc,\ + ((SCNHDR *)(EXT))->s_nreloc); \ + PUT_SCNHDR_FLAGS (ABFD, ((struct internal_scnhdr *)(INT))->s_flags, \ + ((SCNHDR *)(EXT))->s_flags); \ + PUT_SCNHDR_PAGE (ABFD, ((struct internal_scnhdr *)(INT))->s_page, \ + ((SCNHDR *)(EXT))->s_page); \ + } \ + while (0) /* * names of "special" sections @@ -386,40 +377,58 @@ union external_auxent { #define AUXESZ 18 /* section lengths are in target bytes (not host bytes) */ -#define GET_SCN_SCNLEN(ABFD,EXT) \ -(bfd_h_get_32(ABFD,(bfd_byte *)(EXT)->x_scn.x_scnlen)*bfd_octets_per_byte(ABFD)) -#define PUT_SCN_SCNLEN(ABFD,INT,EXT) \ -bfd_h_put_32(ABFD,(INT)/bfd_octets_per_byte(ABFD),\ - (bfd_byte *)(EXT)->x_scn.x_scnlen) +#define GET_SCN_SCNLEN(ABFD, EXT) \ + (H_GET_32 (ABFD, (EXT)->x_scn.x_scnlen) * bfd_octets_per_byte (ABFD)) +#define PUT_SCN_SCNLEN(ABFD, INT, EXT) \ + H_PUT_32 (ABFD, (INT) / bfd_octets_per_byte (ABFD), (EXT)->x_scn.x_scnlen) /* lnsz size is in bits in COFF file, in bytes in BFD */ #define GET_LNSZ_SIZE(abfd, ext) \ -(bfd_h_get_16(abfd, (bfd_byte *)ext->x_sym.x_misc.x_lnsz.x_size) / \ - (class != C_FIELD ? 8 : 1)) + (H_GET_16 (abfd, ext->x_sym.x_misc.x_lnsz.x_size) / (class != C_FIELD ? 8 : 1)) #define PUT_LNSZ_SIZE(abfd, in, ext) \ - bfd_h_put_16(abfd, ((class != C_FIELD) ? (in)*8 : (in)), \ - (bfd_byte*) ext->x_sym.x_misc.x_lnsz.x_size) + H_PUT_16 (abfd, ((class != C_FIELD) ? (in) * 8 : (in)), \ + ext->x_sym.x_misc.x_lnsz.x_size) -/* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes */ -#define COFF_ADJUST_SYM_IN_POST(ABFD,EXT,INT) \ -do { struct internal_syment *dst = (struct internal_syment *)(INT); \ -if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) dst->n_value /= 8; \ -} while (0) - -#define COFF_ADJUST_SYM_OUT_POST(ABFD,INT,EXT) \ -do { struct internal_syment *src = (struct internal_syment *)(INT); \ -SYMENT *dst = (SYMENT *)(EXT); \ -if(src->n_sclass == C_MOU || src->n_sclass == C_MOS) \ -bfd_h_put_32(abfd,src->n_value * 8,(bfd_byte *)dst->e_value); \ -} while (0) +/* TI COFF stores offsets for MOS and MOU in bits; BFD expects bytes + Also put the load page flag of the section into the symbol value if it's an + address. */ +#ifndef NEEDS_PAGE +#define NEEDS_PAGE(X) 0 +#define PAGE_MASK 0 +#endif +#define COFF_ADJUST_SYM_IN_POST(ABFD, EXT, INT) \ + do \ + { \ + struct internal_syment *dst = (struct internal_syment *)(INT); \ + if (dst->n_sclass == C_MOS || dst->n_sclass == C_MOU) \ + dst->n_value /= 8; \ + else if (NEEDS_PAGE (dst->n_sclass)) { \ + asection *scn = coff_section_from_bfd_index (abfd, dst->n_scnum); \ + dst->n_value |= (scn->lma & PAGE_MASK); \ + } \ + } \ + while (0) + +#define COFF_ADJUST_SYM_OUT_POST(ABFD, INT, EXT) \ + do \ + { \ + struct internal_syment *src = (struct internal_syment *)(INT); \ + SYMENT *dst = (SYMENT *)(EXT); \ + if (src->n_sclass == C_MOU || src->n_sclass == C_MOS) \ + H_PUT_32 (abfd, src->n_value * 8, dst->e_value); \ + else if (NEEDS_PAGE (src->n_sclass)) { \ + H_PUT_32 (abfd, src->n_value &= ~PAGE_MASK, dst->e_value); \ + } \ + } \ + while (0) /* Detect section-relative absolute symbols so they get flagged with a sym index of -1. */ -#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC,SECT) \ -((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \ - && (RELOC)->howto->name[0] == 'A') +#define SECTION_RELATIVE_ABSOLUTE_SYMBOL_P(RELOC, SECT) \ + ((*(RELOC)->sym_ptr_ptr)->section->output_section == (SECT) \ + && (RELOC)->howto->name[0] == 'A') /********************** RELOCATION DIRECTIVES **********************/ diff --git a/include/coff/tic54x.h b/include/coff/tic54x.h index a41c8d250..a7b7003a9 100644 --- a/include/coff/tic54x.h +++ b/include/coff/tic54x.h @@ -18,8 +18,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef COFF_TIC54X_H - #define COFF_TIC54X_H + #define TIC54X_TARGET_ID 0x98 #define TIC54XALGMAGIC 0x009B /* c54x algebraic assembler output */ #define TIC5X_TARGET_ID 0x92 @@ -29,6 +29,31 @@ #define TICOFF_TARGET_ARCH bfd_arch_tic54x #define TICOFF_DEFAULT_MAGIC TICOFF1MAGIC /* we use COFF1 for compatibility */ +/* Page macros + + The first GDB port requires flags in its remote memory access commands to + distinguish between data/prog space. Hopefully we can make this go away + eventually. Stuff the page in the upper bits of a 32-bit address, since + the c5x family only uses 16 or 23 bits. + + c2x, c5x and most c54x devices have 16-bit addresses, but the c548 has + 23-bit program addresses. Make sure the page flags don't interfere. + These flags are used by GDB to identify the destination page for + addresses. +*/ + +/* Recognized load pages (by common convention). */ +#define PG_PROG 0x0 /* PROG page */ +#define PG_DATA 0x1 /* DATA page */ +#define PG_IO 0x2 /* I/O page */ + +/** Indicate whether the given storage class requires a page flag. */ +#define NEEDS_PAGE(X) ((X)==C_EXT) +#define PAGE_MASK 0xFF000000 +#define ADDR_MASK 0x00FFFFFF +#define PG_TO_FLAG(p) (((unsigned long)(p) & 0xFF) << 24) +#define FLAG_TO_PG(f) (((f) >> 24) & 0xFF) + #include "coff/ti.h" #endif /* COFF_TIC54X_H */ diff --git a/include/coff/xcoff.h b/include/coff/xcoff.h index bc1ee5cb2..0bb9d6c1e 100644 --- a/include/coff/xcoff.h +++ b/include/coff/xcoff.h @@ -1,6 +1,7 @@ /* Internal format of XCOFF object file data structures for BFD. - Copyright 1995, 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by Ian Lance Taylor <ian@cygnus.com>, Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -22,18 +23,16 @@ #ifndef _INTERNAL_XCOFF_H #define _INTERNAL_XCOFF_H -/* - * LINKER - */ +/* Linker */ -/* - * names of "special" sections - */ +/* Names of "special" sections. */ #define _TEXT ".text" #define _DATA ".data" #define _BSS ".bss" #define _PAD ".pad" #define _LOADER ".loader" +#define _EXCEPT ".except" +#define _TYPCHK ".typchk" /* XCOFF uses a special .loader section with type STYP_LOADER. */ #define STYP_LOADER 0x1000 @@ -45,11 +44,19 @@ another section header with STYP_OVRFLO set. */ #define STYP_OVRFLO 0x8000 +/* 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 + #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 */ @@ -77,22 +84,15 @@ #define R_RBR (0x1a) #define R_RBRC (0x1b) +/* Storage class #defines, from /usr/include/storclass.h that are not already + defined in internal.h */ -/* - * Storage class #defines, from /usr/include/storclass.h - * That are not already defined in internal.h - */ -#define C_INFO 110 /* Comment string in .info section */ +/* Comment string in .info section */ +#define C_INFO 110 - -/* - * AUXILLARY SYMBOL ENTRIES - * - * auxemt - */ +/* Auxillary Symbol Entries */ /* x_smtyp values: */ - #define SMTYP_ALIGN(x) ((x) >> 3) /* log2 of alignment */ #define SMTYP_SMTYP(x) ((x) & 0x7) /* symbol type */ /* Symbol type values: */ @@ -104,7 +104,6 @@ #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 */ @@ -122,36 +121,45 @@ /* 14 ??? */ #define XMC_TC0 15 /* Read-write TOC anchor */ #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 */ /* The ldhdr structure. This appears at the start of the .loader section. */ struct internal_ldhdr { - /* - * The version number: - * 1 : 32 bit - * 2 : 64 bit - */ + /* The version number: + 1 : 32 bit + 2 : 64 bit */ unsigned long l_version; + /* The number of symbol table entries. */ bfd_size_type l_nsyms; + /* The number of relocation table entries. */ bfd_size_type l_nreloc; + /* The length of the import file string table. */ bfd_size_type l_istlen; + /* The number of import files. */ bfd_size_type l_nimpid; + /* The offset from the start of the .loader section to the first entry in the import file table. */ bfd_size_type l_impoff; + /* The length of the string table. */ bfd_size_type l_stlen; + /* The offset from the start of the .loader section to the first entry in the string table. */ bfd_size_type l_stoff; + /* The offset to start of the symbol table, only in XCOFF64 */ bfd_vma l_symoff; + /* The offset to the start of the relocation table, only in XCOFF64 */ bfd_vma l_rldoff; }; @@ -162,28 +170,37 @@ struct internal_ldhdr struct internal_ldsym { union + { + /* The symbol name if <= SYMNMLEN characters. */ + char _l_name[SYMNMLEN]; + struct { - /* The symbol name if <= SYMNMLEN characters. */ - char _l_name[SYMNMLEN]; - struct - { - /* 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; + /* 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; + /* The symbol value. */ bfd_vma l_value; + /* The symbol section number. */ short l_scnum; + /* The symbol type and flags. */ char l_smtype; + /* The symbol storage class. */ char l_smclas; + /* The import file ID. */ bfd_size_type l_ifile; + /* Offset to the parameter type check string. */ bfd_size_type l_parm; }; @@ -205,10 +222,13 @@ struct internal_ldrel { /* The reloc address. */ bfd_vma l_vaddr; + /* The symbol table index in the .loader section symbol table. */ bfd_size_type l_symndx; + /* The relocation type and size. */ short l_rtype; + /* The section number this relocation applies to. */ short l_rsecnm; }; @@ -227,14 +247,16 @@ struct xcoff_link_hash_entry asection *toc_section; union - { - /* 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; + { + /* 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; /* If this symbol is a function entry point which is called, this field holds a pointer to the function descriptor. If this symbol @@ -257,72 +279,42 @@ struct xcoff_link_hash_entry unsigned char smclas; }; -/* - * #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 - * - */ +/* Flags for xcoff_link_hash_entry. */ +/* Symbol is referenced by a regular object. */ #define XCOFF_REF_REGULAR 0x00000001 +/* Symbol is defined by a regular object. */ #define XCOFF_DEF_REGULAR 0x00000002 +/* Symbol is defined by a dynamic object. */ #define XCOFF_DEF_DYNAMIC 0x00000004 +/* Symbol is used in a reloc being copied into the .loader section. */ #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. */ #define XCOFF_CALLED 0x00000020 +/* Symbol needs the TOC entry filled in. */ #define XCOFF_SET_TOC 0x00000040 +/* Symbol is explicitly imported. */ #define XCOFF_IMPORT 0x00000080 +/* Symbol is explicitly exported. */ #define XCOFF_EXPORT 0x00000100 +/* Symbol has been processed by xcoff_build_ldsyms. */ #define XCOFF_BUILT_LDSYM 0x00000200 +/* Symbol is mentioned by a section which was not garbage collected. */ #define XCOFF_MARK 0x00000400 +/* Symbol size is recorded in size_list list from hash table. */ #define XCOFF_HAS_SIZE 0x00000800 +/* Symbol is a function descriptor. */ #define XCOFF_DESCRIPTOR 0x00001000 +/* Multiple definitions have been for the symbol. */ #define XCOFF_MULTIPLY_DEFINED 0x00002000 +/* Symbol is the __rtinit symbol. */ #define XCOFF_RTINIT 0x00004000 - +/* Symbol is an imported 32 bit syscall. */ +#define XCOFF_SYSCALL32 0x00008000 +/* Symbol is an imported 64 bit syscall. */ +#define XCOFF_SYSCALL64 0x00010000 /* The XCOFF linker hash table. */ @@ -381,11 +373,12 @@ struct xcoff_link_hash_table /* 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; + { + 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]; @@ -399,61 +392,77 @@ struct xcoff_loader_info { /* Set if a problem occurred. */ boolean failed; + /* Output BFD. */ bfd *output_bfd; + /* Link information structure. */ struct bfd_link_info *info; + /* Whether all defined symbols should be exported. */ boolean export_defineds; + /* Number of ldsym structures. */ size_t ldsym_count; + /* Size of string table. */ size_t string_size; + /* String table. */ bfd_byte *strings; + /* 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. */ -#define MINUS_ONE (((bfd_vma)0) - 1) - - -/* - * __rtinit - * from /usr/include/rtinit.h - */ -struct __rtinit { - int (*rtl)(); /* Pointer to runtime linker */ - int init_offset; /* Offset to array of init functions - (0 if none). */ - 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 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. */ + int init_offset; + + /* Offset to array of fini functions, 0 if none. */ + int fini_offset; + + /* Size of __RTINIT_DESCRIPTOR. This value should be used instead of + sizeof(__RTINIT_DESCRIPTOR). */ + int __rtinit_descriptor_size; }; #define RTINIT_DESCRIPTOR_SIZE (12) -struct __rtinit_descriptor { - int f; /* Init/fini function. */ - int name_offset; /* Offset (within __rtinit symbol) - to name of function. */ - unsigned char flags; /* Flags */ -}; +struct __rtinit_descriptor +{ + /* Init/fini function. */ + int f; + /* Offset, relative to the start of the __rtinit symbol, to name of the + function. */ + int name_offset; -/* - * ARCHIVE - */ + /* Flags */ + unsigned char flags; +}; + +/* Archive */ #define XCOFFARMAG "<aiaff>\012" #define XCOFFARMAGBIG "<bigaf>\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" @@ -467,23 +476,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. */ @@ -493,42 +502,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]; @@ -553,20 +561,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]; @@ -591,13 +599,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. + <bigaf> 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)) || \ + ((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) \ - (xcoff_ardata (abfd)->magic[1] == 'b') + (((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. */ |