2001-01-01 Kazu Hirata <kazu@hxi.com>

* reloc.c: Fix formatting.
	* riscix.c: Likewise.
	* rs6000-core.c: Likewise.
	* xcoff-target.h: Likewise.
This commit is contained in:
Kazu Hirata 2001-01-01 21:37:35 +00:00
parent 7dc542b23c
commit 3d85563291
5 changed files with 76 additions and 99 deletions

View file

@ -1,3 +1,10 @@
2001-01-01 Kazu Hirata <kazu@hxi.com>
* reloc.c: Fix formatting.
* riscix.c: Likewise.
* rs6000-core.c: Likewise.
* xcoff-target.h: Likewise.
2000-12-29 Hans-Peter Nilsson <hp@bitrange.com> 2000-12-29 Hans-Peter Nilsson <hp@bitrange.com>
* elfcode.h (elf_object_p): Also restore the bfd mach field on * elfcode.h (elf_object_p): Also restore the bfd mach field on

View file

@ -146,7 +146,6 @@ DESCRIPTION
to the relocation offset. Its interpretation is dependent upon to the relocation offset. Its interpretation is dependent upon
the howto. For example, on the 68k the code: the howto. For example, on the 68k the code:
| char foo[]; | char foo[];
| main() | main()
| { | {
@ -161,11 +160,9 @@ DESCRIPTION
| unlk fp | unlk fp
| rts | rts
This could create a reloc pointing to <<foo>>, but leave the This could create a reloc pointing to <<foo>>, but leave the
offset in the data, something like: offset in the data, something like:
|RELOCATION RECORDS FOR [.text]: |RELOCATION RECORDS FOR [.text]:
|offset type value |offset type value
|00000006 32 _foo |00000006 32 _foo
@ -176,21 +173,17 @@ DESCRIPTION
|0000000c 4e5e ; unlk fp |0000000c 4e5e ; unlk fp
|0000000e 4e75 ; rts |0000000e 4e75 ; rts
Using coff and an 88k, some instructions don't have enough Using coff and an 88k, some instructions don't have enough
space in them to represent the full address range, and space in them to represent the full address range, and
pointers have to be loaded in two parts. So you'd get something like: pointers have to be loaded in two parts. So you'd get something like:
| or.u r13,r0,hi16(_foo+0x12345678) | or.u r13,r0,hi16(_foo+0x12345678)
| ld.b r2,r13,lo16(_foo+0x12345678) | ld.b r2,r13,lo16(_foo+0x12345678)
| jmp r1 | jmp r1
This should create two relocs, both pointing to <<_foo>>, and with This should create two relocs, both pointing to <<_foo>>, and with
0x12340000 in their addend field. The data would consist of: 0x12340000 in their addend field. The data would consist of:
|RELOCATION RECORDS FOR [.text]: |RELOCATION RECORDS FOR [.text]:
|offset type value |offset type value
|00000002 HVRT16 _foo+0x12340000 |00000002 HVRT16 _foo+0x12340000
@ -200,7 +193,6 @@ DESCRIPTION
|00000004 1c4d5678 ; ld.b r2,r13,0x5678 |00000004 1c4d5678 ; ld.b r2,r13,0x5678
|00000008 f400c001 ; jmp r1 |00000008 f400c001 ; jmp r1
The relocation routine digs out the value from the data, adds The relocation routine digs out the value from the data, adds
it to the addend to get the original offset, and then adds the it to the addend to get the original offset, and then adds the
value of <<_foo>>. Note that all 32 bits have to be kept around value of <<_foo>>. Note that all 32 bits have to be kept around
@ -223,7 +215,6 @@ DESCRIPTION
Both relocs contain a pointer to <<foo>>, and the offsets Both relocs contain a pointer to <<foo>>, and the offsets
contain junk. contain junk.
|RELOCATION RECORDS FOR [.text]: |RELOCATION RECORDS FOR [.text]:
|offset type value |offset type value
|00000004 HI22 _foo+0x12345678 |00000004 HI22 _foo+0x12345678
@ -235,7 +226,6 @@ DESCRIPTION
|0000000c 81c7e008 ; ret |0000000c 81c7e008 ; ret
|00000010 81e80000 ; restore |00000010 81e80000 ; restore
o <<howto>> o <<howto>>
The <<howto>> field can be imagined as a The <<howto>> field can be imagined as a
@ -391,7 +381,6 @@ FUNCTION
DESCRIPTION DESCRIPTION
The HOWTO define is horrible and will go away. The HOWTO define is horrible and will go away.
.#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \ .#define HOWTO(C, R,S,B, P, BI, O, SF, NAME, INPLACE, MASKSRC, MASKDST, PC) \
. {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC} . {(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
@ -399,7 +388,6 @@ DESCRIPTION
And will be replaced with the totally magic way. But for the And will be replaced with the totally magic way. But for the
moment, we are compatible, so do it this way. moment, we are compatible, so do it this way.
.#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN) .#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
. .
@ -589,7 +577,6 @@ DESCRIPTION
*/ */
bfd_reloc_status_type bfd_reloc_status_type
bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd, bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
error_message) error_message)
@ -651,7 +638,6 @@ bfd_perform_relocation (abfd, reloc_entry, data, input_section, output_bfd,
else else
relocation = symbol->value; relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section; reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */ /* Convert input-section-relative symbol value to absolute. */
@ -990,7 +976,6 @@ DESCRIPTION
*/ */
bfd_reloc_status_type bfd_reloc_status_type
bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset, bfd_install_relocation (abfd, reloc_entry, data_start, data_start_offset,
input_section, error_message) input_section, error_message)
@ -1780,7 +1765,6 @@ displacements off that register. These relocation types are
handled specially, because the value the register will have is handled specially, because the value the register will have is
decided relatively late. decided relatively late.
ENUM ENUM
BFD_RELOC_I960_CALLJ BFD_RELOC_I960_CALLJ
ENUMDOC ENUMDOC
@ -2600,15 +2584,15 @@ ENUMDOC
ENUM ENUM
BFD_RELOC_TIC54X_16_OF_23 BFD_RELOC_TIC54X_16_OF_23
ENUMDOC ENUMDOC
This is a 16-bit reloc for the tms320c54x, where the least This is a 16-bit reloc for the tms320c54x, where the least
significant 16 bits of a 23-bit extended address are placed into significant 16 bits of a 23-bit extended address are placed into
the opcode. the opcode.
ENUM ENUM
BFD_RELOC_TIC54X_MS7_OF_23 BFD_RELOC_TIC54X_MS7_OF_23
ENUMDOC ENUMDOC
This is a reloc for the tms320c54x, where the most This is a reloc for the tms320c54x, where the most
significant 7 bits of a 23-bit extended address are placed into significant 7 bits of a 23-bit extended address are placed into
the opcode. the opcode.
ENUM ENUM
@ -2680,7 +2664,7 @@ ENUM
BFD_RELOC_AVR_16_PM BFD_RELOC_AVR_16_PM
ENUMDOC ENUMDOC
This is a 16 bit reloc for the AVR that stores 17 bit value (usually This is a 16 bit reloc for the AVR that stores 17 bit value (usually
program memory address) into 16 bits. program memory address) into 16 bits.
ENUM ENUM
BFD_RELOC_AVR_LO8_LDI BFD_RELOC_AVR_LO8_LDI
ENUMDOC ENUMDOC
@ -3009,7 +2993,6 @@ CODE_FRAGMENT
.typedef enum bfd_reloc_code_real bfd_reloc_code_real_type; .typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
*/ */
/* /*
FUNCTION FUNCTION
bfd_reloc_type_lookup bfd_reloc_type_lookup
@ -3025,7 +3008,6 @@ DESCRIPTION
*/ */
reloc_howto_type * reloc_howto_type *
bfd_reloc_type_lookup (abfd, code) bfd_reloc_type_lookup (abfd, code)
bfd *abfd; bfd *abfd;
@ -3037,7 +3019,6 @@ bfd_reloc_type_lookup (abfd, code)
static reloc_howto_type bfd_howto_32 = static reloc_howto_type bfd_howto_32 =
HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true); HOWTO (0, 00, 2, 32, false, 0, complain_overflow_bitfield, 0, "VRT32", false, 0xffffffff, 0xffffffff, true);
/* /*
INTERNAL_FUNCTION INTERNAL_FUNCTION
bfd_default_reloc_type_lookup bfd_default_reloc_type_lookup
@ -3049,7 +3030,6 @@ SYNOPSIS
DESCRIPTION DESCRIPTION
Provides a default relocation lookup routine for any architecture. Provides a default relocation lookup routine for any architecture.
*/ */
reloc_howto_type * reloc_howto_type *

View file

@ -2,7 +2,7 @@
Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Copyright (C) 1994, 95, 96, 97, 98, 99, 2000
Free Software Foundation, Inc. Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org) Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library. This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@ -19,7 +19,6 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* RISC iX overloads the MAGIC field to indicate more than just the usual /* RISC iX overloads the MAGIC field to indicate more than just the usual
[ZNO]MAGIC values. Also included are squeezing information and [ZNO]MAGIC values. Also included are squeezing information and
shared library usage. */ shared library usage. */
@ -37,17 +36,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */ #define SPOMAGIC (MF_USES_SL|OMAGIC) /* OMAGIC with large header */
/* -- may contain a ref to a */ /* -- may contain a ref to a */
/* shared lib required by the */ /* shared lib required by the */
/* object. */ /* object. */
#define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */ #define SLOMAGIC (MF_IS_SL|OMAGIC) /* A reference to a shared library */
/* The text portion of the object */ /* The text portion of the object */
/* contains "overflow text" from */ /* contains "overflow text" from */
/* the shared library to be linked */ /* the shared library to be linked */
/* in with an object */ /* in with an object */
#define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */ #define QMAGIC (MF_SQUEEZED|ZMAGIC) /* Sqeezed demand paged. */
/* NOTE: This interpretation of */ /* NOTE: This interpretation of */
/* QMAGIC seems to be at variance */ /* QMAGIC seems to be at variance */
/* With that used on other */ /* With that used on other */
/* architectures. */ /* architectures. */
#define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */ #define SPZMAGIC (MF_USES_SL|ZMAGIC) /* program which uses sl */
#define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */ #define SPQMAGIC (MF_USES_SL|QMAGIC) /* sqeezed ditto */
#define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */ #define SLZMAGIC (MF_IS_SL|ZMAGIC) /* shared lib part of prog */
@ -116,20 +115,20 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \ if (bfd_get_outsymbols (abfd) != (asymbol **) NULL \
&& bfd_get_symcount (abfd) != 0) \ && bfd_get_symcount (abfd) != 0) \
{ \ { \
if (bfd_seek (abfd, (file_ptr)(N_SYMOFF(*execp)), SEEK_SET) != 0) \ if (bfd_seek (abfd, (file_ptr) (N_SYMOFF(*execp)), SEEK_SET) != 0) \
return false; \ return false; \
\ \
if (! NAME(aout,write_syms)(abfd)) return false; \ if (! NAME(aout,write_syms) (abfd)) return false; \
\ \
if (bfd_seek (abfd, (file_ptr)(N_TRELOFF(*execp)), SEEK_SET) != 0) \ if (bfd_seek (abfd, (file_ptr) (N_TRELOFF(*execp)), SEEK_SET) != 0) \
return false; \ return false; \
\ \
if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \ if (! riscix_squirt_out_relocs (abfd, obj_textsec (abfd))) \
return false; \ return false; \
if (bfd_seek (abfd, (file_ptr)(N_DRELOFF(*execp)), SEEK_SET) != 0) \ if (bfd_seek (abfd, (file_ptr) (N_DRELOFF(*execp)), SEEK_SET) != 0) \
return false; \ return false; \
\ \
if (!NAME(aout,squirt_out_relocs)(abfd, obj_datasec (abfd))) \ if (!NAME(aout,squirt_out_relocs) (abfd, obj_datasec (abfd))) \
return false; \ return false; \
} \ } \
} }
@ -163,7 +162,6 @@ static reloc_howto_type riscix_std_reloc_howto[] = {
#define RISCIX_TABLE_SIZE \ #define RISCIX_TABLE_SIZE \
(sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type)) (sizeof (riscix_std_reloc_howto) / sizeof (reloc_howto_type))
static bfd_reloc_status_type static bfd_reloc_status_type
riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section, riscix_fix_pcrel_26_done (abfd, reloc_entry, symbol, data, input_section,
output_bfd, error_message) output_bfd, error_message)
@ -194,7 +192,7 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
bfd_size_type addr = reloc_entry->address; bfd_size_type addr = reloc_entry->address;
long target = bfd_get_32 (abfd, (bfd_byte *) data + addr); long target = bfd_get_32 (abfd, (bfd_byte *) data + addr);
bfd_reloc_status_type flag = bfd_reloc_ok; bfd_reloc_status_type flag = bfd_reloc_ok;
/* If this is an undefined symbol, return error */ /* If this is an undefined symbol, return error */
if (symbol->section == &bfd_und_section if (symbol->section == &bfd_und_section
&& (symbol->flags & BSF_WEAK) == 0) && (symbol->flags & BSF_WEAK) == 0)
@ -234,7 +232,7 @@ riscix_fix_pcrel_26 (abfd, reloc_entry, symbol, data, input_section,
/* Now the ARM magic... Change the reloc type so that it is marked as done. /* Now the ARM magic... Change the reloc type so that it is marked as done.
Strictly this is only necessary if we are doing a partial relocation. */ Strictly this is only necessary if we are doing a partial relocation. */
reloc_entry->howto = &riscix_std_reloc_howto[7]; reloc_entry->howto = &riscix_std_reloc_howto[7];
return flag; return flag;
} }
@ -304,10 +302,9 @@ riscix_swap_std_reloc_out (abfd, g, natptr)
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the /* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
relocation has been done already (Only for the 26-bit one I think)???!!! relocation has been done already (Only for the 26-bit one I think)???!!!
*/ */
if (r_length == 3) if (r_length == 3)
r_pcrel = r_pcrel ? 0 : 1; r_pcrel = r_pcrel ? 0 : 1;
#if 0 #if 0
/* For a standard reloc, the addend is in the object file. */ /* For a standard reloc, the addend is in the object file. */
@ -382,7 +379,7 @@ riscix_squirt_out_relocs (abfd, section)
arelent **generic; arelent **generic;
unsigned char *native, *natptr; unsigned char *native, *natptr;
size_t each_size; size_t each_size;
unsigned int count = section->reloc_count; unsigned int count = section->reloc_count;
size_t natsize; size_t natsize;
@ -412,13 +409,12 @@ riscix_squirt_out_relocs (abfd, section)
return true; return true;
} }
/* /*
* This is just like the standard aoutx.h version but we need to do our * This is just like the standard aoutx.h version but we need to do our
* own mapping of external reloc type values to howto entries. * own mapping of external reloc type values to howto entries.
*/ */
long long
MY(canonicalize_reloc)(abfd, section, relptr, symbols) MY(canonicalize_reloc) (abfd, section, relptr, symbols)
bfd *abfd; bfd *abfd;
sec_ptr section; sec_ptr section;
arelent **relptr; arelent **relptr;
@ -428,7 +424,7 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
unsigned int count, c; unsigned int count, c;
extern reloc_howto_type NAME(aout,std_howto_table)[]; extern reloc_howto_type NAME(aout,std_howto_table)[];
/* If we have already read in the relocation table, return the values. */ /* If we have already read in the relocation table, return the values. */
if (section->flags & SEC_CONSTRUCTOR) { if (section->flags & SEC_CONSTRUCTOR) {
arelent_chain *chain = section->constructor_chain; arelent_chain *chain = section->constructor_chain;
@ -446,7 +442,7 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
return section->reloc_count; return section->reloc_count;
} }
if (!NAME(aout,slurp_reloc_table)(abfd, section, symbols)) if (!NAME(aout,slurp_reloc_table) (abfd, section, symbols))
return -1; return -1;
tblptr = section->relocation; tblptr = section->relocation;
@ -463,7 +459,7 @@ MY(canonicalize_reloc)(abfd, section, relptr, symbols)
return section->reloc_count; return section->reloc_count;
} }
/* This is the same as NAME(aout,some_aout_object_p), but has different /* This is the same as NAME(aout,some_aout_object_p), but has different
expansions of the macro definitions. */ expansions of the macro definitions. */
const bfd_target * const bfd_target *
@ -475,7 +471,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
struct aout_data_struct *rawptr, *oldrawptr; struct aout_data_struct *rawptr, *oldrawptr;
const bfd_target *result; const bfd_target *result;
rawptr = ((struct aout_data_struct *) rawptr = ((struct aout_data_struct *)
bfd_zalloc (abfd, sizeof (struct aout_data_struct ))); bfd_zalloc (abfd, sizeof (struct aout_data_struct )));
if (rawptr == NULL) if (rawptr == NULL)
@ -506,8 +502,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
if (N_DYNAMIC(*execp)) if (N_DYNAMIC(*execp))
abfd->flags |= DYNAMIC; abfd->flags |= DYNAMIC;
if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
if ((execp->a_info & MF_SQUEEZED) != 0) /* Squeezed files aren't supported
(yet)! */ (yet)! */
{ {
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
@ -545,7 +540,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
/* The default relocation entry size is that of traditional V7 Unix. */ /* The default relocation entry size is that of traditional V7 Unix. */
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
/* The default symbol entry size is that of traditional Unix. */ /* The default symbol entry size is that of traditional Unix. */
obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE; obj_symbol_entry_size (abfd) = EXTERNAL_NLIST_SIZE;
obj_aout_external_syms (abfd) = NULL; obj_aout_external_syms (abfd) = NULL;
@ -568,7 +563,7 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
: (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS)); : (SEC_ALLOC | SEC_LOAD | SEC_DATA | SEC_HAS_CONTENTS));
obj_bsssec (abfd)->flags = SEC_ALLOC; obj_bsssec (abfd)->flags = SEC_ALLOC;
result = (*callback_to_real_object_p)(abfd); result = (*callback_to_real_object_p) (abfd);
#if defined(MACH) || defined(STAT_FOR_EXEC) #if defined(MACH) || defined(STAT_FOR_EXEC)
/* The original heuristic doesn't work in some important cases. The /* The original heuristic doesn't work in some important cases. The
@ -611,7 +606,6 @@ riscix_some_aout_object_p (abfd, execp, callback_to_real_object_p)
return result; return result;
} }
static const bfd_target * static const bfd_target *
MY(object_p) (abfd) MY(object_p) (abfd)
bfd *abfd; bfd *abfd;
@ -634,12 +628,11 @@ MY(object_p) (abfd)
if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0; if (!(MACHTYPE_OK (N_MACHTYPE (exec)))) return 0;
#endif #endif
NAME(aout,swap_exec_header_in)(abfd, &exec_bytes, &exec); NAME(aout,swap_exec_header_in) (abfd, &exec_bytes, &exec);
target = riscix_some_aout_object_p (abfd, &exec, MY(callback)); target = riscix_some_aout_object_p (abfd, &exec, MY(callback));
return target; return target;
} }
#include "aout-target.h" #include "aout-target.h"

View file

@ -60,7 +60,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#undef SCNHDR #undef SCNHDR
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
/* Support for core file stuff.. */ /* Support for core file stuff.. */
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
@ -81,7 +80,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
AIX_CORE_DUMPX_CORE is defined (by configure) on AIX 4.3+, and AIX_CORE_DUMPX_CORE is defined (by configure) on AIX 4.3+, and
CORE_VERSION_1 is defined (by AIX core.h) as 2 on AIX 4.3+ and as 1 on AIX CORE_VERSION_1 is defined (by AIX core.h) as 2 on AIX 4.3+ and as 1 on AIX
4.1 and 4.2. AIX pre-4.1 (aka 3.x) either doesn't define CORE_VERSION_1 4.1 and 4.2. AIX pre-4.1 (aka 3.x) either doesn't define CORE_VERSION_1
or else defines it as 0. */ or else defines it as 0. */
#if defined(CORE_VERSION_1) && !CORE_VERSION_1 #if defined(CORE_VERSION_1) && !CORE_VERSION_1
# undef CORE_VERSION_1 # undef CORE_VERSION_1
@ -90,9 +89,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* The following union and macros allow this module to compile on all AIX /* The following union and macros allow this module to compile on all AIX
versions and to handle both core_dumpx and core_dump on 4.3+. CNEW_*() versions and to handle both core_dumpx and core_dump on 4.3+. CNEW_*()
and COLD_*() macros respectively retrieve core_dumpx and core_dump and COLD_*() macros respectively retrieve core_dumpx and core_dump
values. */ values. */
/* Union of 32-bit and 64-bit versions of ld_info. */ /* Union of 32-bit and 64-bit versions of ld_info. */
typedef union { typedef union {
#ifdef __ld_info32 #ifdef __ld_info32
@ -104,7 +103,7 @@ typedef union {
#endif #endif
} LdInfo; } LdInfo;
/* Union of old and new core dump structures. */ /* Union of old and new core dump structures. */
typedef union { typedef union {
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
@ -116,7 +115,7 @@ typedef union {
4.3+ with appropriate SMIT config */ 4.3+ with appropriate SMIT config */
} CoreHdr; } CoreHdr;
/* Union of old and new vm_info structures. */ /* Union of old and new vm_info structures. */
#ifdef CORE_VERSION_1 #ifdef CORE_VERSION_1
typedef union { typedef union {
@ -129,7 +128,7 @@ typedef union {
} VmInfo; } VmInfo;
#endif #endif
/* Return whether CoreHdr C is in new or old format. */ /* Return whether CoreHdr C is in new or old format. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CORE_NEW(c) (!(c).old.c_entries) # define CORE_NEW(c) (!(c).old.c_entries)
@ -137,7 +136,7 @@ typedef union {
# define CORE_NEW(c) 0 # define CORE_NEW(c) 0
#endif #endif
/* Return the c_stackorg field from struct core_dumpx C. */ /* Return the c_stackorg field from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_STACKORG(c) (c).c_stackorg # define CNEW_STACKORG(c) (c).c_stackorg
@ -145,7 +144,7 @@ typedef union {
# define CNEW_STACKORG(c) 0 # define CNEW_STACKORG(c) 0
#endif #endif
/* Return the offset to the loader region from struct core_dump C. */ /* Return the offset to the loader region from struct core_dump C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_LOADER(c) (c).c_loader # define CNEW_LOADER(c) (c).c_loader
@ -153,11 +152,11 @@ typedef union {
# define CNEW_LOADER(c) 0 # define CNEW_LOADER(c) 0
#endif #endif
/* Return the offset to the loader region from struct core_dump C. */ /* Return the offset to the loader region from struct core_dump C. */
#define COLD_LOADER(c) (c).c_tab #define COLD_LOADER(c) (c).c_tab
/* Return the c_lsize field from struct core_dumpx C. */ /* Return the c_lsize field from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_LSIZE(c) (c).c_lsize # define CNEW_LSIZE(c) (c).c_lsize
@ -165,7 +164,7 @@ typedef union {
# define CNEW_LSIZE(c) 0 # define CNEW_LSIZE(c) 0
#endif #endif
/* Return the c_dataorg field from struct core_dumpx C. */ /* Return the c_dataorg field from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_DATAORG(c) (c).c_dataorg # define CNEW_DATAORG(c) (c).c_dataorg
@ -173,7 +172,7 @@ typedef union {
# define CNEW_DATAORG(c) 0 # define CNEW_DATAORG(c) 0
#endif #endif
/* Return the c_datasize field from struct core_dumpx C. */ /* Return the c_datasize field from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_DATASIZE(c) (c).c_datasize # define CNEW_DATASIZE(c) (c).c_datasize
@ -181,7 +180,7 @@ typedef union {
# define CNEW_DATASIZE(c) 0 # define CNEW_DATASIZE(c) 0
#endif #endif
/* Return the c_impl field from struct core_dumpx C. */ /* Return the c_impl field from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_IMPL(c) (c).c_impl # define CNEW_IMPL(c) (c).c_impl
@ -189,7 +188,7 @@ typedef union {
# define CNEW_IMPL(c) 0 # define CNEW_IMPL(c) 0
#endif #endif
/* Return the command string from struct core_dumpx C. */ /* Return the command string from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_COMM(c) (c).c_u.U_proc.pi_comm # define CNEW_COMM(c) (c).c_u.U_proc.pi_comm
@ -197,7 +196,7 @@ typedef union {
# define CNEW_COMM(c) 0 # define CNEW_COMM(c) 0
#endif #endif
/* Return the command string from struct core_dump C. */ /* Return the command string from struct core_dump C. */
#ifdef CORE_VERSION_1 #ifdef CORE_VERSION_1
# define COLD_COMM(c) (c).c_u.U_comm # define COLD_COMM(c) (c).c_u.U_comm
@ -205,7 +204,7 @@ typedef union {
# define COLD_COMM(c) (c).c_u.u_comm # define COLD_COMM(c) (c).c_u.u_comm
#endif #endif
/* Return the struct __context64 pointer from struct core_dumpx C. */ /* Return the struct __context64 pointer from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_CONTEXT64(c) (c).c_flt.hctx.r64 # define CNEW_CONTEXT64(c) (c).c_flt.hctx.r64
@ -213,7 +212,7 @@ typedef union {
# define CNEW_CONTEXT64(c) c # define CNEW_CONTEXT64(c) c
#endif #endif
/* Return the struct mstsave pointer from struct core_dumpx C. */ /* Return the struct mstsave pointer from struct core_dumpx C. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_MSTSAVE(c) (c).c_flt.hctx.r32 # define CNEW_MSTSAVE(c) (c).c_flt.hctx.r32
@ -221,7 +220,7 @@ typedef union {
# define CNEW_MSTSAVE(c) c # define CNEW_MSTSAVE(c) c
#endif #endif
/* Return the struct mstsave pointer from struct core_dump C. */ /* Return the struct mstsave pointer from struct core_dump C. */
#ifdef CORE_VERSION_1 #ifdef CORE_VERSION_1
# define COLD_MSTSAVE(c) (c).c_mst # define COLD_MSTSAVE(c) (c).c_mst
@ -229,7 +228,7 @@ typedef union {
# define COLD_MSTSAVE(c) (c).c_u.u_save # define COLD_MSTSAVE(c) (c).c_u.u_save
#endif #endif
/* Return whether struct core_dumpx is from a 64-bit process. */ /* Return whether struct core_dumpx is from a 64-bit process. */
#ifdef AIX_CORE_DUMPX_CORE #ifdef AIX_CORE_DUMPX_CORE
# define CNEW_PROC64(c) IS_PROC64(&(c).c_u.U_proc) # define CNEW_PROC64(c) IS_PROC64(&(c).c_u.U_proc)
@ -238,7 +237,7 @@ typedef union {
#endif #endif
/* Magic end-of-stack addresses for old core dumps. This is _very_ fragile, /* Magic end-of-stack addresses for old core dumps. This is _very_ fragile,
but I don't see any easy way to get that info right now. */ but I don't see any easy way to get that info right now. */
#ifdef CORE_VERSION_1 #ifdef CORE_VERSION_1
# define COLD_STACKEND 0x2ff23000 # define COLD_STACKEND 0x2ff23000
@ -247,12 +246,12 @@ typedef union {
#endif #endif
/* Size of the leading portion that old and new core dump structures have in /* Size of the leading portion that old and new core dump structures have in
common. */ common. */
#define CORE_COMMONSZ ((int)&((struct core_dump *)0)->c_entries + \ #define CORE_COMMONSZ ((int)&((struct core_dump *)0)->c_entries + \
sizeof (((struct core_dump *)0)->c_entries)) sizeof (((struct core_dump *)0)->c_entries))
/* Try to read into CORE the header from the core file associated with ABFD. /* Try to read into CORE the header from the core file associated with ABFD.
Return success. */ Return success. */
static boolean static boolean
read_hdr (bfd *abfd, CoreHdr *core) read_hdr (bfd *abfd, CoreHdr *core)
@ -263,11 +262,11 @@ read_hdr (bfd *abfd, CoreHdr *core)
return false; return false;
/* Read the leading portion that old and new core dump structures have in /* Read the leading portion that old and new core dump structures have in
common. */ common. */
if (bfd_read (core, CORE_COMMONSZ, 1, abfd) != CORE_COMMONSZ) if (bfd_read (core, CORE_COMMONSZ, 1, abfd) != CORE_COMMONSZ)
return false; return false;
/* Read the trailing portion of the structure. */ /* Read the trailing portion of the structure. */
size = CORE_NEW (*core) ? sizeof (core->new) : sizeof (core->old) size = CORE_NEW (*core) ? sizeof (core->new) : sizeof (core->old)
- CORE_COMMONSZ; - CORE_COMMONSZ;
return bfd_read ((char *)core + CORE_COMMONSZ, size, 1, abfd) == size; return bfd_read ((char *)core + CORE_COMMONSZ, size, 1, abfd) == size;
@ -298,7 +297,7 @@ make_bfd_asection (abfd, name, flags, _raw_size, vma, filepos)
} }
/* Decide if a given bfd represents a `core' file or not. There really is no /* Decide if a given bfd represents a `core' file or not. There really is no
magic number or anything like, in rs6000coff. */ magic number or anything like, in rs6000coff. */
const bfd_target * const bfd_target *
rs6000coff_core_p (abfd) rs6000coff_core_p (abfd)
@ -309,7 +308,7 @@ rs6000coff_core_p (abfd)
bfd_size_type size; bfd_size_type size;
char *tmpptr; char *tmpptr;
/* Values from new and old core structures. */ /* Values from new and old core structures. */
int c_flag; int c_flag;
file_ptr c_stack, c_regoff, c_loader; file_ptr c_stack, c_regoff, c_loader;
bfd_size_type c_size, c_regsize, c_lsize; bfd_size_type c_size, c_regsize, c_lsize;
@ -324,7 +323,7 @@ rs6000coff_core_p (abfd)
return NULL; return NULL;
} }
/* Copy fields from new or old core structure. */ /* Copy fields from new or old core structure. */
if (CORE_NEW (core)) if (CORE_NEW (core))
{ {
c_flag = core.new.c_flag; c_flag = core.new.c_flag;
@ -401,7 +400,7 @@ rs6000coff_core_p (abfd)
additional shared library sections in a full core. */ additional shared library sections in a full core. */
if (!(c_flag & (FULL_CORE | CORE_TRUNC))) if (!(c_flag & (FULL_CORE | CORE_TRUNC)))
{ {
/* If the size is wrong, it means we're misinterpreting something. */ /* If the size is wrong, it means we're misinterpreting something. */
if (c_stack + (file_ptr) c_size != statbuf.st_size) if (c_stack + (file_ptr) c_size != statbuf.st_size)
{ {
bfd_set_error (bfd_error_wrong_format); bfd_set_error (bfd_error_wrong_format);
@ -433,7 +432,7 @@ rs6000coff_core_p (abfd)
memcpy (tmpptr, &core, size); memcpy (tmpptr, &core, size);
set_tdata (abfd, tmpptr); set_tdata (abfd, tmpptr);
/* Set architecture. */ /* Set architecture. */
if (CORE_NEW (core)) if (CORE_NEW (core))
{ {
enum bfd_architecture arch; enum bfd_architecture arch;
@ -455,13 +454,13 @@ rs6000coff_core_p (abfd)
bfd_default_set_arch_mach (abfd, arch, mach); bfd_default_set_arch_mach (abfd, arch, mach);
} }
/* .stack section. */ /* .stack section. */
if (!make_bfd_asection (abfd, ".stack", if (!make_bfd_asection (abfd, ".stack",
SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS, SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS,
c_size, c_stackend - c_size, c_stack)) c_size, c_stackend - c_size, c_stack))
return NULL; return NULL;
/* .reg section for all registers. */ /* .reg section for all registers. */
if (!make_bfd_asection (abfd, ".reg", if (!make_bfd_asection (abfd, ".reg",
SEC_HAS_CONTENTS, SEC_HAS_CONTENTS,
c_regsize, (bfd_vma) 0, c_regoff)) c_regsize, (bfd_vma) 0, c_regoff))
@ -506,7 +505,7 @@ rs6000coff_core_p (abfd)
uint ldi_next; uint ldi_next;
bfd_vma ldi_dataorg; bfd_vma ldi_dataorg;
/* Fields from new and old core structures. */ /* Fields from new and old core structures. */
bfd_size_type c_datasize, c_vmregions; bfd_size_type c_datasize, c_vmregions;
file_ptr c_data, c_vmm; file_ptr c_data, c_vmm;
@ -538,9 +537,9 @@ rs6000coff_core_p (abfd)
/* .data sections from loaded objects. */ /* .data sections from loaded objects. */
if (proc64) if (proc64)
size = (int)((LdInfo *)0)->l64.ldinfo_filename; size = (int) ((LdInfo *)0)->l64.ldinfo_filename;
else else
size = (int)((LdInfo *)0)->l32.ldinfo_filename; size = (int) ((LdInfo *)0)->l32.ldinfo_filename;
while (1) while (1)
{ {
@ -560,7 +559,7 @@ rs6000coff_core_p (abfd)
{ {
ldi_core = ldinfo.l32.ldinfo_core; ldi_core = ldinfo.l32.ldinfo_core;
ldi_datasize = ldinfo.l32.ldinfo_datasize; ldi_datasize = ldinfo.l32.ldinfo_datasize;
ldi_dataorg = (bfd_vma)(long) ldinfo.l32.ldinfo_dataorg; ldi_dataorg = (bfd_vma) (long) ldinfo.l32.ldinfo_dataorg;
ldi_next = ldinfo.l32.ldinfo_next; ldi_next = ldinfo.l32.ldinfo_next;
} }
@ -602,7 +601,7 @@ rs6000coff_core_p (abfd)
} }
else else
{ {
vminfo_addr = (bfd_vma)(long) vminfo.old.vminfo_addr; vminfo_addr = (bfd_vma) (long) vminfo.old.vminfo_addr;
vminfo_size = vminfo.old.vminfo_size; vminfo_size = vminfo.old.vminfo_size;
vminfo_offset = vminfo.old.vminfo_offset; vminfo_offset = vminfo.old.vminfo_offset;
} }
@ -618,12 +617,10 @@ rs6000coff_core_p (abfd)
} }
#endif #endif
return abfd->xvec; /* this is garbage for now. */ return abfd->xvec; /* this is garbage for now. */
} }
/* return `true' if given core is from the given executable.. */
/* return `true' if given core is from the given executable.. */
boolean boolean
rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd) rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
bfd *core_bfd; bfd *core_bfd;
@ -646,9 +643,9 @@ rs6000coff_core_file_matches_executable_p (core_bfd, exec_bfd)
c_loader = (file_ptr) COLD_LOADER (core.old); c_loader = (file_ptr) COLD_LOADER (core.old);
if (CORE_NEW (core) && CNEW_PROC64 (core.new)) if (CORE_NEW (core) && CNEW_PROC64 (core.new))
size = (int)((LdInfo *)0)->l64.ldinfo_filename; size = (int) ((LdInfo *)0)->l64.ldinfo_filename;
else else
size = (int)((LdInfo *)0)->l32.ldinfo_filename; size = (int) ((LdInfo *)0)->l32.ldinfo_filename;
if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0) if (bfd_seek (core_bfd, c_loader + size, SEEK_SET) != 0)
return false; return false;

View file

@ -146,7 +146,7 @@ extern unsigned int _bfd_xcoff_swap_aux_out PARAMS ((bfd *, PTR, int, int, int,
#include "coffcode.h" #include "coffcode.h"
/* The transfer vector that leads the outside world to all of the above. */ /* The transfer vector that leads the outside world to all of the above. */
const bfd_target TARGET_SYM = const bfd_target TARGET_SYM =
{ {
@ -189,6 +189,6 @@ const bfd_target TARGET_SYM =
BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff), BFD_JUMP_TABLE_DYNAMIC (_bfd_xcoff),
NULL, NULL,
COFF_SWAP_TABLE COFF_SWAP_TABLE
}; };