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
#
#
# $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 ***
#
# Revision 1.12 1991/08/01 05:33:39 gnu
+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)
*/
+#define KEEPIT flags
+#define KEEPITTYPE int
#include "bfd.h"
#include <sysdep.h>
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 */
};
struct external_nlist *sym_pointer AND
aout_symbol_type *cache_ptr AND
bfd *abfd)
-{
- switch (cache_ptr->type & N_TYPE) {
- case N_SETA:
- case N_SETT:
- case N_SETD:
- case N_SETB:
- {
- char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1);
- asection *section ;
- arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain));
- strcpy(copy, cache_ptr->symbol.name);
- section = bfd_make_section(abfd,copy);
- switch ( (cache_ptr->type & N_TYPE) ) {
- case N_SETA:
- section->flags = SEC_CONSTRUCTOR;
- reloc->relent.section = (asection *)NULL;
- cache_ptr->symbol.section = (asection *)NULL;
- break;
- case N_SETT:
- section->flags = SEC_CONSTRUCTOR_TEXT;
- reloc->relent.section = (asection *)obj_textsec(abfd);
- cache_ptr->symbol.value -= reloc->relent.section->vma;
- break;
- case N_SETD:
- section->flags = SEC_CONSTRUCTOR_DATA;
- reloc->relent.section = (asection *)obj_datasec(abfd);
- cache_ptr->symbol.value -= reloc->relent.section->vma;
- break;
- case N_SETB:
- section->flags = SEC_CONSTRUCTOR_BSS;
- reloc->relent.section = (asection *)obj_bsssec(abfd);
- cache_ptr->symbol.value -= reloc->relent.section->vma;
- break;
- }
- cache_ptr->symbol.section = reloc->relent.section;
- reloc->relent.addend = cache_ptr->symbol.value ;
+ {
+ switch (cache_ptr->type & N_TYPE) {
+ case N_SETA:
+ case N_SETT:
+ case N_SETD:
+ case N_SETB:
+ {
+ char *copy = bfd_alloc(abfd, strlen(cache_ptr->symbol.name)+1);
+ asection *section ;
+ arelent_chain *reloc = (arelent_chain *)bfd_alloc(abfd, sizeof(arelent_chain));
+ strcpy(copy, cache_ptr->symbol.name);
+ section = bfd_make_section(abfd,copy);
+ switch ( (cache_ptr->type & N_TYPE) ) {
+ case N_SETA:
+ section->flags = SEC_CONSTRUCTOR;
+ reloc->relent.section = (asection *)NULL;
+ cache_ptr->symbol.section = (asection *)NULL;
+ break;
+ case N_SETT:
+ section->flags = SEC_CONSTRUCTOR_TEXT;
+ reloc->relent.section = (asection *)obj_textsec(abfd);
+ cache_ptr->symbol.value -= reloc->relent.section->vma;
+ break;
+ case N_SETD:
+ section->flags = SEC_CONSTRUCTOR_DATA;
+ reloc->relent.section = (asection *)obj_datasec(abfd);
+ cache_ptr->symbol.value -= reloc->relent.section->vma;
+ break;
+ case N_SETB:
+ section->flags = SEC_CONSTRUCTOR_BSS;
+ reloc->relent.section = (asection *)obj_bsssec(abfd);
+ cache_ptr->symbol.value -= reloc->relent.section->vma;
+ break;
+ }
+ cache_ptr->symbol.section = reloc->relent.section;
+ reloc->relent.addend = cache_ptr->symbol.value ;
- /* We modify the symbol to belong to a section depending upon the
- 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
- pointer to the symbol. Build a reloc entry to relocate to this
- symbol attached to this section. */
-
-
- section->reloc_count++;
- section->alignment_power = 2;
- reloc->relent.sym_ptr_ptr = (asymbol **)NULL;
- reloc->next = section->constructor_chain;
- section->constructor_chain = reloc;
- reloc->relent.address = section->size;
- section->size += sizeof(int *);
-
- reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX;
- cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR;
- }
- break;
+ /* We modify the symbol to belong to a section depending upon the
+ 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
+ pointer to the symbol. Build a reloc entry to relocate to this
+ symbol attached to this section. */
+
+
+ section->reloc_count++;
+ section->alignment_power = 2;
+ reloc->relent.sym_ptr_ptr = (asymbol **)NULL;
+ reloc->next = section->constructor_chain;
+ section->constructor_chain = reloc;
+ reloc->relent.address = section->size;
+ section->size += sizeof(int *);
+
+ reloc->relent.howto = howto_table_ext +CTOR_TABLE_RELOC_IDX;
+ cache_ptr->symbol.flags |= BSF_DEBUGGING | BSF_CONSTRUCTOR;
+ }
+ break;
default:
if (cache_ptr->type == N_WARNING)
{
(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
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;
}
}
}
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 {
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 {
-/* 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 ();
static boolean scan_960_mach ();
struct arch_print {
- enum bfd_architecture arch;
- char *astr;
- char *(*mach_print)();
- boolean (*mach_scan)();
+ enum bfd_architecture arch;
+ char *astr;
+ char *(*mach_print)();
+ boolean (*mach_scan)();
} arch_print[] = {
- {bfd_arch_unknown, "unknown", 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_vax, "vax", prt_num_mach, scan_num_mach},
- {bfd_arch_i960, "i960", prt_960_mach, scan_960_mach},
- {bfd_arch_a29k, "a29k", 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_i386, "i386", 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_i860, "i860", 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_convex, "convex", 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_h8_300, "H8/300", prt_num_mach, scan_num_mach},
- {bfd_arch_unknown, (char *)0, 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_m68k, "m68k", 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_a29k, "a29k", 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_i386, "i386", 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_i860, "i860", 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_convex, "convex", 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_h8_300, "H8/300", 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
- type. The result is only good until the next call to
- bfd_printable_arch_mach. */
-
-char *
-bfd_printable_arch_mach (arch, machine)
- enum bfd_architecture arch;
- unsigned long 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.
+*; PROTO(CONST char *,bfd_printable_arch_mach,
+ (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;
for (ap = arch_print; ap->astr; ap++) {
if (ap->arch == arch) {
if (machine == 0)
- return ap->astr;
+ return ap->astr;
return (*ap->mach_print)(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),
if (!strncmp (ap->astr, string, len)) {
/* We found the architecture, now see about the machine type */
if (archp)
- *archp = ap->arch;
+ *archp = ap->arch;
if (string[len] != '\0') {
- if (ap->mach_scan (string+len, ap, archp, machinep, 1))
- return true;
+ if (ap->mach_scan (string+len, ap, archp, machinep, 1))
+ return true;
}
if (machinep)
- *machinep = 0;
+ *machinep = 0;
return true;
}
}
case 68030:
case 68040:
case 68332:
- case 68050: arch = bfd_arch_m68k; break;
- case 68000: arch = bfd_arch_m68k; machine = 0; break;
+ case 68050: arch = bfd_arch_m68k; break;
+ case 68000: arch = bfd_arch_m68k; machine = 0; break;
case 80960:
- case 960: arch = bfd_arch_i960; machine = 0; break;
+ case 960: arch = bfd_arch_i960; machine = 0; break;
case 386:
- case 80386: arch = bfd_arch_i386; machine = 0; break;
- case 486: arch = bfd_arch_i386; break;
+ case 80386: arch = bfd_arch_i386; machine = 0; 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 32032:
case 32232:
case 32332:
case 32432:
- case 32532: arch = bfd_arch_ns32k; break;
- case 32000: arch = bfd_arch_ns32k; machine = 0; break;
+ case 32532: arch = bfd_arch_ns32k; break;
+ case 32000: arch = bfd_arch_ns32k; machine = 0; break;
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;
}
}
char *str;
switch (machine) {
- case bfd_mach_i960_core: str = "core"; break;
- case bfd_mach_i960_kb_sb: str = "kb"; break;
- case bfd_mach_i960_mc: str = "mc"; break;
- case bfd_mach_i960_xa: str = "xa"; break;
- case bfd_mach_i960_ca: str = "ca"; break;
- case bfd_mach_i960_ka_sa: str = "ka"; break;
+ case bfd_mach_i960_core: str = "core"; break;
+ case bfd_mach_i960_kb_sb: str = "kb"; break;
+ case bfd_mach_i960_mc: str = "mc"; break;
+ case bfd_mach_i960_xa: str = "xa"; break;
+ case bfd_mach_i960_ca: str = "ca"; break;
+ case bfd_mach_i960_ka_sa: str = "ka"; break;
default:
- return prt_num_mach (ap, machine);
+ return prt_num_mach (ap, machine);
}
sprintf (result, "%s:%s", ap->astr, str);
return result;
if (string[0] == 'c' && string[1] == 'o' && string[2] == 'r' &&
string[3] == 'e' && string[4] == '\0')
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;
else if (string[0] == 'k' && string[1] == 'b')
machine = bfd_mach_i960_kb_sb;
\f
-/* 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;
machb = bfd_get_machine (bbfd);
if (archb == bfd_arch_unknown)
- pick_a = 1;
+ pick_a = 1;
else if (archa == bfd_arch_unknown)
- pick_a = 0;
+ pick_a = 0;
else if (archa != archb)
- return false; /* Not compatible */
+ return false; /* Not compatible */
else {
/* Architectures are the same. Check machine types. */
- if (macha == machb) /* Same machine type */
+ if (macha == machb) /* Same machine type */
pick_a = 1;
- else if (machb == 0) /* B is default */
+ else if (machb == 0) /* B is default */
pick_a = 1;
- else if (macha == 0) /* A is default */
+ else if (macha == 0) /* A is default */
pick_a = 0;
else switch (archa) {
/* If particular machine types of one architecture are not
- compatible with each other, this is the place to put those tests
- (returning false if incompatible). */
+ compatible with each other, this is the place to put those tests
+ (returning false if incompatible). */
case bfd_arch_i960:
- /* The i960 has two distinct subspecies which may not interbreed:
- CORE CA
- CORE KA KB MC
- Any architecture on the same line is compatible, the one on
- the right is the least restrictive. */
- /* So, if either is a ca then the other must be a be core or ca */
- if (macha == bfd_mach_i960_ca) {
- if (machb != bfd_mach_i960_ca &&
- machb != bfd_mach_i960_core) {
- return false;
- }
- pick_a = 1;
- }
- else if (machb == bfd_mach_i960_ca) {
- if (macha != bfd_mach_i960_ca &&
- macha != bfd_mach_i960_core) {
- return false;
- }
- pick_a = 0;
- }
- else {
- /* This must be from the bottom row, so take the higest */
- pick_a = (macha > machb);
- }
- break;
+ /* The i960 has two distinct subspecies which may not interbreed:
+ CORE CA
+ CORE KA KB MC
+ Any architecture on the same line is compatible, the one on
+ the right is the least restrictive. */
+ /* So, if either is a ca then the other must be a be core or ca */
+ if (macha == bfd_mach_i960_ca) {
+ if (machb != bfd_mach_i960_ca &&
+ machb != bfd_mach_i960_core) {
+ return false;
+ }
+ pick_a = 1;
+ }
+ else if (machb == bfd_mach_i960_ca) {
+ if (macha != bfd_mach_i960_ca &&
+ macha != bfd_mach_i960_core) {
+ return false;
+ }
+ pick_a = 0;
+ }
+ else {
+ /* This must be from the bottom row, so take the higest */
+ pick_a = (macha > machb);
+ }
+ break;
/* For these chips, as far as we care, "lower" numbers are included
- by "higher" numbers, e.g. merge 68010 and 68020 into 68020,
- 386 and 486 into 486, etc. This will need to change
- if&when we care about things like 68332. */
+ by "higher" numbers, e.g. merge 68010 and 68020 into 68020,
+ 386 and 486 into 486, etc. This will need to change
+ if&when we care about things like 68332. */
case bfd_arch_m68k:
case bfd_arch_ns32k:
case bfd_arch_i386:
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() { }
+
+
+
-/* 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$ */
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));
/* 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
+ PROTO(bfd_vma, bfd_log2,(bfd_vma x));
+
+/*
+
+ --------------------------------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
(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.
+ PROTO(void, bfd_cache_init, (bfd *));
+
+/*
+
+*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 *
+ PROTO(void, bfd_cache_close, (bfd *));
+
+/*
+
+*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
+ PROTO(FILE *, bfd_open_file, (bfd *));
+
+/*
+
+*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 *));
+ PROTO(FILE *, bfd_cache_lookup_worker, (bfd *));
+
+/*
+
+ --------------------------------END FROM cache.c*/
+
+/* FROM reloc.c*/
+
-/*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
- 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;
- /* 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;
- /* 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;
- /* 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*/
+
+
+
/* 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$ */
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] != '_') {
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);
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
/* 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);
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);
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;
}
}
else
{
- (void) memcpy(location, p->data + offset, (int)count);
+ (void) memcpy(location,(PTR)( p->data + offset), (int)count);
}
return true;
}
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) {
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,
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,
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);
}
|SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* section flags */
' ', /* ar_pad_char */
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, /* hdrs */
bfd_false,
},
JUMP_TABLE(oasys)
- };
+};
+/* 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
#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
{
/*
Anything which started out as pc relative should end up that
- way too.
-
- There are two ways we can see a pcrel instruction. Sometimes
- the pcrel displacement has been partially calculated, it
- includes the distance from the start of the section to the
- instruction in it (eg sun3), and sometimes the field is
- totally blank - eg m88kbcs.
- */
+ way too.
+
+ There are two ways we can see a pcrel instruction. Sometimes
+ the pcrel displacement has been partially calculated, it
+ includes the distance from the start of the section to the
+ instruction in it (eg sun3), and sometimes the field is
+ totally blank - eg m88kbcs.
+ */
relocation -=
if ( howto->partial_inplace == false) {
/*
This is a partial relocation, and we want to apply the relocation
- to the reloc entry rather than the raw data. Modify the reloc
- inplace to reflect what we now know.
- */
+ to the reloc entry rather than the raw data. Modify the reloc
+ inplace to reflect what we now know.
+ */
reloc_entry->addend = relocation ;
reloc_entry->section = reloc_target_input_section;
if (reloc_target_input_section != (asection *)NULL) {
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;
+ }
}
}
}
break;
case 3:
+
/* Do nothing */
break;
default:
return flag;
}
+
+