2011-05-09 Paul Brook <paul@codesourcery.com>
[binutils-gdb.git] / bfd / coff-x86_64.c
index 08ada5a6c19d83c5560dd2db3da37c9bb3cb2915..c739d69c7307373cc3223106ba8dcc6239f0e27e 100644 (file)
@@ -192,7 +192,8 @@ coff_amd64_reloc (bfd *abfd,
 static bfd_boolean
 in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
 {
-  return ! howto->pc_relative && howto->type != R_AMD64_IMAGEBASE;
+  return ! howto->pc_relative && howto->type != R_AMD64_IMAGEBASE
+        && howto->type != R_AMD64_SECREL;
 }
 #endif /* COFF_WITH_PE */
 
@@ -545,7 +546,7 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
 {
   reloc_howto_type *howto;
 
-  if (rel->r_type > ARRAY_SIZE (howto_table))
+  if (rel->r_type >= ARRAY_SIZE (howto_table))
     {
       bfd_set_error (bfd_error_bad_value);
       return NULL;
@@ -555,10 +556,10 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
 #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)\r
-    {\r
-      *addendp -= (bfd_vma)(rel->r_type - R_AMD64_PCRLONG);\r
-      rel->r_type = R_AMD64_PCRLONG;\r
+  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
 
@@ -621,15 +622,15 @@ coff_amd64_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
        osect_vma = h->root.u.def.section->output_section->vma;
       else
        {
-         asection *sec;
+         asection *s;
          int i;
 
          /* Sigh, the only way to get the section to offset against
             is to find it the hard way.  */
-         for (sec = abfd->sections, i = 1; i < sym->n_scnum; i++)
-           sec = sec->next;
+         for (s = abfd->sections, i = 1; i < sym->n_scnum; i++)
+           s = s->next;
 
-         osect_vma = sec->output_section->vma;
+         osect_vma = s->output_section->vma;
        }
 
       *addendp -= osect_vma;