Documentation
This commit is contained in:
parent
90f3f3e2b0
commit
c618de01c1
|
@ -31,6 +31,22 @@ ChangeLog
|
||||||
Makefile.in
|
Makefile.in
|
||||||
TODO
|
TODO
|
||||||
VERSION
|
VERSION
|
||||||
|
awkscan
|
||||||
|
awkscan-ip
|
||||||
|
awkscan-p
|
||||||
|
blins-p
|
||||||
|
exfilter
|
||||||
|
exmerge
|
||||||
|
intobfd
|
||||||
|
mergecom-p
|
||||||
|
movecom-p
|
||||||
|
scanit
|
||||||
|
scanph
|
||||||
|
sedscript
|
||||||
|
sedscript-p
|
||||||
|
startcom-p
|
||||||
|
tolibbfd
|
||||||
|
tolibcoff
|
||||||
amdcoff.c
|
amdcoff.c
|
||||||
aout32.c
|
aout32.c
|
||||||
aout64.c
|
aout64.c
|
||||||
|
@ -107,7 +123,10 @@ echo Done in `pwd`.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# $Log$
|
# $Log$
|
||||||
# Revision 1.13 1991/08/01 14:37:51 steve
|
# Revision 1.14 1991/08/17 00:17:00 steve
|
||||||
|
# Documentation
|
||||||
|
#
|
||||||
|
# Revision 1.13 1991/08/01 14:37:51 steve
|
||||||
# *** empty log message ***
|
# *** empty log message ***
|
||||||
#
|
#
|
||||||
# Revision 1.12 1991/08/01 05:33:39 gnu
|
# Revision 1.12 1991/08/01 05:33:39 gnu
|
||||||
|
|
|
@ -1,9 +1,25 @@
|
||||||
|
Thu Aug 8 16:47:43 1991 Steve Chamberlain (steve at cygint.cygnus.com)
|
||||||
|
|
||||||
|
* coffcode.h: fixed bug where string table size wasn't being swapped.
|
||||||
|
|
||||||
|
Thu Aug 1 16:35:28 1991 Steve Chamberlain (steve at cygint.cygnus.com)
|
||||||
|
|
||||||
|
* section.c: added SEC_CONSTRUCTOR_TEXT|DATA|BSS flags
|
||||||
|
|
||||||
|
* syms.c: added BSF_CONSTRUCTOR, BSF_WARNING and BSF_INDIRECT
|
||||||
|
flags. (bfd_print_symbol_vandf) now knows what to do with the
|
||||||
|
above flags.
|
||||||
|
|
||||||
|
* aoutx.h: made translate_from_native_sym_flags and
|
||||||
|
translate_to_native_sym_flags produce the above flags.
|
||||||
|
|
||||||
|
|
||||||
Wed Jul 31 09:53:52 1991 John Gilmore (gnu at cygint.cygnus.com)
|
Wed Jul 31 09:53:52 1991 John Gilmore (gnu at cygint.cygnus.com)
|
||||||
|
|
||||||
* all files: update copyright notices for GPL version 2.
|
* all files: update copyright notices for GPL version 2.
|
||||||
Install header comments and attribute most modules to their
|
Install header comments and attribute most modules to their
|
||||||
authors. BFD's name is now officially "Binary File Descriptor",
|
authors. BFD's name is now officially "Binary File Descriptor",
|
||||||
so remove any conflicting perjoratives.
|
so remove any conflicting pejoratives.
|
||||||
archures.h: Consists solely of comments; remove it.
|
archures.h: Consists solely of comments; remove it.
|
||||||
|
|
||||||
Fri Jul 26 18:11:34 1991 Steve Chamberlain (steve at cygint.cygnus.com)
|
Fri Jul 26 18:11:34 1991 Steve Chamberlain (steve at cygint.cygnus.com)
|
||||||
|
|
128
bfd/aoutx.h
128
bfd/aoutx.h
|
@ -74,6 +74,8 @@ requires all the names from aout32.c, and produces the jump vector
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define KEEPIT flags
|
||||||
|
#define KEEPITTYPE int
|
||||||
|
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
|
@ -232,24 +234,24 @@ static reloc_howto_type howto_table_ext[] =
|
||||||
HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0,0x00000000, false),
|
HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, false, true,0,"RELATIVE", false, 0,0x00000000, false),
|
||||||
|
|
||||||
/* start-sanitize-v9 */
|
/* start-sanitize-v9 */
|
||||||
#ifdef HOST_64_BIT
|
|
||||||
HOWTO(RELOC_11, 0, 2, 21, true, 0, false, true,r64,"11", false, 0,/*0x00000000001fffff*/0, false),
|
HOWTO(RELOC_11, 0, 2, 21, true, 0, false, true,r64,"11", false, 0,/*0x00000000001fffff*/0, false),
|
||||||
HOWTO(RELOC_WDISP2_14, 0, 2, 21, true, 0, false, true,r64,"DISP2_14",false, 0,/*0x00000000001fffff*/0, false),
|
HOWTO(RELOC_WDISP2_14, 0, 2, 21, true, 0, false, true,r64,"DISP2_14",false, 0,/*0x00000000001fffff*/0, false),
|
||||||
HOWTO(RELOC_WDISP19, 0, 3, 64, true, 0, false, true,r64,"DISP19", false, 0,/*0xffffffffffffffff*/0, false),
|
HOWTO(RELOC_WDISP19, 0, 3, 64, true, 0, false, true,r64,"DISP19", false, 0,/*0xffffffffffffffff*/0, false),
|
||||||
HOWTO(RELOC_HHI22, 42, 3, 22, false, 0, false, true,hhi22,"HHI22",false, 0,/*0x003fffff00000000*/0, false),
|
HOWTO(RELOC_HHI22, 42, 3, 22, false, 0, false, true,hhi22,"HHI22",false, 0,/*0x003fffff00000000*/0, false),
|
||||||
HOWTO(RELOC_HLO10, 32, 3, 10, false, 0, false, true,hlo10,"HLO10", false, 0,/*0x000003ff00000000*/0, false),
|
HOWTO(RELOC_HLO10, 32, 3, 10, false, 0, false, true,hlo10,"HLO10", false, 0,/*0x000003ff00000000*/0, false),
|
||||||
#endif
|
|
||||||
HOWTO(RELOC_JUMPTARG,2, 13, 16, true, 0, false, true,0,"JUMPTARG", false, 0,0x0000ffff, false),
|
HOWTO(RELOC_JUMPTARG,2, 13, 16, true, 0, false, true,0,"JUMPTARG", false, 0,0x0000ffff, false),
|
||||||
HOWTO(RELOC_CONST, 0, 13, 16, false, 0, false, true,0,"CONST", false, 0,0x0000ffff, false),
|
HOWTO(RELOC_CONST, 0, 13, 16, false, 0, false, true,0,"CONST", false, 0,0x0000ffff, false),
|
||||||
HOWTO(RELOC_CONSTH, 16, 13, 16, false, 0, false, true,0,"CONSTH", false, 0,0x0000ffff, false),
|
HOWTO(RELOC_CONSTH, 16, 13, 16, false, 0, false, true,0,"CONSTH", false, 0,0x0000ffff, false),
|
||||||
|
|
||||||
#ifdef HOST_64_BIT
|
|
||||||
HOWTO(RELOC_64, 0, 3, 64, false, 0, true, true,reloc64,"64", false, 0,/*0xffffffffffffffff*/0, false),
|
HOWTO(RELOC_64, 0, 3, 64, false, 0, true, true,reloc64,"64", false, 0,/*0xffffffffffffffff*/0, false),
|
||||||
HOWTO(RELOC_DISP64, 0, 3, 64, true, 0, false, true,disp64,"DISP64", false, 0,/*0xffffffffffffffff*/0, false),
|
HOWTO(RELOC_DISP64, 0, 3, 64, true, 0, false, true,disp64,"DISP64", false, 0,/*0xffffffffffffffff*/0, false),
|
||||||
HOWTO(RELOC_WDISP21,2, 2, 21, true, 0, false, true,r64,"WDISP21",false, 0,/*0x00000000001fffff*/0, false),
|
HOWTO(RELOC_WDISP21,2, 2, 21, true, 0, false, true,r64,"WDISP21",false, 0,/*0x00000000001fffff*/0, false),
|
||||||
HOWTO(RELOC_DISP21, 0, 2, 21, true, 0, false, true,r64,"DISP21", false, 0,/*0x00000000001fffff*/0, false),
|
HOWTO(RELOC_DISP21, 0, 2, 21, true, 0, false, true,r64,"DISP21", false, 0,/*0x00000000001fffff*/0, false),
|
||||||
HOWTO(RELOC_DISP14, 0, 2, 14, true, 0, false, true,r64,"DISP21", false, 0,/*0x0000000000003fff*/0, false),
|
HOWTO(RELOC_DISP14, 0, 2, 14, true, 0, false, true,r64,"DISP21", false, 0,/*0x0000000000003fff*/0, false),
|
||||||
#endif
|
|
||||||
/* end-sanitize-v9 */
|
/* end-sanitize-v9 */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -749,62 +751,62 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
struct external_nlist *sym_pointer AND
|
struct external_nlist *sym_pointer AND
|
||||||
aout_symbol_type *cache_ptr AND
|
aout_symbol_type *cache_ptr AND
|
||||||
bfd *abfd)
|
bfd *abfd)
|
||||||
{
|
{
|
||||||
switch (cache_ptr->type & N_TYPE) {
|
switch (cache_ptr->type & N_TYPE) {
|
||||||
case N_SETA:
|
case N_SETA:
|
||||||
case N_SETT:
|
case N_SETT:
|
||||||
case N_SETD:
|
case N_SETD:
|
||||||
case N_SETB:
|
case N_SETB:
|
||||||
{
|
{
|
||||||
char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1);
|
char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1);
|
||||||
asection *section ;
|
asection *section ;
|
||||||
arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain));
|
arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain));
|
||||||
strcpy(copy, cache_ptr->symbol.name);
|
strcpy(copy, cache_ptr->symbol.name);
|
||||||
section = bfd_make_section(abfd,copy);
|
section = bfd_make_section(abfd,copy);
|
||||||
switch ( (cache_ptr->type & N_TYPE) ) {
|
switch ( (cache_ptr->type & N_TYPE) ) {
|
||||||
case N_SETA:
|
case N_SETA:
|
||||||
section->flags = SEC_CONSTRUCTOR;
|
section->flags = SEC_CONSTRUCTOR;
|
||||||
reloc->relent.section = (asection *)NULL;
|
reloc->relent.section = (asection *)NULL;
|
||||||
cache_ptr->symbol.section = (asection *)NULL;
|
cache_ptr->symbol.section = (asection *)NULL;
|
||||||
break;
|
break;
|
||||||
case N_SETT:
|
case N_SETT:
|
||||||
section->flags = SEC_CONSTRUCTOR_TEXT;
|
section->flags = SEC_CONSTRUCTOR_TEXT;
|
||||||
reloc->relent.section = (asection *)obj_textsec(abfd);
|
reloc->relent.section = (asection *)obj_textsec(abfd);
|
||||||
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
||||||
break;
|
break;
|
||||||
case N_SETD:
|
case N_SETD:
|
||||||
section->flags = SEC_CONSTRUCTOR_DATA;
|
section->flags = SEC_CONSTRUCTOR_DATA;
|
||||||
reloc->relent.section = (asection *)obj_datasec(abfd);
|
reloc->relent.section = (asection *)obj_datasec(abfd);
|
||||||
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
||||||
break;
|
break;
|
||||||
case N_SETB:
|
case N_SETB:
|
||||||
section->flags = SEC_CONSTRUCTOR_BSS;
|
section->flags = SEC_CONSTRUCTOR_BSS;
|
||||||
reloc->relent.section = (asection *)obj_bsssec(abfd);
|
reloc->relent.section = (asection *)obj_bsssec(abfd);
|
||||||
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
cache_ptr->symbol.value -= reloc->relent.section->vma;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cache_ptr->symbol.section = reloc->relent.section;
|
cache_ptr->symbol.section = reloc->relent.section;
|
||||||
reloc->relent.addend = cache_ptr->symbol.value ;
|
reloc->relent.addend = cache_ptr->symbol.value ;
|
||||||
|
|
||||||
/* We modify the symbol to belong to a section depending upon the
|
/* We modify the symbol to belong to a section depending upon the
|
||||||
name of the symbol - probably __CTOR__ or __DTOR__ but we don't
|
name of the symbol - probably __CTOR__ or __DTOR__ but we don't
|
||||||
really care, and add to the size of the section to contain a
|
really care, and add to the size of the section to contain a
|
||||||
pointer to the symbol. Build a reloc entry to relocate to this
|
pointer to the symbol. Build a reloc entry to relocate to this
|
||||||
symbol attached to this section. */
|
symbol attached to this section. */
|
||||||
|
|
||||||
|
|
||||||
section->reloc_count++;
|
section->reloc_count++;
|
||||||
section->alignment_power = 2;
|
section->alignment_power = 2;
|
||||||
reloc->relent.sym_ptr_ptr = (asymbol **)NULL;
|
reloc->relent.sym_ptr_ptr = (asymbol **)NULL;
|
||||||
reloc->next = section->constructor_chain;
|
reloc->next = section->constructor_chain;
|
||||||
section->constructor_chain = reloc;
|
section->constructor_chain = reloc;
|
||||||
reloc->relent.address = section->size;
|
reloc->relent.address = section->size;
|
||||||
section->size += sizeof(int *);
|
section->size += sizeof(int *);
|
||||||
|
|
||||||
reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX;
|
reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX;
|
||||||
cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR;
|
cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (cache_ptr->type == N_WARNING)
|
if (cache_ptr->type == N_WARNING)
|
||||||
{
|
{
|
||||||
|
@ -816,7 +818,7 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
||||||
(sym_pointer+1)->e_type[0] = 0xff;
|
(sym_pointer+1)->e_type[0] = 0xff;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (cache_ptr->type == N_INDR) {
|
if ((cache_ptr->type | N_EXT) == (N_INDR | N_EXT)) {
|
||||||
/* Two symbols in a row for an INDR message. The first symbol
|
/* Two symbols in a row for an INDR message. The first symbol
|
||||||
contains the name we will match, the second symbol contains the
|
contains the name we will match, the second symbol contains the
|
||||||
name the first name is translated into. It is supplied to us
|
name the first name is translated into. It is supplied to us
|
||||||
|
@ -1114,7 +1116,7 @@ DEFUN(NAME(aout,write_syms),(abfd),
|
||||||
bfd_write((PTR)g->name, 1, length, abfd);
|
bfd_write((PTR)g->name, 1, length, abfd);
|
||||||
}
|
}
|
||||||
if ((g->flags & BSF_FAKE)==0) {
|
if ((g->flags & BSF_FAKE)==0) {
|
||||||
g->name = itos(count); /* smash the generic symbol */
|
g->KEEPIT = (KEEPITTYPE) count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1176,7 @@ DEFUN(NAME(aout,swap_std_reloc_out),(abfd, g, natptr),
|
||||||
r_addend += (*(g->sym_ptr_ptr))->section->vma;
|
r_addend += (*(g->sym_ptr_ptr))->section->vma;
|
||||||
}
|
}
|
||||||
|
|
||||||
r_index = stoi((*(g->sym_ptr_ptr))->name);
|
r_index = ((*(g->sym_ptr_ptr))->KEEPIT);
|
||||||
r_extern = 1;
|
r_extern = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1260,7 +1262,7 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
|
||||||
r_addend += (*(g->sym_ptr_ptr))->section->vma;
|
r_addend += (*(g->sym_ptr_ptr))->section->vma;
|
||||||
}
|
}
|
||||||
|
|
||||||
r_index = stoi((*(g->sym_ptr_ptr))->name);
|
r_index = stoi((*(g->sym_ptr_ptr))->KEEPIT);
|
||||||
r_extern = 1;
|
r_extern = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
320
bfd/archures.c
320
bfd/archures.c
|
@ -1,28 +1,90 @@
|
||||||
/* BFD library support routines for architectures. */
|
/* BFD library support routines for architectures.
|
||||||
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
|
Hacked by John Gilmore of Cygnus Support.
|
||||||
|
|
||||||
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Diddler.
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
|
||||||
BFD 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
|
||||||
the Free Software Foundation; either version 1, or (at your option)
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
BFD is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with BFD; see the file COPYING. If not, write to
|
along with this program; if not, write to the Free Software
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
|
/*doc*
|
||||||
|
@section Architectures
|
||||||
|
BFD's idea of an architecture is implimented in @code{archures.c}. BFD
|
||||||
|
keeps two atoms in a bfd describing the architecture of the data
|
||||||
|
attatched to the bfd, the @code{enum bfd_architecture arch} field and
|
||||||
|
the @code{unsigned long machine} field.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*proto* bfd_architecture
|
||||||
|
This enum gives the object file's CPU
|
||||||
|
architecture, in a global sense. E.g. what processor family does it
|
||||||
|
belong to? There is another field, which indicates what processor
|
||||||
|
within the family is in use. The machine gives a number which
|
||||||
|
distingushes different versions of the architecture, containing for
|
||||||
|
example 2 and 3 for Intel i960 KA and i960 KB, and 68020 and 68030 for
|
||||||
|
Motorola 68020 and 68030.
|
||||||
|
|
||||||
|
*+
|
||||||
|
enum bfd_architecture
|
||||||
|
{
|
||||||
|
bfd_arch_unknown, {* File arch not known *}
|
||||||
|
bfd_arch_obscure, {* Arch known, not one of these *}
|
||||||
|
bfd_arch_m68k, {* Motorola 68xxx *}
|
||||||
|
bfd_arch_vax, {* DEC Vax *}
|
||||||
|
bfd_arch_i960, {* Intel 960 *}
|
||||||
|
{* The order of the following is important.
|
||||||
|
lower number indicates a machine type that
|
||||||
|
only accepts a subset of the instructions
|
||||||
|
available to machines with higher numbers.
|
||||||
|
The exception is the "ca", which is
|
||||||
|
incompatible with all other machines except
|
||||||
|
"core". *}
|
||||||
|
|
||||||
|
#define bfd_mach_i960_core 1
|
||||||
|
#define bfd_mach_i960_ka_sa 2
|
||||||
|
#define bfd_mach_i960_kb_sb 3
|
||||||
|
#define bfd_mach_i960_mc 4
|
||||||
|
#define bfd_mach_i960_xa 5
|
||||||
|
#define bfd_mach_i960_ca 6
|
||||||
|
|
||||||
|
bfd_arch_a29k, {* AMD 29000 *}
|
||||||
|
bfd_arch_sparc, {* SPARC *}
|
||||||
|
bfd_arch_mips, {* MIPS Rxxxx *}
|
||||||
|
bfd_arch_i386, {* Intel 386 *}
|
||||||
|
bfd_arch_ns32k, {* National Semiconductor 32xxx *}
|
||||||
|
bfd_arch_tahoe, {* CCI/Harris Tahoe *}
|
||||||
|
bfd_arch_i860, {* Intel 860 *}
|
||||||
|
bfd_arch_romp, {* IBM ROMP RS/6000 *}
|
||||||
|
bfd_arch_alliant, {* Alliant *}
|
||||||
|
bfd_arch_convex, {* Convex *}
|
||||||
|
bfd_arch_m88k, {* Motorola 88xxx *}
|
||||||
|
bfd_arch_pyramid, {* Pyramid Technology *}
|
||||||
|
bfd_arch_h8_300, {* Hitachi H8/300 *}
|
||||||
|
bfd_arch_last
|
||||||
|
};
|
||||||
|
*-
|
||||||
|
|
||||||
|
stuff
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include "sysdep.h"
|
#include <sysdep.h>
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "archures.h"
|
|
||||||
|
|
||||||
static char *prt_num_mach ();
|
static char *prt_num_mach ();
|
||||||
static boolean scan_num_mach ();
|
static boolean scan_num_mach ();
|
||||||
|
@ -30,48 +92,52 @@ static char *prt_960_mach ();
|
||||||
static boolean scan_960_mach ();
|
static boolean scan_960_mach ();
|
||||||
|
|
||||||
struct arch_print {
|
struct arch_print {
|
||||||
enum bfd_architecture arch;
|
enum bfd_architecture arch;
|
||||||
char *astr;
|
char *astr;
|
||||||
char *(*mach_print)();
|
char *(*mach_print)();
|
||||||
boolean (*mach_scan)();
|
boolean (*mach_scan)();
|
||||||
} arch_print[] = {
|
} arch_print[] = {
|
||||||
|
|
||||||
{bfd_arch_unknown, "unknown", prt_num_mach, scan_num_mach},
|
{bfd_arch_unknown, "unknown", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_obscure, "obscure", prt_num_mach, scan_num_mach},
|
{bfd_arch_obscure, "obscure", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_m68k, "m68k", prt_num_mach, scan_num_mach},
|
{bfd_arch_m68k, "m68k", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_vax, "vax", prt_num_mach, scan_num_mach},
|
{bfd_arch_vax, "vax", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_i960, "i960", prt_960_mach, scan_960_mach},
|
{bfd_arch_i960, "i960", prt_960_mach, scan_960_mach},
|
||||||
{bfd_arch_a29k, "a29k", prt_num_mach, scan_num_mach},
|
{bfd_arch_a29k, "a29k", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_sparc, "sparc", prt_num_mach, scan_num_mach},
|
{bfd_arch_sparc, "sparc", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_mips, "mips", prt_num_mach, scan_num_mach},
|
{bfd_arch_mips, "mips", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_i386, "i386", prt_num_mach, scan_num_mach},
|
{bfd_arch_i386, "i386", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_ns32k, "ns32k", prt_num_mach, scan_num_mach},
|
{bfd_arch_ns32k, "ns32k", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_tahoe, "tahoe", prt_num_mach, scan_num_mach},
|
{bfd_arch_tahoe, "tahoe", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_i860, "i860", prt_num_mach, scan_num_mach},
|
{bfd_arch_i860, "i860", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_romp, "romp", prt_num_mach, scan_num_mach},
|
{bfd_arch_romp, "romp", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_alliant, "alliant", prt_num_mach, scan_num_mach},
|
{bfd_arch_alliant, "alliant", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_convex, "convex", prt_num_mach, scan_num_mach},
|
{bfd_arch_convex, "convex", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_m88k, "m88k", prt_num_mach, scan_num_mach},
|
{bfd_arch_m88k, "m88k", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_pyramid, "pyramid", prt_num_mach, scan_num_mach},
|
{bfd_arch_pyramid, "pyramid", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_h8_300, "H8/300", prt_num_mach, scan_num_mach},
|
{bfd_arch_h8_300, "H8/300", prt_num_mach, scan_num_mach},
|
||||||
{bfd_arch_unknown, (char *)0, prt_num_mach, scan_num_mach},
|
{bfd_arch_unknown, (char *)0, prt_num_mach, scan_num_mach},
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Return a printable string representing the architecture and machine
|
/*proto* bfd_prinable_arch_mach
|
||||||
type. The result is only good until the next call to
|
Return a printable string representing the architecture and machine
|
||||||
bfd_printable_arch_mach. */
|
type. The result is only good until the next call to
|
||||||
|
bfd_printable_arch_mach.
|
||||||
|
*; PROTO(CONST char *,bfd_printable_arch_mach,
|
||||||
|
(enum bfd_architecture arch, unsigned long machine));
|
||||||
|
*/
|
||||||
|
|
||||||
char *
|
CONST char *
|
||||||
bfd_printable_arch_mach (arch, machine)
|
DEFUN(bfd_printable_arch_mach,(arch, machine),
|
||||||
enum bfd_architecture arch;
|
enum bfd_architecture arch AND
|
||||||
unsigned long machine;
|
unsigned long machine)
|
||||||
{
|
{
|
||||||
struct arch_print *ap;
|
struct arch_print *ap;
|
||||||
|
|
||||||
for (ap = arch_print; ap->astr; ap++) {
|
for (ap = arch_print; ap->astr; ap++) {
|
||||||
if (ap->arch == arch) {
|
if (ap->arch == arch) {
|
||||||
if (machine == 0)
|
if (machine == 0)
|
||||||
return ap->astr;
|
return ap->astr;
|
||||||
return (*ap->mach_print)(ap, machine);
|
return (*ap->mach_print)(ap, machine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,8 +155,12 @@ prt_num_mach (ap, machine)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan a string and attempt to turn it into an archive and machine type
|
/*proto*
|
||||||
combination. */
|
*i bfd_scan_arch_mach
|
||||||
|
Scan a string and attempt to turn it into an archive and machine type combination.
|
||||||
|
*; PROTO(boolean, bfd_scan_arch_mach,
|
||||||
|
(CONST char *, enum bfd_architecture *, unsigned long *));
|
||||||
|
*/
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
DEFUN(bfd_scan_arch_mach,(string, archp, machinep),
|
DEFUN(bfd_scan_arch_mach,(string, archp, machinep),
|
||||||
|
@ -109,13 +179,13 @@ DEFUN(bfd_scan_arch_mach,(string, archp, machinep),
|
||||||
if (!strncmp (ap->astr, string, len)) {
|
if (!strncmp (ap->astr, string, len)) {
|
||||||
/* We found the architecture, now see about the machine type */
|
/* We found the architecture, now see about the machine type */
|
||||||
if (archp)
|
if (archp)
|
||||||
*archp = ap->arch;
|
*archp = ap->arch;
|
||||||
if (string[len] != '\0') {
|
if (string[len] != '\0') {
|
||||||
if (ap->mach_scan (string+len, ap, archp, machinep, 1))
|
if (ap->mach_scan (string+len, ap, archp, machinep, 1))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (machinep)
|
if (machinep)
|
||||||
*machinep = 0;
|
*machinep = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,17 +233,17 @@ scan_num_mach (string, ap, archp, machinep, archspec)
|
||||||
case 68030:
|
case 68030:
|
||||||
case 68040:
|
case 68040:
|
||||||
case 68332:
|
case 68332:
|
||||||
case 68050: arch = bfd_arch_m68k; break;
|
case 68050: arch = bfd_arch_m68k; break;
|
||||||
case 68000: arch = bfd_arch_m68k; machine = 0; break;
|
case 68000: arch = bfd_arch_m68k; machine = 0; break;
|
||||||
|
|
||||||
case 80960:
|
case 80960:
|
||||||
case 960: arch = bfd_arch_i960; machine = 0; break;
|
case 960: arch = bfd_arch_i960; machine = 0; break;
|
||||||
|
|
||||||
case 386:
|
case 386:
|
||||||
case 80386: arch = bfd_arch_i386; machine = 0; break;
|
case 80386: arch = bfd_arch_i386; machine = 0; break;
|
||||||
case 486: arch = bfd_arch_i386; break;
|
case 486: arch = bfd_arch_i386; break;
|
||||||
|
|
||||||
case 29000: arch = bfd_arch_a29k; machine = 0; break;
|
case 29000: arch = bfd_arch_a29k; machine = 0; break;
|
||||||
|
|
||||||
case 32016:
|
case 32016:
|
||||||
case 32032:
|
case 32032:
|
||||||
|
@ -181,13 +251,13 @@ scan_num_mach (string, ap, archp, machinep, archspec)
|
||||||
case 32232:
|
case 32232:
|
||||||
case 32332:
|
case 32332:
|
||||||
case 32432:
|
case 32432:
|
||||||
case 32532: arch = bfd_arch_ns32k; break;
|
case 32532: arch = bfd_arch_ns32k; break;
|
||||||
case 32000: arch = bfd_arch_ns32k; machine = 0; break;
|
case 32000: arch = bfd_arch_ns32k; machine = 0; break;
|
||||||
|
|
||||||
case 860:
|
case 860:
|
||||||
case 80860: arch = bfd_arch_i860; machine = 0; break;
|
case 80860: arch = bfd_arch_i860; machine = 0; break;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,14 +279,14 @@ prt_960_mach (ap, machine)
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
switch (machine) {
|
switch (machine) {
|
||||||
case bfd_mach_i960_core: str = "core"; break;
|
case bfd_mach_i960_core: str = "core"; break;
|
||||||
case bfd_mach_i960_kb_sb: str = "kb"; break;
|
case bfd_mach_i960_kb_sb: str = "kb"; break;
|
||||||
case bfd_mach_i960_mc: str = "mc"; break;
|
case bfd_mach_i960_mc: str = "mc"; break;
|
||||||
case bfd_mach_i960_xa: str = "xa"; break;
|
case bfd_mach_i960_xa: str = "xa"; break;
|
||||||
case bfd_mach_i960_ca: str = "ca"; break;
|
case bfd_mach_i960_ca: str = "ca"; break;
|
||||||
case bfd_mach_i960_ka_sa: str = "ka"; break;
|
case bfd_mach_i960_ka_sa: str = "ka"; break;
|
||||||
default:
|
default:
|
||||||
return prt_num_mach (ap, machine);
|
return prt_num_mach (ap, machine);
|
||||||
}
|
}
|
||||||
sprintf (result, "%s:%s", ap->astr, str);
|
sprintf (result, "%s:%s", ap->astr, str);
|
||||||
return result;
|
return result;
|
||||||
|
@ -242,7 +312,7 @@ scan_960_mach (string, ap, archp, machinep, archspec)
|
||||||
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
|
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
|
||||||
string[3] == 'e' && string[4] == '\0')
|
string[3] == 'e' && string[4] == '\0')
|
||||||
machine = bfd_mach_i960_core;
|
machine = bfd_mach_i960_core;
|
||||||
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char */
|
else if (string[1] == '\0' || string[2] != '\0') /* rest are 2-char */
|
||||||
return false;
|
return false;
|
||||||
else if (string[0] == 'k' && string[1] == 'b')
|
else if (string[0] == 'k' && string[1] == 'b')
|
||||||
machine = bfd_mach_i960_kb_sb;
|
machine = bfd_mach_i960_kb_sb;
|
||||||
|
@ -270,16 +340,28 @@ scan_960_mach (string, ap, archp, machinep, archspec)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Determine whether two BFDs' architectures and machine types are
|
/*proto*
|
||||||
compatible. Return merged architecture and machine type if nonnull
|
*i bfd_arch_compatible
|
||||||
pointers. */
|
This routine is used to determine whether two BFDs' architectures and machine types are
|
||||||
|
compatible. It calculates the lowest common denominator between the
|
||||||
|
two architectures and machine types implied by the bfds and sets the
|
||||||
|
objects pointed at by @var{archp} and @var{machine} if non NULL.
|
||||||
|
|
||||||
|
This routine returns @code{true} if the bfds are of compatible type,
|
||||||
|
otherwise @code{false}.
|
||||||
|
*; PROTO(boolean, bfd_arch_compatible,
|
||||||
|
(bfd *abfd,
|
||||||
|
bfd *bbfd,
|
||||||
|
enum bfd_architecture *archp,
|
||||||
|
unsigned long *machinep));
|
||||||
|
*-*/
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
bfd_arch_compatible (abfd, bbfd, archp, machinep)
|
DEFUN(bfd_arch_compatible,(abfd, bbfd, archp, machinep),
|
||||||
bfd *abfd;
|
bfd *abfd AND
|
||||||
bfd *bbfd;
|
bfd *bbfd AND
|
||||||
enum bfd_architecture *archp;
|
enum bfd_architecture *archp AND
|
||||||
unsigned long *machinep;
|
unsigned long *machinep)
|
||||||
{
|
{
|
||||||
enum bfd_architecture archa, archb;
|
enum bfd_architecture archa, archb;
|
||||||
unsigned long macha, machb;
|
unsigned long macha, machb;
|
||||||
|
@ -291,55 +373,55 @@ bfd_arch_compatible (abfd, bbfd, archp, machinep)
|
||||||
machb = bfd_get_machine (bbfd);
|
machb = bfd_get_machine (bbfd);
|
||||||
|
|
||||||
if (archb == bfd_arch_unknown)
|
if (archb == bfd_arch_unknown)
|
||||||
pick_a = 1;
|
pick_a = 1;
|
||||||
else if (archa == bfd_arch_unknown)
|
else if (archa == bfd_arch_unknown)
|
||||||
pick_a = 0;
|
pick_a = 0;
|
||||||
else if (archa != archb)
|
else if (archa != archb)
|
||||||
return false; /* Not compatible */
|
return false; /* Not compatible */
|
||||||
else {
|
else {
|
||||||
/* Architectures are the same. Check machine types. */
|
/* Architectures are the same. Check machine types. */
|
||||||
if (macha == machb) /* Same machine type */
|
if (macha == machb) /* Same machine type */
|
||||||
pick_a = 1;
|
pick_a = 1;
|
||||||
else if (machb == 0) /* B is default */
|
else if (machb == 0) /* B is default */
|
||||||
pick_a = 1;
|
pick_a = 1;
|
||||||
else if (macha == 0) /* A is default */
|
else if (macha == 0) /* A is default */
|
||||||
pick_a = 0;
|
pick_a = 0;
|
||||||
else switch (archa) {
|
else switch (archa) {
|
||||||
/* If particular machine types of one architecture are not
|
/* If particular machine types of one architecture are not
|
||||||
compatible with each other, this is the place to put those tests
|
compatible with each other, this is the place to put those tests
|
||||||
(returning false if incompatible). */
|
(returning false if incompatible). */
|
||||||
|
|
||||||
case bfd_arch_i960:
|
case bfd_arch_i960:
|
||||||
/* The i960 has two distinct subspecies which may not interbreed:
|
/* The i960 has two distinct subspecies which may not interbreed:
|
||||||
CORE CA
|
CORE CA
|
||||||
CORE KA KB MC
|
CORE KA KB MC
|
||||||
Any architecture on the same line is compatible, the one on
|
Any architecture on the same line is compatible, the one on
|
||||||
the right is the least restrictive. */
|
the right is the least restrictive. */
|
||||||
/* So, if either is a ca then the other must be a be core or ca */
|
/* So, if either is a ca then the other must be a be core or ca */
|
||||||
if (macha == bfd_mach_i960_ca) {
|
if (macha == bfd_mach_i960_ca) {
|
||||||
if (machb != bfd_mach_i960_ca &&
|
if (machb != bfd_mach_i960_ca &&
|
||||||
machb != bfd_mach_i960_core) {
|
machb != bfd_mach_i960_core) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pick_a = 1;
|
pick_a = 1;
|
||||||
}
|
}
|
||||||
else if (machb == bfd_mach_i960_ca) {
|
else if (machb == bfd_mach_i960_ca) {
|
||||||
if (macha != bfd_mach_i960_ca &&
|
if (macha != bfd_mach_i960_ca &&
|
||||||
macha != bfd_mach_i960_core) {
|
macha != bfd_mach_i960_core) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pick_a = 0;
|
pick_a = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* This must be from the bottom row, so take the higest */
|
/* This must be from the bottom row, so take the higest */
|
||||||
pick_a = (macha > machb);
|
pick_a = (macha > machb);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* For these chips, as far as we care, "lower" numbers are included
|
/* For these chips, as far as we care, "lower" numbers are included
|
||||||
by "higher" numbers, e.g. merge 68010 and 68020 into 68020,
|
by "higher" numbers, e.g. merge 68010 and 68020 into 68020,
|
||||||
386 and 486 into 486, etc. This will need to change
|
386 and 486 into 486, etc. This will need to change
|
||||||
if&when we care about things like 68332. */
|
if&when we care about things like 68332. */
|
||||||
case bfd_arch_m68k:
|
case bfd_arch_m68k:
|
||||||
case bfd_arch_ns32k:
|
case bfd_arch_ns32k:
|
||||||
case bfd_arch_i386:
|
case bfd_arch_i386:
|
||||||
|
@ -364,3 +446,19 @@ bfd_arch_compatible (abfd, bbfd, archp, machinep)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*proto* bfd_set_arch_mach
|
||||||
|
Set atch mach
|
||||||
|
*+
|
||||||
|
#define bfd_set_arch_mach(abfd, arch, mach) \
|
||||||
|
BFD_SEND (abfd, _bfd_set_arch_mach,\
|
||||||
|
(abfd, arch, mach))
|
||||||
|
*-
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
foo() { }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
111
bfd/libbfd.h
111
bfd/libbfd.h
|
@ -1,23 +1,23 @@
|
||||||
/* libbfd.h -- Declarations used by bfd library implementation.
|
/* libbfd.h -- Declarations used by bfd library *implementation*.
|
||||||
This include file is not for users of the library */
|
(This include file is not for users of the library.)
|
||||||
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
|
Written by Cygnus Support.
|
||||||
|
|
||||||
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Diddler.
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
|
||||||
BFD 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
|
||||||
the Free Software Foundation; either version 1, or (at your option)
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
BFD is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with BFD; see the file COPYING. If not, write to
|
along with this program; if not, write to the Free Software
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
@ -93,18 +93,18 @@ PROTO (bfd *, new_bfd, ());
|
||||||
PROTO (boolean, bfd_add_to_string_table, (char **table, char *new_string,
|
PROTO (boolean, bfd_add_to_string_table, (char **table, char *new_string,
|
||||||
unsigned int *table_length,
|
unsigned int *table_length,
|
||||||
char **free_ptr));
|
char **free_ptr));
|
||||||
PROTO (bfd_64_type, _do_getb64, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getb64, (unsigned char *addr));
|
||||||
PROTO (bfd_64_type, _do_getl64, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getl64, (unsigned char *addr));
|
||||||
PROTO (unsigned int, _do_getb32, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getb32, (unsigned char *addr));
|
||||||
PROTO (unsigned int, _do_getl32, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getl32, (unsigned char *addr));
|
||||||
PROTO (unsigned int, _do_getb16, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getb16, (unsigned char *addr));
|
||||||
PROTO (unsigned int, _do_getl16, (unsigned char *addr));
|
PROTO (bfd_vma, _do_getl16, (unsigned char *addr));
|
||||||
PROTO (void, _do_putb64, (bfd_64_type data, unsigned char *addr));
|
PROTO (void, _do_putb64, (bfd_vma data, unsigned char *addr));
|
||||||
PROTO (void, _do_putl64, (bfd_64_type data, unsigned char *addr));
|
PROTO (void, _do_putl64, (bfd_vma data, unsigned char *addr));
|
||||||
PROTO (void, _do_putb32, (unsigned long data, unsigned char *addr));
|
PROTO (void, _do_putb32, (bfd_vma data, unsigned char *addr));
|
||||||
PROTO (void, _do_putl32, (unsigned long data, unsigned char *addr));
|
PROTO (void, _do_putl32, (bfd_vma data, unsigned char *addr));
|
||||||
PROTO (void, _do_putb16, (int data, unsigned char *addr));
|
PROTO (void, _do_putb16, (bfd_vma data, unsigned char *addr));
|
||||||
PROTO (void, _do_putl16, (int data, unsigned char *addr));
|
PROTO (void, _do_putl16, (bfd_vma data, unsigned char *addr));
|
||||||
|
|
||||||
PROTO (boolean, bfd_false, (bfd *ignore));
|
PROTO (boolean, bfd_false, (bfd *ignore));
|
||||||
PROTO (boolean, bfd_true, (bfd *ignore));
|
PROTO (boolean, bfd_true, (bfd *ignore));
|
||||||
|
@ -179,22 +179,40 @@ extern bfd *bfd_last_cache;
|
||||||
|
|
||||||
/* THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/
|
/* THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/
|
||||||
|
|
||||||
/* Return the log base 2 of the value supplied, rounded up. eg an arg
|
/* FROM libbfd.c*/
|
||||||
|
/* ------------------------------START FROM libbfd.c
|
||||||
|
|
||||||
|
*i bfd_log2
|
||||||
|
Return the log base 2 of the value supplied, rounded up. eg an arg
|
||||||
of 1025 would return 11.
|
of 1025 would return 11.
|
||||||
*/
|
*/
|
||||||
PROTO(bfd_vma, bfd_log2,(bfd_vma x));
|
PROTO(bfd_vma, bfd_log2,(bfd_vma x));
|
||||||
/* The maxiumum number of files which the cache will keep open at one
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
--------------------------------END FROM libbfd.c*/
|
||||||
|
|
||||||
|
/* FROM cache.c*/
|
||||||
|
/* ------------------------------START FROM cache.c
|
||||||
|
BFD_CACHE_MAX_OPEN
|
||||||
|
The maxiumum number of files which the cache will keep open at one
|
||||||
time.
|
time.
|
||||||
*/
|
*/
|
||||||
#define BFD_CACHE_MAX_OPEN 10
|
#define BFD_CACHE_MAX_OPEN 10
|
||||||
|
|
||||||
/* Zero, or a pointer to the topmost bfd on the chain. This is used by the
|
/*
|
||||||
|
|
||||||
|
bfd_last_cache
|
||||||
|
Zero, or a pointer to the topmost bfd on the chain. This is used by the
|
||||||
bfd_cache_lookup() macro in libbfd.h to determine when it can avoid a function
|
bfd_cache_lookup() macro in libbfd.h to determine when it can avoid a function
|
||||||
call.
|
call.
|
||||||
*/
|
*/
|
||||||
extern bfd *bfd_last_cache;
|
extern bfd *bfd_last_cache;
|
||||||
|
|
||||||
/* Checks to see if the required bfd is the same as the last one looked
|
/*
|
||||||
|
|
||||||
|
bfd_cache_lookup
|
||||||
|
Checks to see if the required bfd is the same as the last one looked
|
||||||
up. If so then it can use the iostream in the bfd with impunity, since
|
up. If so then it can use the iostream in the bfd with impunity, since
|
||||||
it can't have changed since the last lookup, otherwise it has to
|
it can't have changed since the last lookup, otherwise it has to
|
||||||
perform the complicated lookup function
|
perform the complicated lookup function
|
||||||
|
@ -204,23 +222,44 @@ perform the complicated lookup function
|
||||||
(FILE*)(bfd_last_cache->iostream): \
|
(FILE*)(bfd_last_cache->iostream): \
|
||||||
bfd_cache_lookup_worker(x))
|
bfd_cache_lookup_worker(x))
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
/* Initialize a BFD by putting it on the cache LRU.
|
*i bfd_cache_init
|
||||||
|
Initialize a BFD by putting it on the cache LRU.
|
||||||
*/
|
*/
|
||||||
PROTO(void, bfd_cache_init, (bfd *));
|
PROTO(void, bfd_cache_init, (bfd *));
|
||||||
/* Remove the bfd from the cache. If the attatched file is open, then close it too.
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*i bfd_cache_close
|
||||||
|
Remove the bfd from the cache. If the attatched file is open, then close it too.
|
||||||
*/
|
*/
|
||||||
PROTO(void, bfd_cache_close, (bfd *));
|
PROTO(void, bfd_cache_close, (bfd *));
|
||||||
/* Call the OS to open a file for this BFD. Returns the FILE *
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*i bfd_open_file
|
||||||
|
Call the OS to open a file for this BFD. Returns the FILE *
|
||||||
(possibly null) that results from this operation. Sets up the
|
(possibly null) that results from this operation. Sets up the
|
||||||
BFD so that future accesses know the file is open. If the FILE *
|
BFD so that future accesses know the file is open. If the FILE *
|
||||||
returned is null, then there is won't have been put in the cache, so
|
returned is null, then there is won't have been put in the cache, so
|
||||||
it won't have to be removed from it.
|
it won't have to be removed from it.
|
||||||
*/
|
*/
|
||||||
PROTO(FILE *, bfd_open_file, (bfd *));
|
PROTO(FILE *, bfd_open_file, (bfd *));
|
||||||
/* Called when the macro @code{bfd_cache_lookup} fails to find a quick
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
*i bfd_cache_lookup_worker
|
||||||
|
Called when the macro @code{bfd_cache_lookup} fails to find a quick
|
||||||
answer. Finds a file descriptor for this BFD. If necessary, it open it.
|
answer. Finds a file descriptor for this BFD. If necessary, it open it.
|
||||||
If there are already more than BFD_CACHE_MAX_OPEN files open, it trys to close
|
If there are already more than BFD_CACHE_MAX_OPEN files open, it trys to close
|
||||||
one first, to avoid running out of file descriptors.
|
one first, to avoid running out of file descriptors.
|
||||||
*/
|
*/
|
||||||
PROTO(FILE *, bfd_cache_lookup_worker, (bfd *));
|
PROTO(FILE *, bfd_cache_lookup_worker, (bfd *));
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
--------------------------------END FROM cache.c*/
|
||||||
|
|
||||||
|
/* FROM reloc.c*/
|
||||||
|
|
||||||
|
|
|
@ -84,53 +84,78 @@ struct coff_ptr_struct *raw_syments;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*THE FOLLOWING*/
|
/*THE FOLLOWING IS EXTRACTED FROM THE SOURCE*/
|
||||||
|
|
||||||
/* The hidden information for an asymbol is:
|
/* FROM coffcode.h*/
|
||||||
|
/* ------------------------------START FROM coffcode.h
|
||||||
|
|
||||||
|
The hidden information for an asymbol is:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct coff_ptr_struct
|
typedef struct coff_ptr_struct
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Remembers the offset from the first symbol in the file for this
|
/*
|
||||||
symbol. Generated by @code{coff_renumber_symbols}.
|
Remembers the offset from the first symbol in the file for this
|
||||||
*/
|
symbol. Generated by @code{coff_renumber_symbols}.
|
||||||
|
*/
|
||||||
|
|
||||||
unsigned int offset;
|
unsigned int offset;
|
||||||
|
|
||||||
/* Should the tag field of this symbol be renumbered.
|
/*
|
||||||
Created by @code{coff_pointerize_aux}.
|
Should the tag field of this symbol be renumbered.
|
||||||
*/
|
Created by @code{coff_pointerize_aux}.
|
||||||
|
*/
|
||||||
|
|
||||||
char fix_tag;
|
char fix_tag;
|
||||||
|
|
||||||
/* Should the endidx field of this symbol be renumbered.
|
/*
|
||||||
Created by @code{coff_pointerize_aux}.
|
Should the endidx field of this symbol be renumbered.
|
||||||
*/
|
Created by @code{coff_pointerize_aux}.
|
||||||
|
*/
|
||||||
|
|
||||||
char fix_end;
|
char fix_end;
|
||||||
|
|
||||||
/* The container for the symbol structure as read and translated from the file.
|
/*
|
||||||
*/
|
The container for the symbol structure as read and translated from the file.
|
||||||
|
*/
|
||||||
|
|
||||||
union {
|
union {
|
||||||
union internal_auxent auxent;
|
union internal_auxent auxent;
|
||||||
struct internal_syment syment;
|
struct internal_syment syment;
|
||||||
} u;
|
} u;
|
||||||
} combined_entry_type;
|
} combined_entry_type;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
/* Each canonical asymbol really looks like this:
|
Each canonical asymbol really looks like this:
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct coff_symbol_struct
|
typedef struct coff_symbol_struct
|
||||||
{
|
{
|
||||||
|
|
||||||
/* The actual symbol which the rest of bfd works with
|
/*
|
||||||
*/
|
The actual symbol which the rest of bfd works with
|
||||||
|
*/
|
||||||
|
|
||||||
asymbol symbol;
|
asymbol symbol;
|
||||||
|
|
||||||
/* A pointer to the hidden information for this symbol
|
/*
|
||||||
*/
|
A pointer to the hidden information for this symbol
|
||||||
|
*/
|
||||||
|
|
||||||
combined_entry_type *native;
|
combined_entry_type *native;
|
||||||
|
|
||||||
/* A pointer to the linenumber information for this symbol
|
/*
|
||||||
*/
|
A pointer to the linenumber information for this symbol
|
||||||
|
*/
|
||||||
|
|
||||||
struct lineno_cache_entry *lineno;
|
struct lineno_cache_entry *lineno;
|
||||||
} coff_symbol_type;
|
} coff_symbol_type;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
--------------------------------END FROM coffcode.h*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
87
bfd/oasys.c
87
bfd/oasys.c
|
@ -1,23 +1,22 @@
|
||||||
/* bfd backend for oasys objects.
|
/* bfd backend for oasys objects.
|
||||||
Written by Steve Chamberlain of Cygnus Support <steve@cygnus.com> */
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
|
Written by Steve Chamberlain of Cygnus Support <steve@cygnus.com>.
|
||||||
|
|
||||||
/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
This file is part of BFD, the Binary File Diddler.
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
|
||||||
BFD 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
|
||||||
the Free Software Foundation; either version 1, or (at your option)
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
BFD is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with BFD; see the file COPYING. If not, write to
|
along with this program; if not, write to the Free Software
|
||||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
|
@ -161,7 +160,7 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
|
||||||
dest->name = string_ptr;
|
dest->name = string_ptr;
|
||||||
dest->the_bfd = abfd;
|
dest->the_bfd = abfd;
|
||||||
dest->udata = (PTR)NULL;
|
dest->udata = (PTR)NULL;
|
||||||
dest->value = bfd_h_get_32(abfd, &record.symbol.value[0]);
|
dest->value = bfd_h_get_32(abfd, (bfd_byte *)&record.symbol.value[0]);
|
||||||
|
|
||||||
#ifdef UNDERSCORE_HACK
|
#ifdef UNDERSCORE_HACK
|
||||||
if (record.symbol.name[0] != '_') {
|
if (record.symbol.name[0] != '_') {
|
||||||
|
@ -225,7 +224,7 @@ DEFUN(oasys_archive_p,(abfd),
|
||||||
bfd *abfd)
|
bfd *abfd)
|
||||||
{
|
{
|
||||||
oasys_archive_header_type header;
|
oasys_archive_header_type header;
|
||||||
oasys_external_archive_header_type header_ext;
|
oasys_extarchive_header_type header_ext;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
file_ptr filepos;
|
file_ptr filepos;
|
||||||
bfd_seek(abfd, (file_ptr) 0, false);
|
bfd_seek(abfd, (file_ptr) 0, false);
|
||||||
|
@ -234,14 +233,14 @@ DEFUN(oasys_archive_p,(abfd),
|
||||||
bfd_read((PTR)&header_ext, 1, sizeof(header_ext), abfd);
|
bfd_read((PTR)&header_ext, 1, sizeof(header_ext), abfd);
|
||||||
|
|
||||||
|
|
||||||
header.version = bfd_h_get_32(abfd, header_ext.version);
|
header.version = bfd_h_get_32(abfd, (bfd_byte *)header_ext.version);
|
||||||
header.mod_count = bfd_h_get_32(abfd, header_ext.mod_count);
|
header.mod_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.mod_count);
|
||||||
header.mod_tbl_offset = bfd_h_get_32(abfd, header_ext.mod_tbl_offset);
|
header.mod_tbl_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.mod_tbl_offset);
|
||||||
header.sym_tbl_size = bfd_h_get_32(abfd, header_ext.sym_tbl_size);
|
header.sym_tbl_size = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_tbl_size);
|
||||||
header.sym_count = bfd_h_get_32(abfd, header_ext.sym_count);
|
header.sym_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_count);
|
||||||
header.sym_tbl_offset = bfd_h_get_32(abfd, header_ext.sym_tbl_offset);
|
header.sym_tbl_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_tbl_offset);
|
||||||
header.xref_count = bfd_h_get_32(abfd, header_ext.xref_count);
|
header.xref_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.xref_count);
|
||||||
header.xref_lst_offset = bfd_h_get_32(abfd, header_ext.xref_lst_offset);
|
header.xref_lst_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.xref_lst_offset);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
There isn't a magic number in an Oasys archive, so the best we
|
There isn't a magic number in an Oasys archive, so the best we
|
||||||
|
@ -283,16 +282,16 @@ DEFUN(oasys_archive_p,(abfd),
|
||||||
/* There are two ways of specifying the archive header */
|
/* There are two ways of specifying the archive header */
|
||||||
|
|
||||||
if (0) {
|
if (0) {
|
||||||
oasys_external_module_table_type_a_type record_ext;
|
oasys_extmodule_table_type_a_type record_ext;
|
||||||
bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
|
bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
|
||||||
|
|
||||||
record.mod_size = bfd_h_get_32(abfd, record_ext.mod_size);
|
record.mod_size = bfd_h_get_32(abfd, (bfd_byte *)record_ext.mod_size);
|
||||||
record.file_offset = bfd_h_get_32(abfd,
|
record.file_offset = bfd_h_get_32(abfd,
|
||||||
record_ext.file_offset);
|
(bfd_byte *) record_ext.file_offset);
|
||||||
|
|
||||||
record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
|
record.dep_count = bfd_h_get_32(abfd, (bfd_byte *)record_ext.dep_count);
|
||||||
record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
|
record.depee_count = bfd_h_get_32(abfd,(bfd_byte *) record_ext.depee_count);
|
||||||
record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
|
record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
|
||||||
|
|
||||||
|
|
||||||
module[i].name = bfd_alloc(abfd,33);
|
module[i].name = bfd_alloc(abfd,33);
|
||||||
|
@ -305,17 +304,17 @@ DEFUN(oasys_archive_p,(abfd),
|
||||||
record.sect_count * 8 + 187;
|
record.sect_count * 8 + 187;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
oasys_external_module_table_type_b_type record_ext;
|
oasys_extmodule_table_type_b_type record_ext;
|
||||||
bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
|
bfd_read((PTR)&record_ext, 1, sizeof(record_ext), abfd);
|
||||||
|
|
||||||
record.mod_size = bfd_h_get_32(abfd, record_ext.mod_size);
|
record.mod_size = bfd_h_get_32(abfd, (bfd_byte *) record_ext.mod_size);
|
||||||
record.file_offset = bfd_h_get_32(abfd,
|
record.file_offset = bfd_h_get_32(abfd,
|
||||||
record_ext.file_offset);
|
(bfd_byte *)record_ext.file_offset);
|
||||||
|
|
||||||
record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
|
record.dep_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.dep_count);
|
||||||
record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
|
record.depee_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.depee_count);
|
||||||
record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
|
record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
|
||||||
record.module_name_size = bfd_h_get_32(abfd, record_ext.mod_name_length);
|
record.module_name_size = bfd_h_get_32(abfd, (bfd_byte *) record_ext.mod_name_length);
|
||||||
|
|
||||||
module[i].name = bfd_alloc(abfd,record.module_name_size + 1);
|
module[i].name = bfd_alloc(abfd,record.module_name_size + 1);
|
||||||
bfd_read((PTR)module[i].name, 1, record.module_name_size, abfd);
|
bfd_read((PTR)module[i].name, 1, record.module_name_size, abfd);
|
||||||
|
@ -412,8 +411,8 @@ DEFUN(oasys_object_p,(abfd),
|
||||||
BFD_FAIL();
|
BFD_FAIL();
|
||||||
}
|
}
|
||||||
|
|
||||||
s->size = bfd_h_get_32(abfd, & record.section.value[0]) ;
|
s->size = bfd_h_get_32(abfd, (bfd_byte *) & record.section.value[0]) ;
|
||||||
s->vma = bfd_h_get_32(abfd, &record.section.vma[0]);
|
s->vma = bfd_h_get_32(abfd, (bfd_byte *)&record.section.vma[0]);
|
||||||
s->flags= 0;
|
s->flags= 0;
|
||||||
had_usefull = true;
|
had_usefull = true;
|
||||||
}
|
}
|
||||||
|
@ -744,7 +743,7 @@ DEFUN(oasys_get_section_contents,(abfd, section, location, offset, count),
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(void) memcpy(location, p->data + offset, (int)count);
|
(void) memcpy(location,(PTR)( p->data + offset), (int)count);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -868,7 +867,7 @@ DEFUN(oasys_write_syms, (abfd),
|
||||||
l++;
|
l++;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfd_h_put_32(abfd, g->value, symbol.value);
|
bfd_h_put_32(abfd, g->value, (bfd_byte*) symbol.value);
|
||||||
|
|
||||||
|
|
||||||
if (g->flags & BSF_LOCAL) {
|
if (g->flags & BSF_LOCAL) {
|
||||||
|
@ -903,8 +902,8 @@ DEFUN(oasys_write_sections, (abfd),
|
||||||
s->name);
|
s->name);
|
||||||
}
|
}
|
||||||
out.relb = RELOCATION_TYPE_REL | s->target_index;
|
out.relb = RELOCATION_TYPE_REL | s->target_index;
|
||||||
bfd_h_put_32(abfd, s->size, out.value);
|
bfd_h_put_32(abfd, s->size, (bfd_byte *) out.value);
|
||||||
bfd_h_put_32(abfd, s->vma, out.vma);
|
bfd_h_put_32(abfd, s->vma, (bfd_byte *) out.vma);
|
||||||
|
|
||||||
oasys_write_record(abfd,
|
oasys_write_record(abfd,
|
||||||
oasys_record_is_section_enum,
|
oasys_record_is_section_enum,
|
||||||
|
@ -949,8 +948,8 @@ DEFUN(oasys_write_end,(abfd),
|
||||||
oasys_end_record_type end;
|
oasys_end_record_type end;
|
||||||
uint8e_type null = 0;
|
uint8e_type null = 0;
|
||||||
end.relb = RELOCATION_TYPE_ABS;
|
end.relb = RELOCATION_TYPE_ABS;
|
||||||
bfd_h_put_32(abfd, abfd->start_address, end.entry);
|
bfd_h_put_32(abfd, abfd->start_address, (bfd_byte *)end.entry);
|
||||||
bfd_h_put_16(abfd, 0, end.fill);
|
bfd_h_put_16(abfd, 0, (bfd_byte *)end.fill);
|
||||||
end.zero =0;
|
end.zero =0;
|
||||||
oasys_write_record(abfd,
|
oasys_write_record(abfd,
|
||||||
oasys_record_is_end_enum,
|
oasys_record_is_end_enum,
|
||||||
|
@ -1151,7 +1150,7 @@ DEFUN(oasys_set_section_contents,(abfd, section, location, offset, count),
|
||||||
oasys_per_section(section)->data =
|
oasys_per_section(section)->data =
|
||||||
(bfd_byte *)(bfd_alloc(abfd,section->size));
|
(bfd_byte *)(bfd_alloc(abfd,section->size));
|
||||||
}
|
}
|
||||||
(void) memcpy(oasys_per_section(section)->data + offset,
|
(void) memcpy((PTR)(oasys_per_section(section)->data + offset),
|
||||||
location,
|
location,
|
||||||
count);
|
count);
|
||||||
}
|
}
|
||||||
|
@ -1291,7 +1290,7 @@ bfd_target oasys_vec =
|
||||||
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
|
||||||
' ', /* ar_pad_char */
|
' ', /* ar_pad_char */
|
||||||
16, /* ar_max_namelen */
|
16, /* ar_max_namelen */
|
||||||
1, /* minimum alignment */
|
1, /* minimum alignment */
|
||||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* data */
|
||||||
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
_do_getb64, _do_putb64, _do_getb32, _do_putb32, _do_getb16, _do_putb16, /* hdrs */
|
||||||
|
|
||||||
|
@ -1313,4 +1312,4 @@ bfd_target oasys_vec =
|
||||||
bfd_false,
|
bfd_false,
|
||||||
},
|
},
|
||||||
JUMP_TABLE(oasys)
|
JUMP_TABLE(oasys)
|
||||||
};
|
};
|
||||||
|
|
60
bfd/reloc.c
60
bfd/reloc.c
|
@ -1,3 +1,23 @@
|
||||||
|
/* BFD support for handling relocation entries.
|
||||||
|
Copyright (C) 1990-1991 Free Software Foundation, Inc.
|
||||||
|
Written by Cygnus Support.
|
||||||
|
|
||||||
|
This file is part of BFD, the Binary File Descriptor library.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/*doc*
|
/*doc*
|
||||||
@section Relocations
|
@section Relocations
|
||||||
|
|
||||||
|
@ -24,7 +44,7 @@ particuar section, and fill in the right bits:
|
||||||
#include "bfd.h"
|
#include "bfd.h"
|
||||||
#include "libbfd.h"
|
#include "libbfd.h"
|
||||||
/*doc
|
/*doc
|
||||||
*node typedef arelent, Relocations, reloc handling functions, Relocations
|
@node typedef arelent, Relocations, reloc handling functions, Relocations
|
||||||
@section typedef arelent
|
@section typedef arelent
|
||||||
|
|
||||||
|
|
||||||
|
@ -482,14 +502,14 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Anything which started out as pc relative should end up that
|
Anything which started out as pc relative should end up that
|
||||||
way too.
|
way too.
|
||||||
|
|
||||||
There are two ways we can see a pcrel instruction. Sometimes
|
There are two ways we can see a pcrel instruction. Sometimes
|
||||||
the pcrel displacement has been partially calculated, it
|
the pcrel displacement has been partially calculated, it
|
||||||
includes the distance from the start of the section to the
|
includes the distance from the start of the section to the
|
||||||
instruction in it (eg sun3), and sometimes the field is
|
instruction in it (eg sun3), and sometimes the field is
|
||||||
totally blank - eg m88kbcs.
|
totally blank - eg m88kbcs.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
relocation -=
|
relocation -=
|
||||||
|
@ -505,9 +525,9 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
if ( howto->partial_inplace == false) {
|
if ( howto->partial_inplace == false) {
|
||||||
/*
|
/*
|
||||||
This is a partial relocation, and we want to apply the relocation
|
This is a partial relocation, and we want to apply the relocation
|
||||||
to the reloc entry rather than the raw data. Modify the reloc
|
to the reloc entry rather than the raw data. Modify the reloc
|
||||||
inplace to reflect what we now know.
|
inplace to reflect what we now know.
|
||||||
*/
|
*/
|
||||||
reloc_entry->addend = relocation ;
|
reloc_entry->addend = relocation ;
|
||||||
reloc_entry->section = reloc_target_input_section;
|
reloc_entry->section = reloc_target_input_section;
|
||||||
if (reloc_target_input_section != (asection *)NULL) {
|
if (reloc_target_input_section != (asection *)NULL) {
|
||||||
|
@ -521,8 +541,17 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* This is a partial relocation, but inplace, so modify the
|
/* This is a partial relocation, but inplace, so modify the
|
||||||
reloc record a bit
|
reloc record a bit.
|
||||||
*/
|
|
||||||
|
If we've relocated with a symbol with a section, change
|
||||||
|
into a ref to the section belonging to the symbol
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (symbol != (asymbol *)NULL && reloc_target_input_section != (asection *)NULL)
|
||||||
|
{
|
||||||
|
reloc_entry->section = reloc_target_input_section;
|
||||||
|
reloc_entry->sym_ptr_ptr = (asymbol **)NULL;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -602,6 +631,7 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
|
||||||
/* Do nothing */
|
/* Do nothing */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -610,3 +640,5 @@ DEFUN(bfd_perform_relocation,(abfd,
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue