diff options
author | Steve Chamberlain <steve@cygnus> | 1991-10-01 03:43:11 +0000 |
---|---|---|
committer | Steve Chamberlain <steve@cygnus> | 1991-10-01 03:43:11 +0000 |
commit | e89f2fbe008a72300bab52dc4145fcf338ae3f18 (patch) | |
tree | 555fc254ebc8ecb57e5f71b1a1c02573c6e89011 /bfd | |
parent | 46f3c7cda5827ea3d8226047bfb4acf161a5f830 (diff) | |
download | gdb-e89f2fbe008a72300bab52dc4145fcf338ae3f18.zip gdb-e89f2fbe008a72300bab52dc4145fcf338ae3f18.tar.gz gdb-e89f2fbe008a72300bab52dc4145fcf338ae3f18.tar.bz2 |
Initial revision
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/cpu-a29k.c | 32 | ||||
-rw-r--r-- | bfd/cpu-h8300.c | 393 | ||||
-rw-r--r-- | bfd/cpu-i386.c | 32 | ||||
-rw-r--r-- | bfd/cpu-i960.c | 158 | ||||
-rw-r--r-- | bfd/cpu-m88k.c | 51 | ||||
-rw-r--r-- | bfd/cpu-vax.c | 52 | ||||
-rwxr-xr-x | bfd/howto.c | 85 | ||||
-rw-r--r-- | bfd/init.c | 62 |
8 files changed, 865 insertions, 0 deletions
diff --git a/bfd/cpu-a29k.c b/bfd/cpu-a29k.c new file mode 100644 index 0000000..9048139 --- /dev/null +++ b/bfd/cpu-a29k.c @@ -0,0 +1,32 @@ +#include <sysdep.h> +#include <bfd.h> +#include "libbfd.h" + + + +static bfd_arch_info_struct_type arch_info_struct = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_a29k, + 0, /* only 1 machine */ + "a29k", + "a29k", + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + 0, + }; + + + + +void DEFUN_VOID(bfd_a29k_arch) +{ + bfd_arch_linkin(&arch_info_struct); +} + + + diff --git a/bfd/cpu-h8300.c b/bfd/cpu-h8300.c new file mode 100644 index 0000000..146285e --- /dev/null +++ b/bfd/cpu-h8300.c @@ -0,0 +1,393 @@ +/* BFD library support routines for the Hitachi H8/300 architecture. + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of 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. */ + +#include <sysdep.h> +#include "bfd.h" +#include "libbfd.h" + +#define DEFINE_TABLE +#include "h8300-opcode.h" + +#define MAXSAME 14 + +static struct h8_opcode * h8_opcodes_sorted[256][MAXSAME]; + +/* Run through the opcodes and sort them into order to make them easy + to disassemble + */ +static void +DEFUN_VOID(bfd_h8_disassemble_init) +{ + unsigned int i; + struct h8_opcode *p; + + for (p = h8_opcodes; p->name; p++) { + int where = 0; + int n1 = 0; + int n2 = 0; + int n3 = 0; + int n4= 0; + if ((int)p->data.nib[0] < 16) { + n1 =(int) p->data.nib[0] ; + } else n1 = 0; + if ((int)p->data.nib[1] < 16) { + n2 = (int) p->data.nib[1]; + }else n2 = 0; + + for (i = 0; i < MAXSAME; i++) { + int j = n1 * 16 + n2; + if (h8_opcodes_sorted[j][i] == (struct h8_opcode *)NULL) { + h8_opcodes_sorted[j][i] = p; + break; + } + } + + if (i==MAXSAME)abort(); + + /* Just make sure there are an even number of nibbles in it, and + that the count is the same s the length */ + for (i = 0; p->data.nib[i] != E; i++) ; + if (i & 1) abort(); + if (i/2 != p->length) abort(); + } + for (i = 0; i < 256; i++) + { + if (h8_opcodes_sorted[i][0]) + p = h8_opcodes_sorted[i][0]; + else h8_opcodes_sorted[i][0] = p; + } +} + +unsigned int +DEFUN(bfd_h8_disassemble,(addr, data, stream), +bfd_vma addr AND +CONST bfd_byte *data AND +FILE *stream) +{ + /* Find the first entry in the table for this opcode */ + int rs = 0; + int rd = 0; + int rdisp = 0; + int abs = 0; + struct h8_opcode **p = h8_opcodes_sorted[(unsigned)(data[0])]; + struct h8_opcode *q; + + /* Find the exact opcode/arg combo */ + while (*p) { + op_enum_type *nib; + unsigned int len = 0; + q = *p++; + nib =q->data.nib; + while (*nib != E) { + op_enum_type looking_for = *nib; + int thisnib = data[len>>1] ; + thisnib = (len & 1) ? (thisnib & 0xf) : ((thisnib >> 4) & 0xf); + if ((int)looking_for & (int)B31) { + if (((int)thisnib & 0x8) ==0) goto fail; + looking_for = (op_enum_type)((int)looking_for & ~(int)B31); + } + if ((int)looking_for & (int)B30) { + if (((int)thisnib & 0x8) !=0) goto fail; + looking_for = (op_enum_type)((int)looking_for & ~(int)B30); + } + switch (looking_for) { + case 0: case 1: case 2: case 3: case 4: case 5: case 6: case 7: + case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: + if ((int)looking_for != thisnib) goto fail; + break; + case ABS16SRC: + case ABS16DST: + case DISPSRC: + case DISPDST: + case IMM16: + abs = (data[len>>1]) * 256 + data[(len+2)>>1]; + len+=3; + nib+=3; + break; + case DISPREG: + rdisp = thisnib; + break; + case KBIT: + abs = thisnib == 0x80 ? 2:1; + break; + case IMM8: + case ABS8SRC: + case ABS8DST: + case DISP8: + abs= data[len>>1]; + len++; + nib++; + break; + case IMM3: + abs = thisnib ; + break; + case RS8: + case RS16: + case RSINC: + case RSIND: + rs = thisnib; + break; + case RD16: + case RDDEC: + case RD8: + case RDIND: + rd = thisnib; + break; + default: + fprintf(stream, "Dont understand \n"); + goto found; + } + len++; + nib++; + } + goto found; + fail: + ; + + } + fprintf(stream, "%02x %02x .word\tH'%x,H'%x\n", + data[0], data[1], + data[0], data[1]); + return 2; + found:; + { int i; + + for (i = 0; i < q->length; i++) { + fprintf(stream, "%02x ", data[i]); + } + for (; i < 6; i++) { + fprintf(stream, " "); + } + } + fprintf(stream, "%s\t",q->name); + /* Now print out the args */ + { + op_enum_type *args = q->args.nib; + int hadone = 0; + while (*args != E) { + if (hadone) + fprintf(stream, ","); + switch ((int)(*args) & ~((int)B30|(int)B31)) { + case IMM16: + case IMM8: + case IMM3: + fprintf(stream, "#H'%x", (unsigned)abs); break; + case RD8: + fprintf(stream, "r%d%c", rd/2, rd & 1 ? 'l' : 'h'); break; + case RS8: + fprintf(stream, "r%d%c", rs/2, rs & 1 ? 'l' : 'h'); break; + case RD16: + fprintf(stream, "r%d", rd& 0x7); break; + case RS16: + fprintf(stream, "r%d", rs & 0x7); break; + case RSINC: + fprintf(stream, "@r%d+", rs & 0x7); break; + case RDDEC: + fprintf(stream, "@-r%d", rd & 0x7); break; + case RDIND: + fprintf(stream, "@r%d", rd & 0x7); break; + case RSIND: + fprintf(stream, "@r%d",rs & 0x7); break; + case ABS8SRC: + case ABS16SRC: + case ABS16DST: + case ABS8DST: + fprintf(stream, "@H'%x", (unsigned)abs); break; + case DISP8: + fprintf(stream, "%d", (char)abs);break; + case DISPSRC: + case DISPDST: + fprintf(stream, "@(%d,r%d)", abs, rdisp & 0x7); break; + case CCR: + fprintf(stream, "ccr"); break; + case KBIT: + fprintf(stream, "#%d",abs); break; + default: + abort(); + } + hadone = 1; + args++; + } + } + return q->length; +} + + + +unsigned int DEFUN( print_insn_h8300,(addr, data, file), +bfd_vma addr AND +CONST bfd_byte *data AND +PTR file) +{ + static boolean init; + if (!init) { + bfd_h8_disassemble_init(); + init= 1; + + } + return bfd_h8_disassemble(addr, data, file); +} + +/* +Relocations for the H8 + +*/ +static bfd_reloc_status_enum_type +DEFUN(howto16_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), +bfd *abfd AND +arelent *reloc_entry AND +asymbol *symbol_in AND +unsigned char *data AND +asection *ignore_input_section) +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_16(abfd, (bfd_byte *)data + addr); + + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_16(abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + + +static bfd_reloc_status_enum_type +DEFUN(howto8_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), +bfd *abfd AND +arelent *reloc_entry AND +asymbol *symbol_in AND +unsigned char *data AND +asection *ignore_input_section) +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_8(abfd, (bfd_byte *)data + addr); + + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8(abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + + +static bfd_reloc_status_enum_type +DEFUN(howto8_FFnn_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), +bfd *abfd AND +arelent *reloc_entry AND +asymbol *symbol_in AND +unsigned char *data AND +asection *ignore_input_section) +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + + long x = bfd_get_8(abfd, (bfd_byte *)data + addr); + abort(); + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8(abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + +static bfd_reloc_status_enum_type +DEFUN(howto8_pcrel_callback,(abfd, reloc_entry, symbol_in, data, ignore_input_section), +bfd *abfd AND +arelent *reloc_entry AND +asymbol *symbol_in AND +unsigned char *data AND +asection *ignore_input_section) +{ + long relocation = 0; + bfd_vma addr = reloc_entry->address; + long x = bfd_get_8(abfd, (bfd_byte *)data + addr); + abort(); + HOWTO_PREPARE(relocation, symbol_in); + + x = (x + relocation + reloc_entry->addend); + + bfd_put_8(abfd, x, (bfd_byte *)data + addr); + return bfd_reloc_ok; +} + + +static reloc_howto_type howto_16 + = NEWHOWTO(howto16_callback,"abs16",1,0); +static reloc_howto_type howto_8 + = NEWHOWTO(howto8_callback,"abs8",0,0); + +static reloc_howto_type howto_8_FFnn + = NEWHOWTO(howto8_FFnn_callback,"ff00+abs8",0,0); + +static reloc_howto_type howto_8_pcrel + = NEWHOWTO(howto8_pcrel_callback,"pcrel8",0,1); + + + +static CONST struct reloc_howto_struct *DEFUN(local_bfd_reloc_type_lookup,( code), + bfd_reloc_code_enum_type code) +{ + switch (code) { + case BFD_RELOC_16: + return &howto_16; + case BFD_RELOC_8_FFnn: + return &howto_8_FFnn; + case BFD_RELOC_8: + return &howto_8; + case BFD_RELOC_8_PCREL: + return &howto_8_pcrel; + } + return (reloc_howto_type *)NULL; +} + +int bfd_default_scan_num_mach(); + +static bfd_arch_info_struct_type arch_info_struct = + { + 16, /* 16 bits in a word */ + 16, /* 16 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_h8300, + 0, /* only 1 machine */ + "H8/300", /* arch_name */ + "H8/300", /* printable name */ + true, /* the default machine */ + bfd_default_compatible, + bfd_default_scan, + print_insn_h8300, + local_bfd_reloc_type_lookup, + 0, + }; + + + + +void DEFUN_VOID(bfd_h8300_arch) +{ + bfd_arch_linkin(&arch_info_struct); +} + + + diff --git a/bfd/cpu-i386.c b/bfd/cpu-i386.c new file mode 100644 index 0000000..2bafe58 --- /dev/null +++ b/bfd/cpu-i386.c @@ -0,0 +1,32 @@ +#include <sysdep.h> +#include <bfd.h> +#include "libbfd.h" + + + +static bfd_arch_info_struct_type arch_info_struct = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_i386, + 0, /* only 1 machine */ + "i386", + "i386", + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + 0, + }; + + + + +void DEFUN_VOID(bfd_i386_arch) +{ + bfd_arch_linkin(&arch_info_struct); +} + + + diff --git a/bfd/cpu-i960.c b/bfd/cpu-i960.c new file mode 100644 index 0000000..5efa726 --- /dev/null +++ b/bfd/cpu-i960.c @@ -0,0 +1,158 @@ +/* BFD library support routines for the i960 architecture. + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Hacked by Steve Chamberlain of 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. */ + + +#include <sysdep.h> +#include "bfd.h" +#include "libbfd.h" + + +/* This routine is provided a string, and tries to work out if it + could possibly refer to the i960 machine pointed at in the + info_struct pointer */ + +static boolean +DEFUN(scan_960_mach, (ap, string), + CONST bfd_arch_info_struct_type *ap AND + CONST char *string) +{ + unsigned long machine; + + /* Look for the string i960, or somesuch at the front of the string */ + + if (strncmp("i960",string) == 0) { + string+=4; + } + else { + /* no match, can be us */ + return false; + } + if (string[0] == 0) { + /* i960 on it's own means core to us*/ + if (ap->mach == bfd_mach_i960_core) return true; + return false; + } + + if (string[0] != ':') { + return false; + } + string++; + if (string[0] == '\0') + return false; + 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 */ + return false; + else if (string[0] == 'k' && string[1] == 'b') + machine = bfd_mach_i960_kb_sb; + else if (string[0] == 's' && string[1] == 'b') + machine = bfd_mach_i960_kb_sb; + else if (string[0] == 'm' && string[1] == 'c') + machine = bfd_mach_i960_mc; + else if (string[0] == 'x' && string[1] == 'a') + machine = bfd_mach_i960_xa; + else if (string[0] == 'c' && string[1] == 'a') + machine = bfd_mach_i960_ca; + else if (string[0] == 'k' && string[1] == 'a') + machine = bfd_mach_i960_ka_sa; + else if (string[0] == 's' && string[1] == 'a') + machine = bfd_mach_i960_ka_sa; + else + return false; + if (machine == ap->mach) return true; + return false; +} + + + +/* This routine is provided two arch_infos and works out the i960 + machine which would be compatible with both and returns a pointer + to its info structure */ + +CONST bfd_arch_info_struct_type * +DEFUN(compatible,(a,b), + CONST bfd_arch_info_struct_type *a AND + CONST bfd_arch_info_struct_type *b) +{ + + /* The i960 has two distinct subspecies which may not interbreed: + CORE CA + CORE KA KB MC XA + Any architecture on the same line is compatible, the one on + the right is the least restrictive. + + We represent this information in an array, each machine to a side */ + +#define ERROR 0 +#define CORE bfd_mach_i960_core /*1*/ +#define KA bfd_mach_i960_ka_sa /*2*/ +#define KB bfd_mach_i960_kb_sb /*3*/ +#define MC bfd_mach_i960_mc /*4*/ +#define XA bfd_mach_i960_xa /*5*/ +#define CA bfd_mach_i960_ca /*6*/ + + + static CONST char matrix[7][7] = + { + ERROR,CORE, KA, KB, MC, XA, CA, + CORE, CORE, KA, KB, MC, XA, CA, + KA, KA, KA, KB, MC, XA, ERROR, + KB, KB, KB, KB, MC, XA, ERROR, + MC, MC, MC, MC, MC, XA, ERROR, + XA, XA, XA, XA, XA, XA, ERROR, + CA, CA, ERROR, ERROR, ERROR, ERROR, CA + }; + + + if (a->arch != b->arch || matrix[a->mach][b->mach] == ERROR) + { + return (bfd_arch_info_struct_type *)NULL; + } + else + { + return (a->mach == matrix[a->mach][b->mach]) ? a : b; + } +} + + + +int bfd_default_scan_num_mach(); +#define N(a,b,d) \ +{ 32, 32, 8,bfd_arch_i960,a,"i960",b,d,compatible,scan_960_mach,0,} + +static bfd_arch_info_struct_type arch_info_struct[] = +{ + N(bfd_mach_i960_core,"i960:core",true), + N(bfd_mach_i960_ka_sa,"i960:ka_sa",false), + N(bfd_mach_i960_kb_sb,"i960:kb_sb",false), + N(bfd_mach_i960_mc,"i960:mc",false), + N(bfd_mach_i960_xa,"i960:xa",false), + N(bfd_mach_i960_ca,"i960:ca",false) + }; + + +void DEFUN_VOID(bfd_i960_arch) +{ + unsigned int i; + for (i = 0; i < 6; i++) { + bfd_arch_linkin(arch_info_struct + i); + } +} diff --git a/bfd/cpu-m88k.c b/bfd/cpu-m88k.c new file mode 100644 index 0000000..a59637d --- /dev/null +++ b/bfd/cpu-m88k.c @@ -0,0 +1,51 @@ +/* bfd back-end for m88k support + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Written by Steve Chamberlain of 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. */ + +#include <sysdep.h> +#include <bfd.h> +#include "libbfd.h" + + + +static bfd_arch_info_struct_type arch_info_struct = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_m88k, + 88100, /* only 1 machine */ + "m88k", + "m88k:88100", + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + 0, + }; + + + +void DEFUN_VOID(bfd_m88k_arch) +{ + bfd_arch_linkin(&arch_info_struct); +} + + + diff --git a/bfd/cpu-vax.c b/bfd/cpu-vax.c new file mode 100644 index 0000000..4d5af23 --- /dev/null +++ b/bfd/cpu-vax.c @@ -0,0 +1,52 @@ +/* bfd back-end for vax support + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Written by Steve Chamberlain of 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. */ + +#include <sysdep.h> +#include <bfd.h> +#include "libbfd.h" + + + +static bfd_arch_info_struct_type arch_info_struct = + { + 32, /* 32 bits in a word */ + 32, /* 32 bits in an address */ + 8, /* 8 bits in a byte */ + bfd_arch_vax, + 0, /* only 1 machine */ + "vax", + "vax", + true, /* the one and only */ + bfd_default_compatible, + bfd_default_scan , + 0, + 0, + }; + + + + +void DEFUN_VOID(bfd_vax_arch) +{ + bfd_arch_linkin(&arch_info_struct); +} + + + diff --git a/bfd/howto.c b/bfd/howto.c new file mode 100755 index 0000000..0be2261 --- /dev/null +++ b/bfd/howto.c @@ -0,0 +1,85 @@ +/* bfd howto manager. + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Written by Steve Chamberlain of 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. */ + +/* The howto manager + + +When an application wants to create a relocation, but doesn't know +what the target machine might call it, it can find out by using this +bit of code. + +*/ + +#include <sysdep.h> +#include <bfd.h> +#include "libbfd.h" +/*proto* bfd_reloc_code_enum_type + +*+++ + +$typedef enum +${ + +16 bits wide, simple reloc + +$ BFD_RELOC_16, + +8 bits wide, but used to form an address like 0xffnn + +$ BFD_RELOC_8_FFnn, + +8 bits wide, simple + +$ BFD_RELOC_8, + +8 bits wide, pc relative + +$ BFD_RELOC_8_PCREL +$ } bfd_reloc_code_enum_real_type; + +*--- + +*/ + + + +/*proto* bfd_reloc_type_lookup +This routine returns a pointer to a howto struct which when invoked, +will perform the supplied relocation on data from the architecture +noted. + +[Note] This function will go away. + +*; PROTO(struct reloc_howto_struct *, + bfd_reloc_type_lookup, + (enum bfd_architecture arch, bfd_reloc_code_enum_type code)); +*/ + + +struct reloc_howto_struct * +DEFUN(bfd_reloc_type_lookup,(arch, code), + enum bfd_architecture arch AND + bfd_reloc_code_enum_type code) +{ + return arch_functions(arch,0)->reloc_type_lookup(code); +} + + + diff --git a/bfd/init.c b/bfd/init.c new file mode 100644 index 0000000..f73c426 --- /dev/null +++ b/bfd/init.c @@ -0,0 +1,62 @@ +/* bfd initialization stuff + Copyright (C) 1990-1991 Free Software Foundation, Inc. + Written by Steve Chamberlain of 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. */ +#include <sysdep.h> +#include "bfd.h" +#include "libbfd.h" + +static boolean initialized = false; + +/*proto* bfd_init + +This routine must be called before any other bfd function to initialize +magical internal data structures. + +*; void EXFUN(bfd_init,(void)); +*/ + +void DEFUN_VOID(bfd_init) +{ + if (initialized == false) { + initialized = true; + + bfd_arch_init(); + } +} + + +/*proto-internal* bfd_check_init + +This routine is called before any other bfd function using initialized +data is used to ensure that the structures have been initialized. +Soon this function will go away, and the bfd library will assume that +bfd_init has been called. + +*; void EXFUN(bfd_check_init,(void)); +*/ + +void DEFUN_VOID(bfd_check_init) +{ + if (initialized == false) { + fprintf(stderr,"The bfd library now requires you to call bfd_init()\n"); + fprintf(stderr,"before any other calls to bfd routines. Please\n"); + fprintf(stderr,"change your source\n"); + bfd_init(); + } +} |