struct internal_reloc n;
arelent *q = p[i];
memset((PTR)&n, 0, sizeof(n));
+
+
+#ifndef SWAP_OUT_RELOC_OFFSET
+ /* @@FIXME COFF relocs don't support addends. Code should probably be
+ in the target-independent code, using a target flag to decide whether
+ to fold the addend into the section contents. */
+
+ if (q->addend != 0)
+ abort ();
+#endif
+
n.r_vaddr = q->address + s->vma;
/* The 29k const/consth reloc pair is a real kludge - the consth
part doesn't have a symbol - it has an offset. So rebuilt
{
coff_symbol_type *csym = coff_symbol_from (abfd, sympp[i]);
CONST char *name;
-
- if (csym->native && csym->native->u.syment.n_sclass == C_FILE)
+ if (csym)
+ {
+ /* only do this if there is a coff representation of the input
+ symbol */
+ if (csym->native && csym->native->u.syment.n_sclass == C_FILE)
{
need_file = 0;
continue;
}
- name = csym->symbol.name;
- if (!name)
- continue;
- if (!strcmp (name, _TEXT))
- need_text = 0;
- else if (!strcmp (name, _DATA))
- need_data = 0;
- else if (!strcmp (name, _BSS))
- need_bss = 0;
+ name = csym->symbol.name;
+ if (!name)
+ continue;
+ if (!strcmp (name, _TEXT))
+ need_text = 0;
+ else if (!strcmp (name, _DATA))
+ need_data = 0;
+ else if (!strcmp (name, _BSS))
+ need_bss = 0;
+ }
}
/* Now i == bfd_get_symcount (abfd). */
/* @@ For now, don't deal with .file symbol. */
sympp2[i++] = coff_section_symbol (abfd, _DATA);
if (need_bss)
sympp2[i++] = coff_section_symbol (abfd, _BSS);
- assert (i == nsyms);
+ BFD_ASSERT (i == nsyms);
bfd_set_symtab (abfd, sympp2, nsyms);
}
#endif /* NO_COFF_SYMBOLS */
/* This was pointing into this section, so mangle it */
if (p->value > value)
{
- p->value -=2;
+ p->value -= slip;
}
}
s++;
*/
if (data[dst_address-1] != 0x6a)
abort();
- switch (data[dst_address] & 0xf0)
+ switch (data[src_address] & 0xf0)
{
case 0x00:
/* Src is memory */
case R_RELBYTE:
{
unsigned int gap =get_value(reloc,seclet);
- if (gap > 256)
+ if (gap > 0xff && gap < ~0xff)
{
bfd_error_vector.reloc_value_truncated(reloc, seclet);
}
+
/* bfd back-end for ieee-695 objects.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+ Copyright (C) 1990-1992 Free Software Foundation, Inc.
Written by Steve Chamberlain of Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#define KEEPMINUSPCININST 1
+
/* IEEE 695 format is a stream of records, which we parse using a simple one-
token (which is one byte in this lexicon) lookahead recursive decent
parser. */
#include "ieee.h"
#include "libieee.h"
+
+#include "obstack.h"
+#define obstack_chunk_alloc bfd_xmalloc
+#define obstack_chunk_free free
+
/* Functions for writing to ieee files in the strange way that the
standard requires. */
static
reloc_howto_type rel32_howto
- = HOWTO(1,0,2,32,true,0,false,true,0,"rel32",true,0xffffffff, 0xffffffff,true);
+ = HOWTO(1,0,2,32,true,0,false,true,0,"rel32",true,0xffffffff,
+ 0xffffffff,false);
+
static
reloc_howto_type rel16_howto
- = HOWTO(1,0,1,16,true,0,false,true,0,"rel16",true,0x0000ffff, 0x0000ffff,true);
+ = HOWTO(1,0,1,16,true,0,false,true,0,"rel16",true,0x0000ffff, 0x0000ffff,false);
static
reloc_howto_type rel8_howto
- = HOWTO(1,0,0,8,true,0,false,true,0,"rel8",true,0x000000ff, 0x000000ff,true);
+ = HOWTO(1,0,0,8,true,0,false,true,0,"rel8",true,0x000000ff, 0x000000ff,false);
static ieee_symbol_index_type NOSYMBOL = { 0, 0};
static void
-DEFUN(parse_expression,(ieee, value, symbol, pcrel, extra),
+DEFUN(parse_expression,(ieee, value, symbol, pcrel, extra, section),
ieee_data_type *ieee AND
bfd_vma *value AND
ieee_symbol_index_type *symbol AND
boolean *pcrel AND
- unsigned int *extra)
+ unsigned int *extra AND
+ asection **section)
{
#define POS sp[1]
POP(sy1, section1, value1);
POP(sy2, section2, value2);
- PUSH(sy1.letter ? sy1 : sy2, section1 ? section1: section2, value1+value2);
+ PUSH(sy1.letter ? sy1 : sy2, section1!=&bfd_abs_section ? section1: section2, value1+value2);
}
break;
default:
}
{
asection *dummy;
-
+
POP(*symbol, dummy, *value);
+ if (section) *section = dummy;
}
loop = false;
symbol_name_index = must_parse_int(&(ieee->h));
parse_expression(ieee,
&symbol->symbol.value,
- &symbol->symbol.section,
&symbol_ignore,
&pcrel_ignore,
- &extra);
+ &extra,
+ &symbol->symbol.section);
symbol->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
unsigned int i;
uint8e_type buffer[512];
-
+ struct obstack ob;
int buffer_offset = 0;
ieee_ar_data_type *save = abfd->tdata.ieee_ar_data;
ieee_ar_data_type *ieee ;
ieee= IEEE_AR_DATA(abfd);
+
bfd_read((PTR)buffer, 1, sizeof(buffer), abfd);
ieee->h.first_byte = buffer;
free( read_id(&(ieee->h)));
/* This must be an IEEE archive, so we'll buy some space to do
things */
+
+ obstack_begin(&ob, 128);
+
+
ieee->element_count = 0;
ieee->element_index = 0;
t.file_offset = must_parse_int(&(ieee->h));
t.abfd = (bfd *)NULL;
ieee->element_count++;
- bfd_alloc_grow(abfd, (PTR)&t, sizeof(t));
+
+ obstack_grow(&ob, (PTR)&t, sizeof(t));
/* Make sure that we don't go over the end of the buffer */
else loop = false;
}
- ieee->elements = (ieee_ar_obstack_type *)bfd_alloc_finish(abfd);
+ ieee->elements = obstack_finish(&ob);
/* Now scan the area again, and replace BB offsets with file */
/* offsets */
ieee_data_type *save = IEEE_DATA(abfd);
abfd->tdata.ieee_data = 0;
ieee_mkobject(abfd);
- ieee = IEEE_DATA(abfd);
+ ieee = IEEE_DATA(abfd);
+ bfd_seek(abfd, 0, 0);
/* Read the first few bytes in to see if it makes sense */
bfd_read((PTR)buffer, 1, sizeof(buffer), abfd);
parse_expression(ieee,
&r->relent.addend,
- §ion,
&r->symbol,
- &pcrel, &extra);
+ &pcrel, &extra, §ion);
r->relent.address = current_map->pc;
s->reloc_count++;
if (r->relent.sym_ptr_ptr == 0) {
next_byte(&(ieee->h));
must_parse_int(&(ieee->h)); /* Thow away section #*/
parse_expression(ieee, &value,
- &dsection,
&symbol,
- &pcrel, &extra);
+ &pcrel, &extra,
+ 0);
current_map->pc = value;
BFD_ASSERT((unsigned)(value - s->vma) <= s->_raw_size);
}
bfd *abfd;
struct stat *buf;
{
- ieee_ar_data_type *ar = IEEE_AR_DATA(abfd);
+ ieee_ar_data_type *ar = abfd->my_archive->tdata.ieee_ar_data;
if (ar == (ieee_ar_data_type *)NULL) {
bfd_error = invalid_operation;
return -1;
else {
buf->st_size = 0x1;
buf->st_mode = 0666;
- return 0;
+ return ! ieee_object_p(abfd);
}
}
static int