Documentation
This commit is contained in:
parent
90f3f3e2b0
commit
c618de01c1
|
@ -31,6 +31,22 @@ ChangeLog
|
|||
Makefile.in
|
||||
TODO
|
||||
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
|
||||
aout32.c
|
||||
aout64.c
|
||||
|
@ -107,6 +123,9 @@ echo Done in `pwd`.
|
|||
#
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.14 1991/08/17 00:17:00 steve
|
||||
# Documentation
|
||||
#
|
||||
# Revision 1.13 1991/08/01 14:37:51 steve
|
||||
# *** empty log message ***
|
||||
#
|
||||
|
|
|
@ -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)
|
||||
|
||||
* all files: update copyright notices for GPL version 2.
|
||||
Install header comments and attribute most modules to their
|
||||
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.
|
||||
|
||||
Fri Jul 26 18:11:34 1991 Steve Chamberlain (steve at cygint.cygnus.com)
|
||||
|
|
18
bfd/aoutx.h
18
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 <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),
|
||||
|
||||
/* 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_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_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),
|
||||
#endif
|
||||
|
||||
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_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_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_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),
|
||||
#endif
|
||||
|
||||
/* end-sanitize-v9 */
|
||||
};
|
||||
|
||||
|
@ -816,7 +818,7 @@ DEFUN(translate_from_native_sym_flags,(sym_pointer, cache_ptr, abfd),
|
|||
(sym_pointer+1)->e_type[0] = 0xff;
|
||||
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
|
||||
contains the name we will match, the second symbol contains the
|
||||
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);
|
||||
}
|
||||
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_index = stoi((*(g->sym_ptr_ptr))->name);
|
||||
r_index = ((*(g->sym_ptr_ptr))->KEEPIT);
|
||||
r_extern = 1;
|
||||
}
|
||||
else {
|
||||
|
@ -1260,7 +1262,7 @@ DEFUN(NAME(aout,swap_ext_reloc_out),(abfd, g, natptr),
|
|||
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;
|
||||
}
|
||||
else {
|
||||
|
|
154
bfd/archures.c
154
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.
|
||||
|
||||
BFD is free software; you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(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
|
||||
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 BFD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
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$ */
|
||||
|
||||
#include "sysdep.h"
|
||||
#include <sysdep.h>
|
||||
#include "bfd.h"
|
||||
#include "archures.h"
|
||||
|
||||
static char *prt_num_mach ();
|
||||
static boolean scan_num_mach ();
|
||||
|
@ -57,14 +119,18 @@ struct arch_print {
|
|||
{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
|
||||
Return a printable string representing the architecture and machine
|
||||
type. The result is only good until the next call to
|
||||
bfd_printable_arch_mach. */
|
||||
bfd_printable_arch_mach.
|
||||
*; PROTO(CONST char *,bfd_printable_arch_mach,
|
||||
(enum bfd_architecture arch, unsigned long machine));
|
||||
*/
|
||||
|
||||
char *
|
||||
bfd_printable_arch_mach (arch, machine)
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
CONST char *
|
||||
DEFUN(bfd_printable_arch_mach,(arch, machine),
|
||||
enum bfd_architecture arch AND
|
||||
unsigned long machine)
|
||||
{
|
||||
struct arch_print *ap;
|
||||
|
||||
|
@ -89,8 +155,12 @@ prt_num_mach (ap, machine)
|
|||
return result;
|
||||
}
|
||||
|
||||
/* Scan a string and attempt to turn it into an archive and machine type
|
||||
combination. */
|
||||
/*proto*
|
||||
*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
|
||||
DEFUN(bfd_scan_arch_mach,(string, archp, machinep),
|
||||
|
@ -270,16 +340,28 @@ scan_960_mach (string, ap, archp, machinep, archspec)
|
|||
|
||||
|
||||
|
||||
/* Determine whether two BFDs' architectures and machine types are
|
||||
compatible. Return merged architecture and machine type if nonnull
|
||||
pointers. */
|
||||
/*proto*
|
||||
*i bfd_arch_compatible
|
||||
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
|
||||
bfd_arch_compatible (abfd, bbfd, archp, machinep)
|
||||
bfd *abfd;
|
||||
bfd *bbfd;
|
||||
enum bfd_architecture *archp;
|
||||
unsigned long *machinep;
|
||||
DEFUN(bfd_arch_compatible,(abfd, bbfd, archp, machinep),
|
||||
bfd *abfd AND
|
||||
bfd *bbfd AND
|
||||
enum bfd_architecture *archp AND
|
||||
unsigned long *machinep)
|
||||
{
|
||||
enum bfd_architecture archa, archb;
|
||||
unsigned long macha, machb;
|
||||
|
@ -364,3 +446,19 @@ bfd_arch_compatible (abfd, bbfd, archp, machinep)
|
|||
|
||||
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() { }
|
||||
|
||||
|
||||
|
||||
|
|
101
bfd/libbfd.h
101
bfd/libbfd.h
|
@ -1,23 +1,23 @@
|
|||
/* libbfd.h -- Declarations used by bfd library implementation.
|
||||
This include file is not for users of the library */
|
||||
/* libbfd.h -- Declarations used by bfd library *implementation*.
|
||||
(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.
|
||||
|
||||
BFD is free software; you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(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
|
||||
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 BFD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
@ -93,18 +93,18 @@ PROTO (bfd *, new_bfd, ());
|
|||
PROTO (boolean, bfd_add_to_string_table, (char **table, char *new_string,
|
||||
unsigned int *table_length,
|
||||
char **free_ptr));
|
||||
PROTO (bfd_64_type, _do_getb64, (unsigned char *addr));
|
||||
PROTO (bfd_64_type, _do_getl64, (unsigned char *addr));
|
||||
PROTO (unsigned int, _do_getb32, (unsigned char *addr));
|
||||
PROTO (unsigned int, _do_getl32, (unsigned char *addr));
|
||||
PROTO (unsigned int, _do_getb16, (unsigned char *addr));
|
||||
PROTO (unsigned int, _do_getl16, (unsigned char *addr));
|
||||
PROTO (void, _do_putb64, (bfd_64_type data, unsigned char *addr));
|
||||
PROTO (void, _do_putl64, (bfd_64_type data, unsigned char *addr));
|
||||
PROTO (void, _do_putb32, (unsigned long data, unsigned char *addr));
|
||||
PROTO (void, _do_putl32, (unsigned long data, unsigned char *addr));
|
||||
PROTO (void, _do_putb16, (int data, unsigned char *addr));
|
||||
PROTO (void, _do_putl16, (int data, unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getb64, (unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getl64, (unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getb32, (unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getl32, (unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getb16, (unsigned char *addr));
|
||||
PROTO (bfd_vma, _do_getl16, (unsigned char *addr));
|
||||
PROTO (void, _do_putb64, (bfd_vma data, unsigned char *addr));
|
||||
PROTO (void, _do_putl64, (bfd_vma data, unsigned char *addr));
|
||||
PROTO (void, _do_putb32, (bfd_vma data, unsigned char *addr));
|
||||
PROTO (void, _do_putl32, (bfd_vma data, unsigned char *addr));
|
||||
PROTO (void, _do_putb16, (bfd_vma data, unsigned char *addr));
|
||||
PROTO (void, _do_putl16, (bfd_vma data, unsigned char *addr));
|
||||
|
||||
PROTO (boolean, bfd_false, (bfd *ignore));
|
||||
PROTO (boolean, bfd_true, (bfd *ignore));
|
||||
|
@ -179,22 +179,40 @@ extern bfd *bfd_last_cache;
|
|||
|
||||
/* 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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
#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
|
||||
call.
|
||||
*/
|
||||
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
|
||||
it can't have changed since the last lookup, otherwise it has to
|
||||
perform the complicated lookup function
|
||||
|
@ -204,23 +222,44 @@ perform the complicated lookup function
|
|||
(FILE*)(bfd_last_cache->iostream): \
|
||||
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 *));
|
||||
/* 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 *));
|
||||
/* 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
|
||||
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
|
||||
it won't have to be removed from it.
|
||||
*/
|
||||
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.
|
||||
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.
|
||||
*/
|
||||
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
|
||||
{
|
||||
|
||||
/* Remembers the offset from the first symbol in the file for this
|
||||
/*
|
||||
Remembers the offset from the first symbol in the file for this
|
||||
symbol. Generated by @code{coff_renumber_symbols}.
|
||||
*/
|
||||
|
||||
unsigned int offset;
|
||||
|
||||
/* Should the tag field of this symbol be renumbered.
|
||||
/*
|
||||
Should the tag field of this symbol be renumbered.
|
||||
Created by @code{coff_pointerize_aux}.
|
||||
*/
|
||||
|
||||
char fix_tag;
|
||||
|
||||
/* Should the endidx field of this symbol be renumbered.
|
||||
/*
|
||||
Should the endidx field of this symbol be renumbered.
|
||||
Created by @code{coff_pointerize_aux}.
|
||||
*/
|
||||
|
||||
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 internal_auxent auxent;
|
||||
struct internal_syment syment;
|
||||
} u;
|
||||
} combined_entry_type;
|
||||
|
||||
/*
|
||||
|
||||
/* Each canonical asymbol really looks like this:
|
||||
|
||||
Each canonical asymbol really looks like this:
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/* A pointer to the hidden information for this symbol
|
||||
/*
|
||||
A pointer to the hidden information for this symbol
|
||||
*/
|
||||
|
||||
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;
|
||||
} coff_symbol_type;
|
||||
|
||||
/*
|
||||
|
||||
--------------------------------END FROM coffcode.h*/
|
||||
|
||||
|
||||
|
||||
|
|
83
bfd/oasys.c
83
bfd/oasys.c
|
@ -1,23 +1,22 @@
|
|||
/* 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.
|
||||
|
||||
BFD is free software; you can redistribute it and/or modify
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 1, or (at your option)
|
||||
any later version.
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(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
|
||||
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 BFD; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
|
@ -161,7 +160,7 @@ DEFUN(oasys_slurp_symbol_table,(abfd),
|
|||
dest->name = string_ptr;
|
||||
dest->the_bfd = abfd;
|
||||
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
|
||||
if (record.symbol.name[0] != '_') {
|
||||
|
@ -225,7 +224,7 @@ DEFUN(oasys_archive_p,(abfd),
|
|||
bfd *abfd)
|
||||
{
|
||||
oasys_archive_header_type header;
|
||||
oasys_external_archive_header_type header_ext;
|
||||
oasys_extarchive_header_type header_ext;
|
||||
unsigned int i;
|
||||
file_ptr filepos;
|
||||
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);
|
||||
|
||||
|
||||
header.version = bfd_h_get_32(abfd, header_ext.version);
|
||||
header.mod_count = bfd_h_get_32(abfd, header_ext.mod_count);
|
||||
header.mod_tbl_offset = bfd_h_get_32(abfd, header_ext.mod_tbl_offset);
|
||||
header.sym_tbl_size = bfd_h_get_32(abfd, header_ext.sym_tbl_size);
|
||||
header.sym_count = bfd_h_get_32(abfd, header_ext.sym_count);
|
||||
header.sym_tbl_offset = bfd_h_get_32(abfd, header_ext.sym_tbl_offset);
|
||||
header.xref_count = bfd_h_get_32(abfd, header_ext.xref_count);
|
||||
header.xref_lst_offset = bfd_h_get_32(abfd, header_ext.xref_lst_offset);
|
||||
header.version = bfd_h_get_32(abfd, (bfd_byte *)header_ext.version);
|
||||
header.mod_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.mod_count);
|
||||
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, (bfd_byte *)header_ext.sym_tbl_size);
|
||||
header.sym_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_count);
|
||||
header.sym_tbl_offset = bfd_h_get_32(abfd, (bfd_byte *)header_ext.sym_tbl_offset);
|
||||
header.xref_count = bfd_h_get_32(abfd, (bfd_byte *)header_ext.xref_count);
|
||||
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
|
||||
|
@ -283,16 +282,16 @@ DEFUN(oasys_archive_p,(abfd),
|
|||
/* There are two ways of specifying the archive header */
|
||||
|
||||
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);
|
||||
|
||||
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_ext.file_offset);
|
||||
(bfd_byte *) record_ext.file_offset);
|
||||
|
||||
record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
|
||||
record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
|
||||
record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
|
||||
record.dep_count = bfd_h_get_32(abfd, (bfd_byte *)record_ext.dep_count);
|
||||
record.depee_count = bfd_h_get_32(abfd,(bfd_byte *) record_ext.depee_count);
|
||||
record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
|
||||
|
||||
|
||||
module[i].name = bfd_alloc(abfd,33);
|
||||
|
@ -305,17 +304,17 @@ DEFUN(oasys_archive_p,(abfd),
|
|||
record.sect_count * 8 + 187;
|
||||
}
|
||||
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);
|
||||
|
||||
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_ext.file_offset);
|
||||
(bfd_byte *)record_ext.file_offset);
|
||||
|
||||
record.dep_count = bfd_h_get_32(abfd, record_ext.dep_count);
|
||||
record.depee_count = bfd_h_get_32(abfd, record_ext.depee_count);
|
||||
record.sect_count = bfd_h_get_32(abfd, record_ext.sect_count);
|
||||
record.module_name_size = bfd_h_get_32(abfd, record_ext.mod_name_length);
|
||||
record.dep_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.dep_count);
|
||||
record.depee_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.depee_count);
|
||||
record.sect_count = bfd_h_get_32(abfd, (bfd_byte *) record_ext.sect_count);
|
||||
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);
|
||||
bfd_read((PTR)module[i].name, 1, record.module_name_size, abfd);
|
||||
|
@ -412,8 +411,8 @@ DEFUN(oasys_object_p,(abfd),
|
|||
BFD_FAIL();
|
||||
}
|
||||
|
||||
s->size = bfd_h_get_32(abfd, & record.section.value[0]) ;
|
||||
s->vma = bfd_h_get_32(abfd, &record.section.vma[0]);
|
||||
s->size = bfd_h_get_32(abfd, (bfd_byte *) & record.section.value[0]) ;
|
||||
s->vma = bfd_h_get_32(abfd, (bfd_byte *)&record.section.vma[0]);
|
||||
s->flags= 0;
|
||||
had_usefull = true;
|
||||
}
|
||||
|
@ -744,7 +743,7 @@ DEFUN(oasys_get_section_contents,(abfd, section, location, offset, count),
|
|||
}
|
||||
else
|
||||
{
|
||||
(void) memcpy(location, p->data + offset, (int)count);
|
||||
(void) memcpy(location,(PTR)( p->data + offset), (int)count);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -868,7 +867,7 @@ DEFUN(oasys_write_syms, (abfd),
|
|||
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) {
|
||||
|
@ -903,8 +902,8 @@ DEFUN(oasys_write_sections, (abfd),
|
|||
s->name);
|
||||
}
|
||||
out.relb = RELOCATION_TYPE_REL | s->target_index;
|
||||
bfd_h_put_32(abfd, s->size, out.value);
|
||||
bfd_h_put_32(abfd, s->vma, out.vma);
|
||||
bfd_h_put_32(abfd, s->size, (bfd_byte *) out.value);
|
||||
bfd_h_put_32(abfd, s->vma, (bfd_byte *) out.vma);
|
||||
|
||||
oasys_write_record(abfd,
|
||||
oasys_record_is_section_enum,
|
||||
|
@ -949,8 +948,8 @@ DEFUN(oasys_write_end,(abfd),
|
|||
oasys_end_record_type end;
|
||||
uint8e_type null = 0;
|
||||
end.relb = RELOCATION_TYPE_ABS;
|
||||
bfd_h_put_32(abfd, abfd->start_address, end.entry);
|
||||
bfd_h_put_16(abfd, 0, end.fill);
|
||||
bfd_h_put_32(abfd, abfd->start_address, (bfd_byte *)end.entry);
|
||||
bfd_h_put_16(abfd, 0, (bfd_byte *)end.fill);
|
||||
end.zero =0;
|
||||
oasys_write_record(abfd,
|
||||
oasys_record_is_end_enum,
|
||||
|
@ -1151,7 +1150,7 @@ DEFUN(oasys_set_section_contents,(abfd, section, location, offset, count),
|
|||
oasys_per_section(section)->data =
|
||||
(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,
|
||||
count);
|
||||
}
|
||||
|
|
36
bfd/reloc.c
36
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*
|
||||
@section Relocations
|
||||
|
||||
|
@ -24,7 +44,7 @@ particuar section, and fill in the right bits:
|
|||
#include "bfd.h"
|
||||
#include "libbfd.h"
|
||||
/*doc
|
||||
*node typedef arelent, Relocations, reloc handling functions, Relocations
|
||||
@node typedef arelent, Relocations, reloc handling functions, Relocations
|
||||
@section typedef arelent
|
||||
|
||||
|
||||
|
@ -521,9 +541,18 @@ DEFUN(bfd_perform_relocation,(abfd,
|
|||
else
|
||||
{
|
||||
/* 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;
|
||||
case 3:
|
||||
|
||||
/* Do nothing */
|
||||
break;
|
||||
default:
|
||||
|
@ -610,3 +640,5 @@ DEFUN(bfd_perform_relocation,(abfd,
|
|||
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue