This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ld --emit-relocs fixes
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Mon, 6 May 2002 17:44:20 +0930
- Subject: ld --emit-relocs fixes
Fixes a number of --emit-relocs bugs.
* elflink.h (elf_link_input_bfd <emit_relocs>): Adjust r_offset
when not relocatable. Adjust r_addend for output_offset when
reloc is against a section sym. Fix reloc_emitter call for K&R.
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src/src/bfd/elflink.h,v
retrieving revision 1.157
diff -u -p -r1.157 elflink.h
--- bfd/elflink.h 26 Apr 2002 12:59:23 -0000 1.157
+++ bfd/elflink.h 6 May 2002 07:47:01 -0000
@@ -6776,7 +6776,7 @@ elf_link_input_bfd (finfo, input_bfd)
irela->r_offset += o->output_offset;
/* Relocs in an executable have to be virtual addresses. */
- if (finfo->info->emitrelocations)
+ if (!finfo->info->relocateable)
irela->r_offset += o->output_section->vma;
r_symndx = ELF_R_SYM (irela->r_info);
@@ -6842,6 +6842,7 @@ elf_link_input_bfd (finfo, input_bfd)
r_symndx = sec->output_section->target_index;
BFD_ASSERT (r_symndx != 0);
}
+ irela->r_addend += sec->output_offset;
}
else
{
@@ -6908,7 +6909,8 @@ elf_link_input_bfd (finfo, input_bfd)
{
internal_relocs += (NUM_SHDR_ENTRIES (input_rel_hdr)
* bed->s->int_rels_per_ext_rel);
- reloc_emitter (output_bfd, o, input_rel_hdr, internal_relocs);
+ (*reloc_emitter) (output_bfd, o, input_rel_hdr,
+ internal_relocs);
}
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre