Remove redundant defintions of BYTES_IN_WORD and add conditional defintion in

aout64.h.
This commit is contained in:
Nick Clifton 2003-03-06 16:45:42 +00:00
parent 2245eb63ea
commit 401d0b9129
2 changed files with 135 additions and 128 deletions

View File

@ -1,3 +1,7 @@
2003-03-06 Elias Athanasopoulos <elathan@phys.uoa.gr>
* aout64.h (BYTES_IN_WORD): Define if necessary.
2001-09-18 Alan Modra <amodra@bigpond.net.au> 2001-09-18 Alan Modra <amodra@bigpond.net.au>
* aout64.h: Formatting fixes. * aout64.h: Formatting fixes.
@ -6,7 +10,7 @@
* hp300hpux.h: Formatting fixes. * hp300hpux.h: Formatting fixes.
(N_DATADDR): Avoid negative unsigned warning. (N_DATADDR): Avoid negative unsigned warning.
Mon Apr 3 13:29:08 2000 Hans-Peter Nilsson <hp@axis.com> 2000-04-03 Hans-Peter Nilsson <hp@axis.com>
* aout64.h (RELOC_EXT_BITS_EXTERN_BIG): Wrap definition in #ifndef. * aout64.h (RELOC_EXT_BITS_EXTERN_BIG): Wrap definition in #ifndef.
(RELOC_EXT_BITS_EXTERN_LITTLE): Ditto. (RELOC_EXT_BITS_EXTERN_LITTLE): Ditto.
@ -20,97 +24,97 @@ Mon Apr 3 13:29:08 2000 Hans-Peter Nilsson <hp@axis.com>
* aout64.h (N_SHARED_LIB): Define as 0 if TEXT_START_ADDR is * aout64.h (N_SHARED_LIB): Define as 0 if TEXT_START_ADDR is
defined as 0. defined as 0.
Sun Jun 28 11:33:48 1998 Peter Schauer <pes@regent.e-technik.tu-muenchen.de> 1998-06-28 Peter Schauer <pes@regent.e-technik.tu-muenchen.de>
* stab.def: Add N_ALIAS from SunPro F77. * stab.def: Add N_ALIAS from SunPro F77.
Mon Mar 11 12:15:52 1996 Ian Lance Taylor <ian@cygnus.com> 1996-03-11 Ian Lance Taylor <ian@cygnus.com>
* stab.def: Use __define_stab_duplicate rather than __define_stab * stab.def: Use __define_stab_duplicate rather than __define_stab
for duplicate entries N_BROWS and N_MOD2. for duplicate entries N_BROWS and N_MOD2.
* stab_gnu.h (__define_stab_duplicate): Define before including * stab_gnu.h (__define_stab_duplicate): Define before including
stab.def. stab.def.
Fri Oct 27 17:47:16 1995 Niklas Hallqvist <niklas@appli.se> 1995-10-27 Niklas Hallqvist <niklas@appli.se>
* aout64.h, host.h, hp300hpux.h, sun4.h: Changed PAGE_SIZE to * aout64.h, host.h, hp300hpux.h, sun4.h: Changed PAGE_SIZE to
TARGET_PAGE_SIZE. TARGET_PAGE_SIZE.
Tue Sep 12 12:07:02 1995 Ian Lance Taylor <ian@cygnus.com> 1995-09-12 Ian Lance Taylor <ian@cygnus.com>
* sun4.h (struct internal_sun4_dynamic_link): Change all fields * sun4.h (struct internal_sun4_dynamic_link): Change all fields
from long to unsigned long. from long to unsigned long.
Wed Jul 12 00:15:13 1995 Ken Raeburn <raeburn@kr-pc.cygnus.com> 1995-07-12 Ken Raeburn <raeburn@kr-pc.cygnus.com>
* sun4.h (PAGE_SIZE): Undefine before defining. * sun4.h (PAGE_SIZE): Undefine before defining.
Sun Sep 04 17:58:10 1994 Richard Earnshaw (rwe@pegasus.esprit.ec.org) 1994-09-04 Richard Earnshaw (rwe@pegasus.esprit.ec.org)
* aout64.h: Only define QMAGIC if it isn't already defined. * aout64.h: Only define QMAGIC if it isn't already defined.
Thu Jun 16 14:22:55 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) 1994-06-16 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* aout64.h (BMAGIC): Define. * aout64.h (BMAGIC): Define.
Sat Jun 11 16:16:09 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) 1994-06-11 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
Add weak symbols as an extension to a.out. Add weak symbols as an extension to a.out.
* aout64.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB): Define. * aout64.h (N_WEAKU, N_WEAKA, N_WEAKT, N_WEAKD, N_WEAKB): Define.
* stab.def: Update symbol value table. * stab.def: Update symbol value table.
Thu Jun 2 17:13:38 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) 1994-06-02 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* sun4.h (EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE): Correct from 28 to * sun4.h (EXTERNAL_SUN4_DYNAMIC_DEBUGGER_SIZE): Correct from 28 to
24. Fix up ld_got comment. 24. Fix up ld_got comment.
Wed Mar 30 00:31:49 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) 1994-03-30 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* dynix3.h: Cleanup, adapt to current bfd version. * dynix3.h: Cleanup, adapt to current bfd version.
Sat Feb 26 10:25:53 1994 Ian Lance Taylor (ian@cygnus.com) 1994-02-26 Ian Lance Taylor (ian@cygnus.com)
* aout64.h: Add casts to avoid warnings from SVR4 cc. * aout64.h: Add casts to avoid warnings from SVR4 cc.
Fri Feb 11 12:56:04 1994 Stan Shebs (shebs@andros.cygnus.com) 1994-02-11 Stan Shebs (shebs@andros.cygnus.com)
* ar.h (ARMAG, ARMAGB, ARFMAG): Change '\n' to '\012', for greater * ar.h (ARMAG, ARMAGB, ARFMAG): Change '\n' to '\012', for greater
portability. portability.
Fri Jan 21 00:59:06 1994 Ian Lance Taylor (ian@tweedledumb.cygnus.com) 1994-01-21 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* sun4.h: Added information about SunOS shared libraries. * sun4.h: Added information about SunOS shared libraries.
Fri Jan 7 08:20:13 1994 Jim Kingdon (kingdon@deneb.cygnus.com) 1994-01-07 Jim Kingdon (kingdon@deneb.cygnus.com)
* aout64.h (N_TXTADDR): Add comment regarding OMAGIC and NMAGIC. * aout64.h (N_TXTADDR): Add comment regarding OMAGIC and NMAGIC.
Sat Dec 25 14:55:41 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 1993-12-25 Jim Kingdon (kingdon@lioth.cygnus.com)
* aout64.h (N_DATOFF): Don't pad (revert change of 8 Jul 1993). * aout64.h (N_DATOFF): Don't pad (revert change of 8 Jul 1993).
Tue Nov 16 15:43:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 1993-11-16 Jim Kingdon (kingdon@lioth.cygnus.com)
* aout64.h: New macros ZMAGIC_DISK_BLOCK_SIZE and N_DISK_BLOCK_SIZE * aout64.h: New macros ZMAGIC_DISK_BLOCK_SIZE and N_DISK_BLOCK_SIZE
for Linux ZMAGIC. for Linux ZMAGIC.
(N_TXTOFF, N_DATOFF): Use them. (N_TXTOFF, N_DATOFF): Use them.
Thu Nov 4 00:33:48 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) 1993-11-04 Ken Raeburn (raeburn@kr-pc.cygnus.com)
* aout64.h (RELOC_STD_BITS_RELATIVE_LITTLE): Fixed value to match * aout64.h (RELOC_STD_BITS_RELATIVE_LITTLE): Fixed value to match
sun3 system; used to overlap other fields. sun3 system; used to overlap other fields.
(RELOC_STD_BITS_JMPTABLE_LITTLE): Likewise. (RELOC_STD_BITS_JMPTABLE_LITTLE): Likewise.
Wed Nov 3 13:48:27 1993 David J. Mackenzie (djm@thepub.cygnus.com) 1993-11-03 David J. Mackenzie (djm@thepub.cygnus.com)
* aout64.h (RELOC_STD_BITS_BASEREL_LITTLE): Make it 0x10 (Ken's * aout64.h (RELOC_STD_BITS_BASEREL_LITTLE): Make it 0x10 (Ken's
suggestion) to avoid conflict with RELOC_STD_BITS_EXTERN_LITTLE. suggestion) to avoid conflict with RELOC_STD_BITS_EXTERN_LITTLE.
Fri Oct 29 15:09:52 1993 Ian Lance Taylor (ian@tweedledumb.cygnus.com) 1993-10-29 Ian Lance Taylor (ian@tweedledumb.cygnus.com)
* hp300hpux.h (N_SHARED_LIB): Define to be 0. * hp300hpux.h (N_SHARED_LIB): Define to be 0.
Mon Sep 13 21:00:56 1993 John Gilmore (gnu@cygnus.com) 1993-09-13 John Gilmore (gnu@cygnus.com)
* ar.h (ARMAP_TIME_OFFSET): Add and describe. * ar.h (ARMAP_TIME_OFFSET): Add and describe.
@ -118,30 +122,30 @@ Mon Aug 23 Sean Fagan (sef@cygnus.com)
* aout64.h [ARCH_SIZE != 64]: Allow N_BADMAG to be overridden. * aout64.h [ARCH_SIZE != 64]: Allow N_BADMAG to be overridden.
Mon Aug 16 14:30:14 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 1993-08-16 Jim Kingdon (kingdon@lioth.cygnus.com)
* stab_gnu.h: Include aout/stab.def not just stab.def. * stab_gnu.h: Include aout/stab.def not just stab.def.
Sun Jul 18 21:41:47 1993 Jim Kingdon (kingdon@rtl.cygnus.com) 1993-07-18 Jim Kingdon (kingdon@rtl.cygnus.com)
* dynix3.h: New, for symmetry running dynix. * dynix3.h: New, for symmetry running dynix.
Thu Jul 8 12:52:22 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 1993-07-08 Jim Kingdon (kingdon@lioth.cygnus.com)
* aout64.h (N_BADMAG): Recognize QMAGIC. * aout64.h (N_BADMAG): Recognize QMAGIC.
N_TXTOFF, N_TXTADDR, N_TXTSIZE: Special code for QMAGIC. N_TXTOFF, N_TXTADDR, N_TXTSIZE: Special code for QMAGIC.
N_DATOFF: Pad text size if we need to. N_DATOFF: Pad text size if we need to.
Fri Jun 18 19:19:38 1993 Jim Kingdon (kingdon@lioth.cygnus.com) 1993-06-18 Jim Kingdon (kingdon@lioth.cygnus.com)
* stab.def (N_ECOML): Fix comment. * stab.def (N_ECOML): Fix comment.
Mon May 31 09:21:30 1993 Jim Kingdon (kingdon@cygnus.com) 1993-05-31 Jim Kingdon (kingdon@cygnus.com)
* stab.def: Remove Solaris information on N_FUN stabstring grammar; * stab.def: Remove Solaris information on N_FUN stabstring grammar;
I've transferred it to gdb/doc/stabs.texinfo, where it belongs. I've transferred it to gdb/doc/stabs.texinfo, where it belongs.
Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) 1993-05-10 Ken Raeburn (raeburn@kr-pc.cygnus.com)
* hp300hpux.h: Patch from Glenn Engel for linker problem and * hp300hpux.h: Patch from Glenn Engel for linker problem and
compatibility fix: compatibility fix:
@ -151,11 +155,11 @@ Mon May 10 05:48:43 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
(_N_BADMAG): Adjusted. (_N_BADMAG): Adjusted.
(N_HEADER_IN_TEXT, N_DATADDR): New macros. (N_HEADER_IN_TEXT, N_DATADDR): New macros.
Thu Apr 29 12:07:37 1993 Ken Raeburn (raeburn@deneb.cygnus.com) 1993-04-29 Ken Raeburn (raeburn@deneb.cygnus.com)
* hp300hpux.h: New file from Glenn Engel, glenne@lsid.hp.com. * hp300hpux.h: New file from Glenn Engel, glenne@lsid.hp.com.
Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com) 1993-04-27 Ken Raeburn (raeburn@kr-pc.cygnus.com)
* aout64.h (struct external_exec, *MAGIC, N_BADMAG): Don't define * aout64.h (struct external_exec, *MAGIC, N_BADMAG): Don't define
if `external_exec' is already defined as a macro. if `external_exec' is already defined as a macro.
@ -164,35 +168,35 @@ Tue Apr 27 05:51:04 1993 Ken Raeburn (raeburn@kr-pc.cygnus.com)
(struct external_nlist, EXTERNAL_NLIST_SIZE): Don't define if (struct external_nlist, EXTERNAL_NLIST_SIZE): Don't define if
`external_nlist' is already defined as a macro. `external_nlist' is already defined as a macro.
Sat Aug 15 04:23:02 1992 John Gilmore (gnu@cygnus.com) 1992-08-15 John Gilmore (gnu@cygnus.com)
* adobe.h: Add description of a.out.adobe format. * adobe.h: Add description of a.out.adobe format.
Fri Jul 3 00:36:52 1992 John Gilmore (gnu at cygnus.com) 1992-07-03 John Gilmore (gnu at cygnus.com)
* stab.def: Update more Solaris definitions. * stab.def: Update more Solaris definitions.
* stab_gnu.h: Add N_SO language types, and Solaris basic float types. * stab_gnu.h: Add N_SO language types, and Solaris basic float types.
Sun Jun 14 10:53:53 1992 John Gilmore (gnu at cygnus.com) 1992-06-14 John Gilmore (gnu at cygnus.com)
* stab.def: Update descriptions of Solaris-2 stabs; add N_UNDF. * stab.def: Update descriptions of Solaris-2 stabs; add N_UNDF.
Thu Jun 11 01:12:07 1992 John Gilmore (gnu at cygnus.com) 1992-06-11 John Gilmore (gnu at cygnus.com)
* stab.def: Add N_OBJ and N_OPT from Solaris-2. * stab.def: Add N_OBJ and N_OPT from Solaris-2.
Thu Jan 30 18:12:44 1992 John Gilmore (gnu at cygnus.com) 1992-01-30 John Gilmore (gnu at cygnus.com)
* aout64.h: N_TXTSIZE needs some more parentheses. * aout64.h: N_TXTSIZE needs some more parentheses.
I don't trust C precedence. I don't trust C precedence.
Wed Dec 18 14:32:01 1991 Per Bothner (bothner at cygnus.com) 1991-12-18 Per Bothner (bothner at cygnus.com)
* aout64.h: Move common sunos-specific test * aout64.h: Move common sunos-specific test
to recognize shared libraries into new macro N_SHARED_LIB. to recognize shared libraries into new macro N_SHARED_LIB.
Use it to simplify & reformat N_TXTADDR, N_TXTOFF, N_TXTSIZE. Use it to simplify & reformat N_TXTADDR, N_TXTOFF, N_TXTSIZE.
Sat Nov 30 20:34:52 1991 Steve Chamberlain (sac at rtl.cygnus.com) 1991-11-30 Steve Chamberlain (sac at rtl.cygnus.com)
* aout64.h, ar.h, encap.h, host.h, hp.h, ranlib.h, reloc.h, * aout64.h, ar.h, encap.h, host.h, hp.h, ranlib.h, reloc.h,
stab.def, stab_gnu.h, sun4.h: All moved from the devo/include stab.def, stab_gnu.h, sun4.h: All moved from the devo/include

