X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=bfd%2Fcoff-i386.c;h=803c28fcafcf04faa67a031b80eac5d282249902;hb=b2e9744f80a002c06504ac1ef41ae1f7e48167c8;hp=20d240204a156af723d14b5a1b2263be8ae44bed;hpb=b90efa5b79ac1524ec260f8eb89d1be37e0219a7;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-i386.c b/bfd/coff-i386.c index 20d240204a..803c28fcaf 100644 --- a/bfd/coff-i386.c +++ b/bfd/coff-i386.c @@ -1,5 +1,5 @@ /* BFD back-end for Intel 386 COFF files. - Copyright (C) 1990-2015 Free Software Foundation, Inc. + Copyright (C) 1990-2016 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -139,41 +139,41 @@ coff_i386_reloc (bfd *abfd, #define DOIT(x) \ x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + diff) & howto->dst_mask)) - if (diff != 0) - { - reloc_howto_type *howto = reloc_entry->howto; - unsigned char *addr = (unsigned char *) data + reloc_entry->address; + if (diff != 0) + { + reloc_howto_type *howto = reloc_entry->howto; + unsigned char *addr = (unsigned char *) data + reloc_entry->address; - switch (howto->size) + switch (howto->size) + { + case 0: { - case 0: - { - char x = bfd_get_8 (abfd, addr); - DOIT (x); - bfd_put_8 (abfd, x, addr); - } - break; - - case 1: - { - short x = bfd_get_16 (abfd, addr); - DOIT (x); - bfd_put_16 (abfd, (bfd_vma) x, addr); - } - break; - - case 2: - { - long x = bfd_get_32 (abfd, addr); - DOIT (x); - bfd_put_32 (abfd, (bfd_vma) x, addr); - } - break; - - default: - abort (); + char x = bfd_get_8 (abfd, addr); + DOIT (x); + bfd_put_8 (abfd, x, addr); } - } + break; + + case 1: + { + short x = bfd_get_16 (abfd, addr); + DOIT (x); + bfd_put_16 (abfd, (bfd_vma) x, addr); + } + break; + + case 2: + { + long x = bfd_get_32 (abfd, addr); + DOIT (x); + bfd_put_32 (abfd, (bfd_vma) x, addr); + } + break; + + default: + abort (); + } + } /* Now let bfd_perform_relocation finish everything up. */ return bfd_reloc_continue; @@ -417,7 +417,7 @@ coff_pe_i386_relocate_section (bfd *output_bfd, struct internal_syment *syms, asection **sections) { - if (info->relocatable) + if (bfd_link_relocatable (info)) return TRUE; return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd, @@ -509,7 +509,12 @@ coff_i386_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED, *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase; } - BFD_ASSERT (sym != NULL); + /* PR 17099 - Absolute R_PCRLONG relocations do not need a symbol. */ + if (rel->r_type == R_PCRLONG && sym == NULL) + *addendp -= rel->r_vaddr; + else + BFD_ASSERT (sym != NULL); + if (rel->r_type == R_SECREL32 && sym != NULL) { bfd_vma osect_vma;