return FALSE;
}
+/* Looks up NAME in SECTIONS. If found sets RESULT to NAME's address (in
+ bytes) and returns TRUE, otherwise returns FALSE. Accepts pseudo-section
+ names like "foo.end" which is the end address of section "foo". */
+
static bfd_boolean
resolve_section (const char *name,
asection *sections,
- bfd_vma *result)
+ bfd_vma *result,
+ bfd * abfd)
{
asection *curr;
unsigned int len;
}
/* Hmm. still haven't found it. try pseudo-section names. */
+ /* FIXME: This could be coded more efficiently... */
for (curr = sections; curr; curr = curr->next)
{
len = strlen (curr->name);
{
if (strncmp (".end", name + len, 4) == 0)
{
- *result = curr->vma + curr->size;
+ *result = curr->vma + curr->size / bfd_octets_per_byte (abfd);
return TRUE;
}
if (symbol_is_section)
{
- if (!resolve_section (symbuf, flinfo->output_bfd->sections, result)
+ if (!resolve_section (symbuf, flinfo->output_bfd->sections, result, input_bfd)
&& !resolve_symbol (symbuf, input_bfd, flinfo, result,
isymbuf, locsymcount))
{
if (!resolve_symbol (symbuf, input_bfd, flinfo, result,
isymbuf, locsymcount)
&& !resolve_section (symbuf, flinfo->output_bfd->sections,
- result))
+ result, input_bfd))
{
undefined_reference ("symbol", symbuf);
return FALSE;
else
shift = (8 * wordsz) - (start + len);
- /* FIXME: octets_per_byte. */
- x = get_value (wordsz, chunksz, input_bfd, contents + rel->r_offset);
+ x = get_value (wordsz, chunksz, input_bfd,
+ contents + rel->r_offset * bfd_octets_per_byte (input_bfd));
#ifdef DEBUG
printf ("Doing complex reloc: "
(unsigned long) relocation, (unsigned long) (mask << shift),
(unsigned long) ((relocation & mask) << shift), (unsigned long) x);
#endif
- /* FIXME: octets_per_byte. */
- put_value (wordsz, chunksz, input_bfd, x, contents + rel->r_offset);
+ put_value (wordsz, chunksz, input_bfd, x,
+ contents + rel->r_offset * bfd_octets_per_byte (input_bfd));
return r;
}
break;
default:
{
- /* FIXME: octets_per_byte. */
if (! (o->flags & SEC_EXCLUDE))
{
file_ptr offset = (file_ptr) o->output_offset;
bfd_size_type todo = o->size;
+
+ offset *= bfd_octets_per_byte (output_bfd);
+
if ((o->flags & SEC_ELF_REVERSE_COPY))
{
/* Reverse-copy input section to output. */
}
break;
}
+
ok = bfd_set_section_contents (output_bfd, output_section, buf,
- link_order->offset, size);
+ link_order->offset
+ * bfd_octets_per_byte (output_bfd),
+ size);
free (buf);
if (! ok)
return FALSE;
{
s = sections[n]->u.indirect.section;
offset &= ~(bfd_vma) 0 << s->alignment_power;
- s->output_offset = offset;
+ s->output_offset = offset / bfd_octets_per_byte (abfd);
sections[n]->offset = offset;
- /* FIXME: octets_per_byte. */
offset += sections[n]->size;
}
continue;
if (strcmp (o->name, ".dynstr") != 0)
{
- /* FIXME: octets_per_byte. */
if (! bfd_set_section_contents (abfd, o->output_section,
o->contents,
- (file_ptr) o->output_offset,
+ (file_ptr) o->output_offset
+ * bfd_octets_per_byte (abfd),
o->size))
goto error_return;
}