View File

@ -1,6 +1,6 @@
/* `a.out' object-file definitions, including extensions to 64-bit fields /* `a.out' object-file definitions, including extensions to 64-bit fields
Copyright 2001 Free Software Foundation, Inc. Copyright 2001, 2003 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -19,27 +19,31 @@
#ifndef __A_OUT_64_H__ #ifndef __A_OUT_64_H__
#define __A_OUT_64_H__ #define __A_OUT_64_H__
#ifndef BYTES_IN_WORD
#define BYTES_IN_WORD 4
#endif
/* This is the layout on disk of the 32-bit or 64-bit exec header. */ /* This is the layout on disk of the 32-bit or 64-bit exec header. */
#ifndef external_exec #ifndef external_exec
struct external_exec struct external_exec
{ {
bfd_byte e_info[4]; /* magic number and stuff */ bfd_byte e_info[4]; /* Magic number and stuff. */
bfd_byte e_text[BYTES_IN_WORD]; /* length of text section in bytes */ bfd_byte e_text[BYTES_IN_WORD]; /* Length of text section in bytes. */
bfd_byte e_data[BYTES_IN_WORD]; /* length of data section in bytes */ bfd_byte e_data[BYTES_IN_WORD]; /* Length of data section in bytes. */
bfd_byte e_bss[BYTES_IN_WORD]; /* length of bss area in bytes */ bfd_byte e_bss[BYTES_IN_WORD]; /* Length of bss area in bytes. */
bfd_byte e_syms[BYTES_IN_WORD]; /* length of symbol table in bytes */ bfd_byte e_syms[BYTES_IN_WORD]; /* Length of symbol table in bytes. */
bfd_byte e_entry[BYTES_IN_WORD]; /* start address */ bfd_byte e_entry[BYTES_IN_WORD]; /* Start address. */
bfd_byte e_trsize[BYTES_IN_WORD]; /* length of text relocation info */ bfd_byte e_trsize[BYTES_IN_WORD]; /* Length of text relocation info. */
bfd_byte e_drsize[BYTES_IN_WORD]; /* length of data relocation info */ bfd_byte e_drsize[BYTES_IN_WORD]; /* Length of data relocation info. */
}; };
#define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7) #define EXEC_BYTES_SIZE (4 + BYTES_IN_WORD * 7)
/* Magic numbers for a.out files */ /* Magic numbers for a.out files. */
#if ARCH_SIZE==64 #if ARCH_SIZE==64
#define OMAGIC 0x1001 /* Code indicating object file */ #define OMAGIC 0x1001 /* Code indicating object file. */
#define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */ #define ZMAGIC 0x1002 /* Code indicating demand-paged executable. */
#define NMAGIC 0x1003 /* Code indicating pure executable. */ #define NMAGIC 0x1003 /* Code indicating pure executable. */
@ -49,7 +53,7 @@ struct external_exec
&& N_MAGIC(x) != NMAGIC \ && N_MAGIC(x) != NMAGIC \
&& N_MAGIC(x) != ZMAGIC) && N_MAGIC(x) != ZMAGIC)
#else #else
#define OMAGIC 0407 /* ...object file or impure executable. */ #define OMAGIC 0407 /* Object file or impure executable. */
#define NMAGIC 0410 /* Code indicating pure executable. */ #define NMAGIC 0410 /* Code indicating pure executable. */
#define ZMAGIC 0413 /* Code indicating demand-paged executable. */ #define ZMAGIC 0413 /* Code indicating demand-paged executable. */
#define BMAGIC 0415 /* Used by a b.out object. */ #define BMAGIC 0415 /* Used by a b.out object. */
@ -125,8 +129,7 @@ struct external_exec
* QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true, * QMAGIC is always like a ZMAGIC for which N_HEADER_IN_TEXT is true,
and for which the starting address is TARGET_PAGE_SIZE (or should this be and for which the starting address is TARGET_PAGE_SIZE (or should this be
SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). SEGMENT_SIZE?) (TEXT_START_ADDR only applies to ZMAGIC, not to QMAGIC). */
*/
/* This macro is only relevant for ZMAGIC files; QMAGIC always has the header /* This macro is only relevant for ZMAGIC files; QMAGIC always has the header
in the text. */ in the text. */
@ -152,12 +155,12 @@ struct external_exec
#ifndef N_TXTADDR #ifndef N_TXTADDR
#define N_TXTADDR(x) \ #define N_TXTADDR(x) \
(/* The address of a QMAGIC file is always one page in, */ \ (/* The address of a QMAGIC file is always one page in, \
/* with the header in the text. */ \ with the header in the text. */ \
N_IS_QMAGIC (x) \ N_IS_QMAGIC (x) \
? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE \ ? (bfd_vma) TARGET_PAGE_SIZE + EXEC_BYTES_SIZE \
: (N_MAGIC (x) != ZMAGIC \ : (N_MAGIC (x) != ZMAGIC \
? (bfd_vma) 0 /* object file or NMAGIC */ \ ? (bfd_vma) 0 /* Object file or NMAGIC. */ \
: (N_SHARED_LIB (x) \ : (N_SHARED_LIB (x) \
? (bfd_vma) 0 \ ? (bfd_vma) 0 \
: (N_HEADER_IN_TEXT (x) \ : (N_HEADER_IN_TEXT (x) \
@ -187,8 +190,8 @@ struct external_exec
: (N_SHARED_LIB (x) \ : (N_SHARED_LIB (x) \
? 0 \ ? 0 \
: (N_HEADER_IN_TEXT (x) \ : (N_HEADER_IN_TEXT (x) \
? EXEC_BYTES_SIZE /* no padding */ \ ? EXEC_BYTES_SIZE /* No padding. */ \
: ZMAGIC_DISK_BLOCK_SIZE /* a page of padding */))) : ZMAGIC_DISK_BLOCK_SIZE /* A page of padding. */)))
#endif #endif
/* Size of the text section. It's always as stated, except that we /* Size of the text section. It's always as stated, except that we
offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF offset it to `undo' the adjustment to N_TXTADDR and N_TXTOFF
@ -203,8 +206,8 @@ struct external_exec
: ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \ : ((N_MAGIC (x) != ZMAGIC || N_SHARED_LIB (x)) \
? (x).a_text \ ? (x).a_text \
: (N_HEADER_IN_TEXT (x) \ : (N_HEADER_IN_TEXT (x) \
? (x).a_text - EXEC_BYTES_SIZE /* no padding */ \ ? (x).a_text - EXEC_BYTES_SIZE /* No padding. */ \
: (x).a_text /* a page of padding */ ))) : (x).a_text /* A page of padding. */ )))
#endif #endif
/* The address of the data segment in virtual memory. /* The address of the data segment in virtual memory.
It is the text segment address, plus text segment size, rounded It is the text segment address, plus text segment size, rounded
@ -252,40 +255,42 @@ struct external_exec
/* Symbols */ /* Symbols */
#ifndef external_nlist #ifndef external_nlist
struct external_nlist { struct external_nlist
bfd_byte e_strx[BYTES_IN_WORD]; /* index into string table of name */ {
bfd_byte e_type[1]; /* type of symbol */ bfd_byte e_strx[BYTES_IN_WORD]; /* Index into string table of name. */
bfd_byte e_other[1]; /* misc info (usually empty) */ bfd_byte e_type[1]; /* Type of symbol. */
bfd_byte e_desc[2]; /* description field */ bfd_byte e_other[1]; /* Misc info (usually empty). */
bfd_byte e_value[BYTES_IN_WORD]; /* value of symbol */ bfd_byte e_desc[2]; /* Description field. */
bfd_byte e_value[BYTES_IN_WORD]; /* Value of symbol. */
}; };
#define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD) #define EXTERNAL_NLIST_SIZE (BYTES_IN_WORD+4+BYTES_IN_WORD)
#endif #endif
struct internal_nlist { struct internal_nlist
unsigned long n_strx; /* index into string table of name */ {
unsigned char n_type; /* type of symbol */ unsigned long n_strx; /* Index into string table of name. */
unsigned char n_other; /* misc info (usually empty) */ unsigned char n_type; /* Type of symbol. */
unsigned short n_desc; /* description field */ unsigned char n_other; /* Misc info (usually empty). */
bfd_vma n_value; /* value of symbol */ unsigned short n_desc; /* Description field. */
bfd_vma n_value; /* Value of symbol. */
}; };
/* The n_type field is the symbol type, containing: */ /* The n_type field is the symbol type, containing: */
#define N_UNDF 0 /* Undefined symbol */ #define N_UNDF 0 /* Undefined symbol. */
#define N_ABS 2 /* Absolute symbol -- defined at particular addr */ #define N_ABS 2 /* Absolute symbol -- defined at particular addr. */
#define N_TEXT 4 /* Text sym -- defined at offset in text seg */ #define N_TEXT 4 /* Text sym -- defined at offset in text seg. */
#define N_DATA 6 /* Data sym -- defined at offset in data seg */ #define N_DATA 6 /* Data sym -- defined at offset in data seg. */
#define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg */ #define N_BSS 8 /* BSS sym -- defined at offset in zero'd seg. */
#define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink) */ #define N_COMM 0x12 /* Common symbol (visible after shared lib dynlink). */
#define N_FN 0x1f /* File name of .o file */ #define N_FN 0x1f /* File name of .o file. */
#define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh) */ #define N_FN_SEQ 0x0C /* N_FN from Sequent compilers (sigh). */
/* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT, /* Note: N_EXT can only be usefully OR-ed with N_UNDF, N_ABS, N_TEXT,
N_DATA, or N_BSS. When the low-order bit of other types is set, N_DATA, or N_BSS. When the low-order bit of other types is set,
(e.g. N_WARNING versus N_FN), they are two different types. */ (e.g. N_WARNING versus N_FN), they are two different types. */
#define N_EXT 1 /* External symbol (as opposed to local-to-this-file) */ #define N_EXT 1 /* External symbol (as opposed to local-to-this-file). */
#define N_TYPE 0x1e #define N_TYPE 0x1e
#define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol */ #define N_STAB 0xe0 /* If any of these bits are on, it's a debug symbol. */
#define N_INDR 0x0a #define N_INDR 0x0a
@ -301,10 +306,10 @@ struct internal_nlist {
in that it can satisfy undefined external references. */ in that it can satisfy undefined external references. */
/* These appear as input to LD, in a .o file. */ /* These appear as input to LD, in a .o file. */
#define N_SETA 0x14 /* Absolute set element symbol */ #define N_SETA 0x14 /* Absolute set element symbol. */
#define N_SETT 0x16 /* Text set element symbol */ #define N_SETT 0x16 /* Text set element symbol. */
#define N_SETD 0x18 /* Data set element symbol */ #define N_SETD 0x18 /* Data set element symbol. */
#define N_SETB 0x1A /* Bss set element symbol */ #define N_SETB 0x1A /* Bss set element symbol. */
/* This is output from LD. */ /* This is output from LD. */
#define N_SETV 0x1C /* Pointer to set vector in data area. */ #define N_SETV 0x1C /* Pointer to set vector in data area. */
@ -335,18 +340,18 @@ struct internal_nlist {
instructions. Eg, on the 68k, each move instruction can reference instructions. Eg, on the 68k, each move instruction can reference
the target with a displacement of 16 or 32 bits. On the sparc, move the target with a displacement of 16 or 32 bits. On the sparc, move
instructions use an offset of 14 bits, so the offset is stored in instructions use an offset of 14 bits, so the offset is stored in
the reloc field, and the data in the section is ignored. the reloc field, and the data in the section is ignored. */
*/
/* This structure describes a single relocation to be performed. /* This structure describes a single relocation to be performed.
The text-relocation section of the file is a vector of these structures, The text-relocation section of the file is a vector of these structures,
all of which apply to the text section. all of which apply to the text section.
Likewise, the data-relocation section applies to the data section. */ Likewise, the data-relocation section applies to the data section. */
struct reloc_std_external { struct reloc_std_external
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ {
bfd_byte r_index[3]; /* symbol table index of symbol */ bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */
bfd_byte r_type[1]; /* relocation type */ bfd_byte r_index[3]; /* Symbol table index of symbol. */
bfd_byte r_type[1]; /* Relocation type. */
}; };
#define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80) #define RELOC_STD_BITS_PCREL_BIG ((unsigned int) 0x80)
@ -369,7 +374,7 @@ struct reloc_std_external {
#define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02) #define RELOC_STD_BITS_RELATIVE_BIG ((unsigned int) 0x02)
#define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40) #define RELOC_STD_BITS_RELATIVE_LITTLE ((unsigned int) 0x40)
#define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry */ #define RELOC_STD_SIZE (BYTES_IN_WORD + 3 + 1) /* Bytes per relocation entry. */
struct reloc_std_internal struct reloc_std_internal
{ {
@ -392,21 +397,22 @@ struct reloc_std_internal
unsigned int r_extern:1; unsigned int r_extern:1;
/* The next three bits are for SunOS shared libraries, and seem to /* The next three bits are for SunOS shared libraries, and seem to
be undocumented. */ be undocumented. */
unsigned int r_baserel:1; /* Linkage table relative */ unsigned int r_baserel:1; /* Linkage table relative. */
unsigned int r_jmptable:1; /* pc-relative to jump table */ unsigned int r_jmptable:1; /* pc-relative to jump table. */
unsigned int r_relative:1; /* "relative relocation" */ unsigned int r_relative:1; /* "relative relocation". */
/* unused */ /* unused */
unsigned int r_pad:1; /* Padding -- set to zero */ unsigned int r_pad:1; /* Padding -- set to zero. */
}; };
/* EXTENDED RELOCS */ /* EXTENDED RELOCS. */
struct reloc_ext_external { struct reloc_ext_external
bfd_byte r_address[BYTES_IN_WORD]; /* offset of of data to relocate */ {
bfd_byte r_index[3]; /* symbol table index of symbol */ bfd_byte r_address[BYTES_IN_WORD]; /* Offset of of data to relocate. */
bfd_byte r_type[1]; /* relocation type */ bfd_byte r_index[3]; /* Symbol table index of symbol. */
bfd_byte r_addend[BYTES_IN_WORD]; /* datum addend */ bfd_byte r_type[1]; /* Relocation type. */
bfd_byte r_addend[BYTES_IN_WORD]; /* Datum addend. */
}; };
#ifndef RELOC_EXT_BITS_EXTERN_BIG #ifndef RELOC_EXT_BITS_EXTERN_BIG
@ -433,20 +439,20 @@ struct reloc_ext_external {
#define RELOC_EXT_BITS_TYPE_SH_LITTLE 3 #define RELOC_EXT_BITS_TYPE_SH_LITTLE 3
#endif #endif
/* Bytes per relocation entry */ /* Bytes per relocation entry. */
#define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD) #define RELOC_EXT_SIZE (BYTES_IN_WORD + 3 + 1 + BYTES_IN_WORD)
enum reloc_type enum reloc_type
{ {
/* simple relocations */ /* Simple relocations. */
RELOC_8, /* data[0:7] = addend + sv */ RELOC_8, /* data[0:7] = addend + sv */
RELOC_16, /* data[0:15] = addend + sv */ RELOC_16, /* data[0:15] = addend + sv */
RELOC_32, /* data[0:31] = addend + sv */ RELOC_32, /* data[0:31] = addend + sv */
/* pc-rel displacement */ /* PC-rel displacement. */
RELOC_DISP8, /* data[0:7] = addend - pc + sv */ RELOC_DISP8, /* data[0:7] = addend - pc + sv */
RELOC_DISP16, /* data[0:15] = addend - pc + sv */ RELOC_DISP16, /* data[0:15] = addend - pc + sv */
RELOC_DISP32, /* data[0:31] = addend - pc + sv */ RELOC_DISP32, /* data[0:31] = addend - pc + sv */
/* Special */ /* Special. */
RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */ RELOC_WDISP30, /* data[0:29] = (addend + sv - pc)>>2 */
RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */ RELOC_WDISP22, /* data[0:21] = (addend + sv - pc)>>2 */
RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */ RELOC_HI22, /* data[0:21] = (addend + sv)>>10 */
@ -455,16 +461,16 @@ enum reloc_type
RELOC_LO10, /* data[0:9] = (addend + sv) */ RELOC_LO10, /* data[0:9] = (addend + sv) */
RELOC_SFA_BASE, RELOC_SFA_BASE,
RELOC_SFA_OFF13, RELOC_SFA_OFF13,
/* P.I.C. (base-relative) */ /* P.I.C. (base-relative). */
RELOC_BASE10, /* Not sure - maybe we can do this the */ RELOC_BASE10, /* Not sure - maybe we can do this the */
RELOC_BASE13, /* right way now */ RELOC_BASE13, /* right way now */
RELOC_BASE22, RELOC_BASE22,
/* for some sort of pc-rel P.I.C. (?) */ /* For some sort of pc-rel P.I.C. (?) */
RELOC_PC10, RELOC_PC10,
RELOC_PC22, RELOC_PC22,
/* P.I.C. jump table */ /* P.I.C. jump table. */
RELOC_JMP_TBL, RELOC_JMP_TBL,
/* reputedly for shared libraries somehow */ /* Reputedly for shared libraries somehow. */
RELOC_SEGOFF16, RELOC_SEGOFF16,
RELOC_GLOB_DAT, RELOC_GLOB_DAT,
RELOC_JMP_SLOT, RELOC_JMP_SLOT,
@ -476,13 +482,12 @@ enum reloc_type
RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */ RELOC_HHI22, /* data[0:21] = (addend + sv) >> 42 */
RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */ RELOC_HLO10, /* data[0:9] = (addend + sv) >> 32 */
/* 29K relocation types */ /* 29K relocation types. */
RELOC_JUMPTARG, RELOC_JUMPTARG,
RELOC_CONST, RELOC_CONST,
RELOC_CONSTH, RELOC_CONSTH,
/* All the new ones I can think of, for sparc v9 */ /* All the new ones I can think of, for sparc v9. */
RELOC_64, /* data[0:63] = addend + sv */ RELOC_64, /* data[0:63] = addend + sv */
RELOC_DISP64, /* data[0:63] = addend - pc + sv */ RELOC_DISP64, /* data[0:63] = addend - pc + sv */
RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */ RELOC_WDISP21, /* data[0:20] = (addend + sv - pc)>>2 */
@ -492,25 +497,23 @@ enum reloc_type
What are the other ones, What are the other ones,
Since this is a clean slate, can we throw away the ones we dont Since this is a clean slate, can we throw away the ones we dont
understand ? Should we sort the values ? What about using a understand ? Should we sort the values ? What about using a
microcode format like the 68k ? microcode format like the 68k ? */
*/
NO_RELOC NO_RELOC
}; };
struct reloc_internal { struct reloc_internal
bfd_vma r_address; /* offset of of data to relocate */ {
long r_index; /* symbol table index of symbol */ bfd_vma r_address; /* Offset of of data to relocate. */
enum reloc_type r_type; /* relocation type */ long r_index; /* Symbol table index of symbol. */
bfd_vma r_addend; /* datum addend */ enum reloc_type r_type; /* Relocation type. */
bfd_vma r_addend; /* Datum addend. */
}; };
/* Q. /* Q.
Should the length of the string table be 4 bytes or 8 bytes ? Should the length of the string table be 4 bytes or 8 bytes ?
Q. Q.
What about archive indexes ? What about archive indexes ? */
*/
#endif /* __A_OUT_64_H__ */ #endif /* __A_OUT_64_H__ */