This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
BFD backend fix for x86-64
- From: Andreas Schwab <schwab at suse dot de>
- To: binutils at sources dot redhat dot com
- Date: Mon, 01 Jul 2002 10:47:30 +0200
- Subject: BFD backend fix for x86-64
I have checked in this patch, approved by Andreas Jaeger.
Andreas.
2002-07-01 Andreas Schwab <schwab@suse.de>
* elf64-x86-64.c (elf64_x86_64_relocate_section): Only convert
R_X86_64_64 to R_X86_64_RELATIVE.
Index: elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.45
diff -u -p -a -u -p -a -r1.45 elf64-x86-64.c
--- elf64-x86-64.c 1 Jul 2002 08:06:46 -0000 1.45
+++ elf64-x86-64.c 1 Jul 2002 08:42:27 -0000
@@ -1876,9 +1876,44 @@ elf64_x86_64_relocate_section (output_bf
else
{
/* This symbol is local, or marked to become local. */
- relocate = true;
- outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
- outrel.r_addend = relocation + rel->r_addend;
+ if (r_type == R_X86_64_64)
+ {
+ relocate = true;
+ outrel.r_info = ELF64_R_INFO (0, R_X86_64_RELATIVE);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
+ else
+ {
+ long sindx;
+
+ if (h == NULL)
+ sec = local_sections[r_symndx];
+ else
+ {
+ BFD_ASSERT (h->root.type == bfd_link_hash_defined
+ || (h->root.type
+ == bfd_link_hash_defweak));
+ sec = h->root.u.def.section;
+ }
+ if (sec != NULL && bfd_is_abs_section (sec))
+ sindx = 0;
+ else if (sec == NULL || sec->owner == NULL)
+ {
+ bfd_set_error (bfd_error_bad_value);
+ return false;
+ }
+ else
+ {
+ asection *osec;
+
+ osec = sec->output_section;
+ sindx = elf_section_data (osec)->dynindx;
+ BFD_ASSERT (sindx > 0);
+ }
+
+ outrel.r_info = ELF64_R_INFO (sindx, r_type);
+ outrel.r_addend = relocation + rel->r_addend;
+ }
}
sreloc = elf_section_data (input_section)->sreloc;
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."