From 406dba1369f40a038ad6c2c52d8e3a290f649a6d Mon Sep 17 00:00:00 2001 From: Kai Tietz Date: Fri, 23 Oct 2009 11:30:25 +0000 Subject: [PATCH] 2009-10-23 Kai Tietz * coff-x86_64.c (coff_amd64_rtype_to_howto): Subtract offset of R_AMD64_PCRLONG_ relocations from addend. --- bfd/ChangeLog | 5 +++++ bfd/coff-x86_64.c | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 6fabb762851..35a295a8010 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2009-10-23 Kai Tietz + + * coff-x86_64.c (coff_amd64_rtype_to_howto): Subtract offset + of R_AMD64_PCRLONG_ relocations from addend. + 2009-10-23 Alan Modra * plugin.c: Produce empty object if not BFD_SUPPORTS_PLUGINS. diff --git a/bfd/coff-x86_64.c b/bfd/coff-x86_64.c index ecce9f40c8d..08ada5a6c19 100644 --- a/bfd/coff-x86_64.c +++ b/bfd/coff-x86_64.c @@ -550,16 +550,16 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, bfd_set_error (bfd_error_bad_value); return NULL; } - if (rel->r_type >= R_AMD64_PCRLONG_1 && rel->r_type <= R_AMD64_PCRLONG_5) - { - rel->r_vaddr += (bfd_vma)(rel->r_type-R_AMD64_PCRLONG); - rel->r_type = R_AMD64_PCRLONG; - } howto = howto_table + rel->r_type; #if defined(COFF_WITH_PE) /* Cancel out code in _bfd_coff_generic_relocate_section. */ *addendp = 0; + if (rel->r_type >= R_AMD64_PCRLONG_1 && rel->r_type <= R_AMD64_PCRLONG_5) + { + *addendp -= (bfd_vma)(rel->r_type - R_AMD64_PCRLONG); + rel->r_type = R_AMD64_PCRLONG; + } #endif if (howto->pc_relative) -- 2.30.2