OSDN Git Service

mips64*-*-toppers* support.
[pf3gnuchains/pf3gnuchains3x.git] / bfd / coff-x86_64.c
index 75ddbe5..08ada5a 100644 (file)
@@ -1,11 +1,11 @@
 /* BFD back-end for AMD 64 COFF files.
-   Copyright 2006, 2007 Free Software Foundation, Inc.
+   Copyright 2006, 2007, 2008, 2009  Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
 
    This program is distributed in the hope that it will be useful,
@@ -15,7 +15,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.
    
    Written by Kai Tietz, OneVision Software GmbH&CoKg.  */
 
 #define COFF_WITH_pex64
 #endif
 
-#include "bfd.h"
+/* Note we have to make sure not to include headers twice.
+   Not all headers are wrapped in #ifdef guards, so we define
+   PEI_HEADERS to prevent double including here.  */
+#ifndef PEI_HEADERS
 #include "sysdep.h"
+#include "bfd.h"
 #include "libbfd.h"
 #include "coff/x86_64.h"
 #include "coff/internal.h"
 #include "coff/pe.h"
 #include "libcoff.h"
 #include "libiberty.h"
+#endif
 
 #define BADMAG(x) AMD64BADMAG(x)
 
@@ -544,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)\r
+    {\r
+      *addendp -= (bfd_vma)(rel->r_type - R_AMD64_PCRLONG);\r
+      rel->r_type = R_AMD64_PCRLONG;\r
+    }
 #endif
 
   if (howto->pc_relative)
@@ -710,6 +716,10 @@ coff_amd64_is_local_label_name (bfd *abfd, const char *name)
 
 #endif /* TARGET_UNDERSCORE */
 
+#ifndef bfd_pe_print_pdata
+#define bfd_pe_print_pdata   NULL
+#endif
+
 #include "coffcode.h"
 
 #ifdef PE