diff options
author | obrien <obrien@FreeBSD.org> | 2002-01-27 12:00:11 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-01-27 12:00:11 +0000 |
commit | 2c76fd68f4fb39c1af5cde1a8eac2bdd7b3f9909 (patch) | |
tree | d0fb877bb74b99ef3fc1c560a6340040f60f0392 /contrib/binutils/include/coff | |
parent | ea6b809e7d17f67670458d8b26735098ed0ec32a (diff) | |
parent | fc89183cdc6be5afa8deb7250fd15a20832ab528 (diff) | |
download | FreeBSD-src-2c76fd68f4fb39c1af5cde1a8eac2bdd7b3f9909.zip FreeBSD-src-2c76fd68f4fb39c1af5cde1a8eac2bdd7b3f9909.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r89857,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/binutils/include/coff')
-rw-r--r-- | contrib/binutils/include/coff/ChangeLog | 110 | ||||
-rw-r--r-- | contrib/binutils/include/coff/alpha.h | 16 | ||||
-rw-r--r-- | contrib/binutils/include/coff/arm.h | 223 | ||||
-rw-r--r-- | contrib/binutils/include/coff/external.h | 254 | ||||
-rw-r--r-- | contrib/binutils/include/coff/i386.h | 195 | ||||
-rw-r--r-- | contrib/binutils/include/coff/ia64.h | 162 | ||||
-rw-r--r-- | contrib/binutils/include/coff/internal.h | 82 | ||||
-rw-r--r-- | contrib/binutils/include/coff/powerpc.h | 175 | ||||
-rw-r--r-- | contrib/binutils/include/coff/rs6000.h | 72 | ||||
-rw-r--r-- | contrib/binutils/include/coff/rs6k64.h | 70 | ||||
-rw-r--r-- | contrib/binutils/include/coff/sh.h | 209 | ||||
-rw-r--r-- | contrib/binutils/include/coff/sparc.h | 85 | ||||
-rw-r--r-- | contrib/binutils/include/coff/ti.h | 219 |
13 files changed, 680 insertions, 1192 deletions
diff --git a/contrib/binutils/include/coff/ChangeLog b/contrib/binutils/include/coff/ChangeLog index efde1bf..b8882bc 100644 --- a/contrib/binutils/include/coff/ChangeLog +++ b/contrib/binutils/include/coff/ChangeLog @@ -1,17 +1,109 @@ -2001-06-11 Alan Modra <amodra@bigpond.net.au> +2001-12-24 Tom Rix <trix@redhat.com> - Merge from mainline. - 2001-02-09 David Mosberger <davidm@hpl.hp.com> - * pe.h (PEPAOUTSZ): Rename from PEP64AOUTSZ. - Rename from PEPAOUTHDR. + * 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. + +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-06-07 Alan Modra <amodra@bigpond.net.au> +2001-09-18 Alan Modra <amodra@bigpond.net.au> - * Many files: Update copyright notices. + * 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. + * rs6k64.h : move xcoff64 external structures from xcofflink. + * internal.h : promote 32 bit structure elements to 64 bit + for xcoff64 support + * xcoff.h : New file. + +2001-03-23 Nick Clifton <nickc@redhat.com> + + * a29k.h: Fix compile time warning. + * external.h: Fix compile time warning. + * m88k.h: Fix compile time warning. + +2001-03-13 Nick Clifton <nickc@redhat.com> + + * external.h: New file. Common structure definitions found in + other COFF header files. + + * a29k.h: Use external.h. + * apollo.h: Use external.h. + * arm.h: Use external.h. + * h8300.h: Use external.h. + * h8500.h: Use external.h. + * i386.h: Use external.h. + * i860.h: Use external.h. + * ia64.h: Use external.h. + * m68k.h: Use external.h. + * m88k.h: Use external.h. + * mcore.h: Use external.h. + * mips.h: Use external.h. + * mipspe.h: Use external.h. + * powerpc.h: Use external.h. + * rs6000.h: Use external.h. + * rs6k64.h: Use external.h. + * sh.h: Use external.h. + * sparc.h: Use external.h. + * tic30.h: Use external.h. + * tic80.h: Use external.h. + * w65.h: Use external.h. + * we32k.h: Use external.h. + * z8k.h: Use external.h. + +2001-02-09 David Mosberger <davidm@hpl.hp.com> + + * pe.h (PEPAOUTSZ): Rename from PEP64AOUTSZ. + Rename from PEPAOUTHDR. -2001-02-17 Philip Blundell <philb@gnu.org> +2001-01-23 H.J. Lu <hjl@gnu.org> - From 2001-01-23 H.J. Lu <hjl@gnu.org> * pe.h (struct external_PEI_DOS_hdr): New. (struct external_PEI_IMAGE_hdr): New. diff --git a/contrib/binutils/include/coff/alpha.h b/contrib/binutils/include/coff/alpha.h index 6cd915d..e5210a5 100644 --- a/contrib/binutils/include/coff/alpha.h +++ b/contrib/binutils/include/coff/alpha.h @@ -19,7 +19,8 @@ /********************** FILE HEADER **********************/ -struct external_filehdr { +struct external_filehdr +{ unsigned char f_magic[2]; /* magic number */ unsigned char f_nscns[2]; /* number of sections */ unsigned char f_timdat[4]; /* time & date stamp */ @@ -44,7 +45,6 @@ struct external_filehdr { /********************** AOUT "OPTIONAL HEADER" **********************/ - typedef struct external_aouthdr { unsigned char magic[2]; /* type of file */ @@ -70,7 +70,8 @@ typedef struct external_aouthdr /********************** SECTION HEADER **********************/ -struct external_scnhdr { +struct external_scnhdr +{ unsigned char s_name[8]; /* section name */ unsigned char s_paddr[8]; /* physical address, aliased s_nlib */ unsigned char s_vaddr[8]; /* virtual address */ @@ -88,7 +89,8 @@ struct external_scnhdr { /********************** RELOCATION DIRECTIVES **********************/ -struct external_reloc { +struct external_reloc +{ unsigned char r_vaddr[8]; unsigned char r_symndx[4]; unsigned char r_bits[4]; @@ -166,7 +168,8 @@ struct external_reloc { /* File header as a set of bytes */ -struct hdr_ext { +struct hdr_ext +{ unsigned char h_magic[2]; unsigned char h_vstamp[2]; unsigned char h_ilineMax[4]; @@ -196,7 +199,8 @@ struct hdr_ext { /* File descriptor external record */ -struct fdr_ext { +struct fdr_ext +{ unsigned char f_adr[8]; unsigned char f_cbLineOffset[8]; unsigned char f_cbLine[8]; diff --git a/contrib/binutils/include/coff/arm.h b/contrib/binutils/include/coff/arm.h index a0d8883..bcfdcbe 100644 --- a/contrib/binutils/include/coff/arm.h +++ b/contrib/binutils/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. @@ -19,33 +19,23 @@ #define COFFARM 1 -/********************** FILE HEADER **********************/ - -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 L_LNNO_SIZE 2 +#define INCLUDE_COMDAT_FIELDS_IN_AUXENT +#include "coff/external.h" /* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_INTERWORK file supports switching between ARM and Thumb instruction sets - * F_INTERWORK_SET the F_INTERWORK bit is valid - * F_APCS_FLOAT code passes float arguments in float registers - * F_PIC code is reentrant/position-independent - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - * F_APCS_26 file uses 26 bit ARM Procedure Calling Standard - * F_APCS_SET the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised - * F_SOFT_FLOAT code does not use floating point instructions - */ + F_RELFLG relocation info stripped from file + F_EXEC file is executable (no unresolved external references) + F_LNNO line numbers stripped from file + F_LSYMS local symbols stripped from file + F_INTERWORK file supports switching between ARM and Thumb instruction sets + F_INTERWORK_SET the F_INTERWORK bit is valid + F_APCS_FLOAT code passes float arguments in float registers + F_PIC code is reentrant/position-independent + F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) + F_APCS_26 file uses 26 bit ARM Procedure Calling Standard + F_APCS_SET the F_APCS_26, F_APCS_FLOAT and F_PIC bits have been initialised + F_SOFT_FLOAT code does not use floating point instructions. */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) @@ -60,6 +50,7 @@ struct external_filehdr #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 */ @@ -77,13 +68,12 @@ struct external_filehdr #define F_ARM_5 (0x4c00) /* - * ARMMAGIC ought to encoded the procesor type, - * but it is too late to change it now, instead - * the flags field of the internal_f structure - * is used as shown above. - * - * XXX - NC 5/6/97 - */ + ARMMAGIC ought to encoded the procesor type, + but it is too late to change it now, instead + the flags field of the internal_f structure + is used as shown above. + + XXX - NC 5/6/97. */ #define ARMMAGIC 0xa00 /* I just made this up */ @@ -95,36 +85,11 @@ struct external_filehdr #undef ARMBADMAG #define ARMBADMAG(x) (((x).f_magic != ARMMAGIC) && ((x).f_magic != ARMPEMAGIC) && ((x).f_magic != THUMBPEMAGIC)) -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - 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 - #define OMAGIC 0404 /* object files, eg as output */ #define ZMAGIC 0413 /* demand load format, eg normal ld output */ #define STMAGIC 0401 /* target shlib */ #define SHMAGIC 0443 /* host shlib */ - /* define some NT default values */ /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ #define NT_SECTION_ALIGNMENT 0x1000 @@ -132,151 +97,9 @@ AOUTHDR; #define NT_DEF_RESERVE 0x100000 #define NT_DEF_COMMIT 0x1000 -/********************** SECTION HEADER **********************/ -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 _COMMENT ".comment" -#define _LIB ".lib" - /* We use the .rdata section to hold read only data. */ #define _LIT ".rdata" -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -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 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -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 N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } 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 SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - -#define _ETEXT "etext" - /********************** RELOCATION DIRECTIVES **********************/ #ifdef ARM_WINCE struct external_reloc diff --git a/contrib/binutils/include/coff/external.h b/contrib/binutils/include/coff/external.h new file mode 100644 index 0000000..19636da --- /dev/null +++ b/contrib/binutils/include/coff/external.h @@ -0,0 +1,254 @@ +/* external.h -- External COFF structures + + Copyright 2001 Free Software Foundation, Inc. + + 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 COFF_EXTERNAL_H +#define COFF_EXTERNAL_H + +#ifndef DO_NOT_DEFINE_FILHDR +/********************** FILE HEADER **********************/ + +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 +#endif + +#ifndef DO_NOT_DEFINE_AOUTHDR +/********************** AOUT "OPTIONAL 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 AOUTHDRSZ 28 +#define AOUTSZ 28 +#endif + +#ifndef DO_NOT_DEFINE_SCNHDR +/********************** SECTION HEADER **********************/ + +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 _COMMENT ".comment" +#define _LIB ".lib" +#endif /* not DO_NOT_DEFINE_SCNHDR */ + +#ifndef DO_NOT_DEFINE_LINENO + +/********************** LINE NUMBERS **********************/ + +#ifndef L_LNNO_SIZE +#error L_LNNO_SIZE needs to be defined +#endif + +/* 1 line number entry for every "breakpointable" source line in a section. + Line numbers are grouped on a per function basis; first entry in a function + grouping will have l_lnno = 0 and in place of physical address will be the + symbol table index of the function name. */ +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[L_LNNO_SIZE]; /* line number */ +}; + +#define LINENO struct external_lineno +#define LINESZ (4 + L_LNNO_SIZE) + +#if L_LNNO_SIZE == 4 +#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) 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 */ + +#ifndef DO_NOT_DEFINE_SYMENT +/********************** SYMBOLS **********************/ + +#define E_SYMNMLEN 8 /* # characters in a symbol name */ +#ifndef E_FILNMLEN +#define E_FILNMLEN 14 +#endif +#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ + +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 + +#ifndef N_BTMASK +#define N_BTMASK 0xf +#endif + +#ifndef N_TMASK +#define N_TMASK 0x30 +#endif + +#ifndef N_BTSHFT +#define N_BTSHFT 4 +#endif + +#ifndef N_TSHIFT +#define N_TSHIFT 2 +#endif + +#endif /* not DO_NOT_DEFINE_SYMENT */ + +#ifndef DO_NOT_DEFINE_AUXENT + +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 */ +#ifdef INCLUDE_COMDAT_FIELDS_IN_AUXENT + char x_checksum[4]; /* section COMDAT checksum */ + char x_associated[2]; /* COMDAT associated section index */ + char x_comdat[1]; /* COMDAT selection number */ +#endif + } 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 + +#define _ETEXT "etext" + +#endif /* not DO_NOT_DEFINE_AUXENT */ + +#endif /* COFF_EXTERNAL_H */ diff --git a/contrib/binutils/include/coff/i386.h b/contrib/binutils/include/coff/i386.h index 407245f..484a3b1 100644 --- a/contrib/binutils/include/coff/i386.h +++ b/contrib/binutils/include/coff/i386.h @@ -16,34 +16,22 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/********************** FILE HEADER **********************/ - -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 L_LNNO_SIZE 2 +#define INCLUDE_COMDAT_FIELDS_IN_AUXENT +#include "coff/external.h" /* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ + F_RELFLG relocation info stripped from file + F_EXEC file is executable (no unresolved external references) + F_LNNO line numbers stripped from file + F_LSYMS local symbols stripped from file + F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax). */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) #define F_LNNO (0x0004) #define F_LSYMS (0x0008) - - #define I386MAGIC 0x14c #define I386PTXMAGIC 0x154 #define I386AIXMAGIC 0x175 @@ -52,43 +40,16 @@ struct external_filehdr { #define LYNXCOFFMAGIC 0415 -#define I386BADMAG(x) (((x).f_magic != I386MAGIC) \ +#define I386BADMAG(x) ( ((x).f_magic != I386MAGIC) \ && (x).f_magic != I386AIXMAGIC \ && (x).f_magic != I386PTXMAGIC \ && (x).f_magic != LYNXCOFFMAGIC) -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - 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 - #define OMAGIC 0404 /* object files, eg as output */ #define ZMAGIC 0413 /* demand load format, eg normal ld output */ #define STMAGIC 0401 /* target shlib */ #define SHMAGIC 0443 /* host shlib */ - /* define some NT default values */ /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ #define NT_SECTION_ALIGNMENT 0x1000 @@ -96,149 +57,15 @@ AOUTHDR; #define NT_DEF_RESERVE 0x100000 #define NT_DEF_COMMIT 0x1000 -/********************** SECTION HEADER **********************/ - - -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 _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -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 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -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 N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } 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 SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - /********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_type[2]; }; - #define RELOC struct external_reloc #define RELSZ 10 diff --git a/contrib/binutils/include/coff/ia64.h b/contrib/binutils/include/coff/ia64.h index 496a877..f7ff0ee 100644 --- a/contrib/binutils/include/coff/ia64.h +++ b/contrib/binutils/include/coff/ia64.h @@ -16,18 +16,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - -/********************** FILE HEADER **********************/ - -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 DO_NOT_DEFINE_AOUTHDR +#define L_LNNO_SIZE 2 +#define INCLUDE_COMDAT_FIELDS_IN_AUXENT +#include "coff/external.h" #define IA64MAGIC 0x200 @@ -46,14 +38,7 @@ struct external_filehdr { #define F_LNNO (0x0004) #define F_LSYMS (0x0008) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - /********************** AOUT "OPTIONAL HEADER" **********************/ - - typedef struct { char magic[2]; /* type of file */ @@ -82,7 +67,6 @@ AOUTHDR; #define STMAGIC 0401 /* target shlib */ #define SHMAGIC 0443 /* host shlib */ - /* define some NT default values */ /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ #define NT_SECTION_ALIGNMENT 0x1000 @@ -90,149 +74,15 @@ AOUTHDR; #define NT_DEF_RESERVE 0x100000 #define NT_DEF_COMMIT 0x1000 -/********************** SECTION HEADER **********************/ - - -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 _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -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 - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -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 N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } 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 SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - -# define _ETEXT "etext" - - /********************** RELOCATION DIRECTIVES **********************/ - - -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_type[2]; }; - #define RELOC struct external_reloc #define RELSZ 10 diff --git a/contrib/binutils/include/coff/internal.h b/contrib/binutils/include/coff/internal.h index 38ca309..4babbd4 100644 --- a/contrib/binutils/include/coff/internal.h +++ b/contrib/binutils/include/coff/internal.h @@ -61,7 +61,7 @@ struct internal_filehdr { struct internal_extra_pe_filehdr pe; - /* standard coff internal info */ + /* Standard coff internal info. */ unsigned short f_magic; /* magic number */ unsigned short f_nscns; /* number of sections */ long f_timdat; /* time & date stamp */ @@ -74,17 +74,16 @@ struct internal_filehdr /* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR16WR file is 16-bit little-endian - * F_AR32WR file is 32-bit little-endian - * F_AR32W file is 32-bit big-endian - * F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports - * F_SHROBJ rs/6000 aix: file is a shared object - * F_DLL PE format DLL - */ + F_RELFLG relocation info stripped from file + F_EXEC file is executable (no unresolved external references) + F_LNNO line numbers stripped from file + F_LSYMS local symbols stripped from file + F_AR16WR file is 16-bit little-endian + F_AR32WR file is 32-bit little-endian + F_AR32W file is 32-bit big-endian + F_DYNLOAD rs/6000 aix: dynamically loadable w/imports & exports + F_SHROBJ rs/6000 aix: file is a shared object + F_DLL PE format DLL. */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) @@ -97,7 +96,7 @@ struct internal_filehdr #define F_SHROBJ (0x2000) #define F_DLL (0x2000) -/* extra structure which is used in the optional header */ +/* Extra structure which is used in the optional header. */ typedef struct _IMAGE_DATA_DIRECTORY { bfd_vma VirtualAddress; @@ -174,7 +173,7 @@ struct internal_aouthdr unsigned long tagentries; /* number of tag entries to follow */ /* RS/6000 stuff */ - unsigned long o_toc; /* address of TOC */ + bfd_vma o_toc; /* address of TOC */ short o_snentry; /* section number for entry point */ short o_sntext; /* section number for text */ short o_sndata; /* section number for data */ @@ -185,8 +184,8 @@ struct internal_aouthdr short o_algndata; /* max alignment for data */ short o_modtype; /* Module type field, 1R,RE,RO */ short o_cputype; /* Encoded CPU type */ - unsigned long o_maxstack; /* max stack size allowed. */ - unsigned long o_maxdata; /* max data size allowed. */ + bfd_vma o_maxstack; /* max stack size allowed. */ + bfd_vma o_maxdata; /* max data size allowed. */ /* ECOFF stuff */ bfd_vma bss_start; /* Base of bss section. */ @@ -200,9 +199,7 @@ struct internal_aouthdr long o_sri; /* Static Resource Information */ long vid[2]; /* Version id */ - struct internal_extra_pe_aouthdr pe; - }; /********************** STORAGE CLASSES **********************/ @@ -322,9 +319,7 @@ struct internal_scnhdr unsigned char s_page; /* TI COFF load page */ }; -/* - * s_flags "type" - */ +/* s_flags "type". */ #define STYP_REG (0x0000) /* "regular": allocated, relocated, loaded */ #define STYP_DSECT (0x0001) /* "dummy": relocated only*/ #define STYP_NOLOAD (0x0002) /* "noload": allocated, relocated, not loaded */ @@ -343,29 +338,27 @@ struct internal_scnhdr #define STYP_OVER (0x0400) /* overlay: relocated not allocated or loaded */ #define STYP_LIB (0x0800) /* for .lib: same as INFO */ #define STYP_MERGE (0x2000) /* merge section -- combines with text, data or bss sections only */ -#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions wherever padding is necessary and there is a - - word of contiguous bytes - beginning on a word boundary. */ +#define STYP_REVERSE_PAD (0x4000) /* section will be padded with no-op instructions + wherever padding is necessary and there is a + word of contiguous bytes beginning on a word + boundary. */ #define STYP_LIT 0x8020 /* Literal data (like STYP_TEXT) */ - /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ + Line numbers are grouped on a per function basis; first entry in a function + grouping will have l_lnno = 0 and in place of physical address will be the + symbol table index of the function name. */ struct internal_lineno { union { - long l_symndx; /* function name symbol index, iff l_lnno == 0*/ - long l_paddr; /* (physical) address of line number */ + bfd_signed_vma l_symndx; /* function name symbol index, iff l_lnno == 0*/ + bfd_signed_vma l_paddr; /* (physical) address of line number */ } l_addr; unsigned long l_lnno; /* line number */ }; @@ -388,7 +381,7 @@ struct internal_syment } _n_n; char *_n_nptr[2]; /* allows for overlaying */ } _n; - long n_value; /* value of symbol */ + bfd_vma n_value; /* value of symbol */ short n_scnum; /* section number */ unsigned short n_flags; /* copy of flags from filhdr */ unsigned short n_type; /* type and derived type */ @@ -400,9 +393,8 @@ struct internal_syment #define n_zeroes _n._n_n._n_zeroes #define n_offset _n._n_n._n_offset - /* Relocatable symbols have number of the section in which they are defined, - or one of the following: */ + or one of the following: */ #define N_UNDEF ((short)0) /* undefined symbol */ #define N_ABS ((short)-1) /* value of symbol is absolute */ @@ -410,9 +402,8 @@ struct internal_syment #define N_TV ((short)-3) /* indicates symbol needs preload transfer vector */ #define P_TV ((short)-4) /* indicates symbol needs postload transfer vector*/ -/* - * Type of a symbol, in low N bits of the word - */ +/* Type of a symbol, in low N bits of the word. */ + #define T_NULL 0 #define T_VOID 1 /* function argument (only used by compiler) */ #define T_CHAR 2 /* character */ @@ -431,9 +422,8 @@ struct internal_syment #define T_ULONG 15 /* unsigned long */ #define T_LNGDBL 16 /* long double */ -/* - * derived types, in n_type -*/ +/* Derived types, in n_type. */ + #define DT_NON (0) /* no derived type */ #define DT_PTR (1) /* pointer */ #define DT_FCN (2) /* function */ @@ -478,7 +468,7 @@ union internal_auxent { struct { /* if ISFCN, tag, or .bb */ - long x_lnnoptr; /* ptr to fcn line # */ + bfd_signed_vma x_lnnoptr; /* ptr to fcn line # */ union { /* entry ndx past block end */ long l; @@ -529,7 +519,7 @@ union internal_auxent { union { /* csect length or enclosing csect */ - long l; + bfd_signed_vma l; struct coff_ptr_struct *p; } x_scnlen; long x_parmhash; /* parm type hash index */ @@ -649,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 /* ??? */ @@ -661,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 @@ -689,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/contrib/binutils/include/coff/powerpc.h b/contrib/binutils/include/coff/powerpc.h index 5af9b72..1d4d6fb 100644 --- a/contrib/binutils/include/coff/powerpc.h +++ b/contrib/binutils/include/coff/powerpc.h @@ -18,29 +18,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Initial release: Kim Knuttila (krk@cygnus.com) */ - -/********************** FILE HEADER **********************/ - -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 +#define L_LNNO_SIZE 2 +#define INCLUDE_COMDAT_FIELDS_IN_AUXENT +#include "coff/external.h" /* Bits for f_flags: - * F_RELFLG relocation info stripped from file - * F_EXEC file is executable (no unresolved external references) - * F_LNNO line numbers stripped from file - * F_LSYMS local symbols stripped from file - * F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax) - */ + F_RELFLG relocation info stripped from file + F_EXEC file is executable (no unresolved external references) + F_LNNO line numbers stripped from file + F_LSYMS local symbols stripped from file + F_AR32WR file has byte ordering of an AR32WR machine (e.g. vax). */ #define F_RELFLG (0x0001) #define F_EXEC (0x0002) @@ -57,152 +44,10 @@ struct external_filehdr { #define PPCBADMAG(x) ((x).f_magic != PPCMAGIC) -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct -{ - 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 - -/********************** SECTION HEADER **********************/ - -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 _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -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 - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ - -/* Allow the file name length to be overridden in the including file */ -#ifndef E_FILNMLEN -#define E_FILNMLEN 14 -#endif - -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -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 - -#define N_BTMASK (0xf) -#define N_TMASK (0x30) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - -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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } x_scn; -}; - -#define AUXENT union external_auxent -#define AUXESZ 18 - -#define _ETEXT "etext" - /********************** RELOCATION DIRECTIVES **********************/ -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_type[2]; diff --git a/contrib/binutils/include/coff/rs6000.h b/contrib/binutils/include/coff/rs6000.h index 0def1d9..0c34861 100644 --- a/contrib/binutils/include/coff/rs6000.h +++ b/contrib/binutils/include/coff/rs6000.h @@ -66,11 +66,6 @@ AOUTHDR; #define SMALL_AOUTSZ (28) #define AOUTHDRSZ 72 -#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 */ - - /********************** SECTION HEADER **********************/ @@ -87,28 +82,9 @@ struct external_scnhdr { char s_flags[4]; /* flags */ }; -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _PAD ".pad" -#define _LOADER ".loader" - #define SCNHDR struct external_scnhdr #define SCNHSZ 40 -/* 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 - /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. @@ -241,3 +217,51 @@ struct external_reloc { #define DEFAULT_TEXT_SECTION_ALIGNMENT 4 /* For new sections we havn't heard of before */ #define DEFAULT_SECTION_ALIGNMENT 4 + +/* The ldhdr structure. This appears at the start of the .loader + section. */ + +struct external_ldhdr +{ + bfd_byte l_version[4]; + bfd_byte l_nsyms[4]; + bfd_byte l_nreloc[4]; + bfd_byte l_istlen[4]; + bfd_byte l_nimpid[4]; + bfd_byte l_impoff[4]; + bfd_byte l_stlen[4]; + bfd_byte l_stoff[4]; +}; + +#define LDHDRSZ (8 * 4) + +struct external_ldsym +{ + union + { + bfd_byte _l_name[SYMNMLEN]; + struct + { + bfd_byte _l_zeroes[4]; + bfd_byte _l_offset[4]; + } _l_l; + } _l; + bfd_byte l_value[4]; + bfd_byte l_scnum[2]; + bfd_byte l_smtype[1]; + bfd_byte l_smclas[1]; + bfd_byte l_ifile[4]; + bfd_byte l_parm[4]; +}; + +#define LDSYMSZ (8 + 3 * 4 + 2 + 2) + +struct external_ldrel +{ + bfd_byte l_vaddr[4]; + bfd_byte l_symndx[4]; + bfd_byte l_rtype[2]; + bfd_byte l_rsecnm[2]; +}; + +#define LDRELSZ (2 * 4 + 2 * 2) diff --git a/contrib/binutils/include/coff/rs6k64.h b/contrib/binutils/include/coff/rs6k64.h index ed1098e..c9dd29f 100644 --- a/contrib/binutils/include/coff/rs6k64.h +++ b/contrib/binutils/include/coff/rs6k64.h @@ -72,11 +72,6 @@ AOUTHDR; #define SMALL_AOUTSZ (0) #define AOUTHDRSZ 72 -#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 */ - - /********************** SECTION HEADER **********************/ @@ -94,29 +89,11 @@ struct external_scnhdr { char s_pad[4]; /* padding */ }; -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" -#define _PAD ".pad" -#define _LOADER ".loader" #define SCNHDR struct external_scnhdr #define SCNHSZ 72 -/* 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 - /********************** LINE NUMBERS **********************/ /* 1 line number entry for every "breakpointable" source line in a section. @@ -126,7 +103,7 @@ struct external_scnhdr { */ struct external_lineno { union { - char l_symndx[8];/* function name symbol index, iff l_lnno == 0*/ + char l_symndx[4];/* function name symbol index, iff l_lnno == 0*/ char l_paddr[8]; /* (physical) address of line number */ } l_addr; char l_lnno[4]; /* line number */ @@ -146,9 +123,7 @@ struct external_lineno { struct external_syment { - union { - char e_value[8]; - } e; + char e_value[8]; char e_offset[4]; char e_scnum[2]; char e_type[2]; @@ -249,3 +224,44 @@ struct external_reloc { #define DEFAULT_TEXT_SECTION_ALIGNMENT 4 /* For new sections we havn't heard of before */ #define DEFAULT_SECTION_ALIGNMENT 4 + +/* The ldhdr structure. This appears at the start of the .loader + section. */ + +struct external_ldhdr +{ + bfd_byte l_version[4]; + bfd_byte l_nsyms[4]; + bfd_byte l_nreloc[4]; + bfd_byte l_istlen[4]; + bfd_byte l_nimpid[4]; + bfd_byte l_stlen[4]; + bfd_byte l_impoff[8]; + bfd_byte l_stoff[8]; + bfd_byte l_symoff[8]; + bfd_byte l_rldoff[8]; +}; +#define LDHDRSZ (56) + +struct external_ldsym +{ + bfd_byte l_value[8]; + bfd_byte l_offset[4]; + bfd_byte l_scnum[2]; + bfd_byte l_smtype[1]; + bfd_byte l_smclas[1]; + bfd_byte l_ifile[4]; + bfd_byte l_parm[4]; +}; + +#define LDSYMSZ (24) + +struct external_ldrel +{ + bfd_byte l_vaddr[8]; + bfd_byte l_rtype[2]; + bfd_byte l_rsecnm[2]; + bfd_byte l_symndx[4]; +}; + +#define LDRELSZ (16) diff --git a/contrib/binutils/include/coff/sh.h b/contrib/binutils/include/coff/sh.h index 7ae32fc..c77316e 100644 --- a/contrib/binutils/include/coff/sh.h +++ b/contrib/binutils/include/coff/sh.h @@ -16,56 +16,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/********************** FILE HEADER **********************/ - -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 */ -}; - - +#ifdef COFF_WITH_PE +#define L_LNNO_SIZE 2 +#else +#define L_LNNO_SIZE 4 +#endif +#define INCLUDE_COMDAT_FIELDS_IN_AUXENT +#include "coff/external.h" #define SH_ARCH_MAGIC_BIG 0x0500 #define SH_ARCH_MAGIC_LITTLE 0x0550 /* Little endian SH */ #define SH_ARCH_MAGIC_WINCE 0x01a2 /* Windows CE - little endian */ #define SH_PE_MAGIC 0x010b - #define SHBADMAG(x) \ - (((x).f_magic!=SH_ARCH_MAGIC_BIG) && \ - ((x).f_magic!=SH_ARCH_MAGIC_WINCE) && \ - ((x).f_magic!=SH_ARCH_MAGIC_LITTLE)) - -#define FILHDR struct external_filehdr -#define FILHSZ 20 - - -/********************** AOUT "OPTIONAL HEADER" **********************/ - - -typedef struct -{ - 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 AOUTHDRSZ 28 -#define AOUTSZ 28 - - + (((x).f_magic != SH_ARCH_MAGIC_BIG) && \ + ((x).f_magic != SH_ARCH_MAGIC_WINCE) && \ + ((x).f_magic != SH_ARCH_MAGIC_LITTLE)) /* Define some NT default values. */ /* #define NT_IMAGE_BASE 0x400000 moved to internal.h */ @@ -74,161 +41,15 @@ AOUTHDR; #define NT_DEF_RESERVE 0x100000 #define NT_DEF_COMMIT 0x1000 -/********************** SECTION HEADER **********************/ - - -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 */ -}; - -/* - * names of "special" sections - */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" - - -#define SCNHDR struct external_scnhdr -#define SCNHSZ 40 - - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - * Line numbers are grouped on a per function basis; first entry in a function - * grouping will have l_lnno = 0 and in place of physical address will be the - * symbol table index of the function name. - */ -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; -#ifdef COFF_WITH_PE - char l_lnno[2]; /* line number */ -#else - char l_lnno[4]; /* line number */ -#endif -}; - -#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 LINENO struct external_lineno -#ifdef COFF_WITH_PE -#define LINESZ 6 -#undef GET_LINENO_LNNO -#define GET_LINENO_LNNO(abfd, ext) bfd_h_get_16(abfd, (bfd_byte *) (ext->l_lnno)); -#undef PUT_LINENO_LNNO -#define PUT_LINENO_LNNO(abfd,val, ext) bfd_h_put_16(abfd,val, (bfd_byte *) (ext->l_lnno)); -#else -#define LINESZ 8 -#endif - - -/********************** SYMBOLS **********************/ - -#define E_SYMNMLEN 8 /* # characters in a symbol name */ -#define E_FILNMLEN 14 /* # characters in a file name */ -#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */ - -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 N_BTMASK (017) -#define N_TMASK (060) -#define N_BTSHFT (4) -#define N_TSHIFT (2) - - -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 */ - char x_checksum[4]; /* section COMDAT checksum */ - char x_associated[2]; /* COMDAT associated section index */ - char x_comdat[1]; /* COMDAT selection number */ - } 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 SYMENT struct external_syment -#define SYMESZ 18 -#define AUXENT union external_auxent -#define AUXESZ 18 - - - /********************** RELOCATION DIRECTIVES **********************/ /* The external reloc has an offset field, because some of the reloc types on the h8 don't have room in the instruction for the entire - offset - eg the strange jump and high page addressing modes */ + offset - eg the strange jump and high page addressing modes. */ #ifndef COFF_WITH_PE -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_offset[4]; @@ -236,14 +57,14 @@ struct external_reloc { char r_stuff[2]; }; #else -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_type[2]; }; #endif - #define RELOC struct external_reloc #ifdef COFF_WITH_PE #define RELSZ 10 diff --git a/contrib/binutils/include/coff/sparc.h b/contrib/binutils/include/coff/sparc.h index c7102ba..ac524d6 100644 --- a/contrib/binutils/include/coff/sparc.h +++ b/contrib/binutils/include/coff/sparc.h @@ -22,18 +22,10 @@ (presumed) equivalent size. This is necessary so that this file can be used with different systems while still yielding the same results. */ -/********************** FILE HEADER **********************/ - -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 L_LNNO_SIZE 2 +#define DO_NOT_DEFINE_SYMENT +#define DO_NOT_DEFINE_AUXENT +#include "coff/external.h" #define F_RELFLG (0x0001) /* relocation info stripped */ #define F_EXEC (0x0002) /* file is executable */ @@ -46,80 +38,16 @@ struct external_filehdr #define LYNXCOFFMAGIC (0415) -#define FILHDR struct external_filehdr -#define FILHSZ 20 - -/********************** AOUT "OPTIONAL HEADER" **********************/ - -typedef struct -{ - 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 - #define OMAGIC 0404 /* object files, eg as output */ #define ZMAGIC 0413 /* demand load format, eg normal ld output */ #define STMAGIC 0401 /* target shlib */ #define SHMAGIC 0443 /* host shlib */ -/********************** SECTION HEADER **********************/ - -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. */ +/* More names of "special" sections. */ -#define _TEXT ".text" -#define _DATA ".data" -#define _BSS ".bss" #define _TV ".tv" #define _INIT ".init" #define _FINI ".fini" -#define _COMMENT ".comment" -#define _LIB ".lib" - -/********************** LINE NUMBERS **********************/ - -/* 1 line number entry for every "breakpointable" source line in a section. - Line numbers are grouped on a per function basis; first entry in a function - grouping will have l_lnno = 0 and in place of physical address will be the - symbol table index of the function name. */ - -struct external_lineno -{ - union { - char l_symndx[4]; /* fn 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) /********************** SYMBOLS **********************/ @@ -213,7 +141,8 @@ union external_auxent /********************** RELOCATION DIRECTIVES **********************/ -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_type[2]; diff --git a/contrib/binutils/include/coff/ti.h b/contrib/binutils/include/coff/ti.h index 8fa35e3..d98fc89 100644 --- a/contrib/binutils/include/coff/ti.h +++ b/contrib/binutils/include/coff/ti.h @@ -17,22 +17,24 @@ 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 COFF_TI_H #define COFF_TI_H +/* Note "coff/external.h is not used because TI adds extra fields to the structures. */ + /********************** FILE HEADER **********************/ -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 */ - char f_target_id[2]; /* magic no. (TI COFF-specific) */ -}; +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 */ + char f_target_id[2]; /* magic no. (TI COFF-specific) */ + }; /* COFF0 has magic number in f_magic, and omits f_target_id from the file header; for later versions, f_magic is 0xC1 for COFF1 and 0xC2 for COFF2 @@ -89,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 @@ -198,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 @@ -384,51 +377,71 @@ 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 **********************/ -struct external_reloc_v0 { +struct external_reloc_v0 +{ char r_vaddr[4]; char r_symndx[2]; char r_reserved[2]; char r_type[2]; }; -struct external_reloc { +struct external_reloc +{ char r_vaddr[4]; char r_symndx[4]; char r_reserved[2]; /* extended pmad byte for COFF2 */ |