* Makefile.am (libbfd.h): Add "Extracted from.." comment.
[deliverable/binutils-gdb.git] / bfd / coff-i386.c
index c7aa659c0e021ba9a3faa2f26bf889e6dbf17d19..72c58a4e6727dea07333265c41d64ccc7a061af0 100644 (file)
@@ -1,5 +1,6 @@
 /* BFD back-end for Intel 386 COFF files.
-   Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
+   Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000, 2001
    Free Software Foundation, Inc.
    Written by Cygnus Support.
 
@@ -128,7 +129,9 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
 
 #ifdef COFF_WITH_PE
   /* FIXME: How should this case be handled?  */
-  if (reloc_entry->howto->type == R_IMAGEBASE)
+  if (reloc_entry->howto->type == R_IMAGEBASE
+      && output_bfd != NULL
+      && bfd_get_flavour(output_bfd) == bfd_target_coff_flavour)
     diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
 #endif
 
@@ -154,7 +157,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
            {
              short x = bfd_get_16 (abfd, addr);
              DOIT (x);
-             bfd_put_16 (abfd, x, addr);
+             bfd_put_16 (abfd, (bfd_vma) x, addr);
            }
            break;
 
@@ -162,7 +165,7 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
            {
              long x = bfd_get_32 (abfd, addr);
              DOIT (x);
-             bfd_put_32 (abfd, x, addr);
+             bfd_put_32 (abfd, (bfd_vma) x, addr);
            }
            break;
 
@@ -176,19 +179,17 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
 }
 
 #ifdef COFF_WITH_PE
-
 /* Return true if this relocation should appear in the output .reloc
    section.  */
 
 static boolean in_reloc_p PARAMS ((bfd *, reloc_howto_type *));
 
 static boolean in_reloc_p (abfd, howto)
-     bfd *abfd ATTRIBUTE_UNUSED;
+     bfd * abfd ATTRIBUTE_UNUSED;
      reloc_howto_type *howto;
 {
   return ! howto->pc_relative && howto->type != R_IMAGEBASE;
 }
-
 #endif /* COFF_WITH_PE */
 
 #ifndef PCRELOFFSET
@@ -490,7 +491,9 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
        *addendp -= sym->n_value;
     }
 
-  if (rel->r_type == R_IMAGEBASE)
+  if (rel->r_type == R_IMAGEBASE
+      && (bfd_get_flavour(sec->output_section->owner)
+         == bfd_target_coff_flavour))
     {
       *addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
     }
@@ -577,7 +580,7 @@ const bfd_target
 
   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
 #ifdef COFF_WITH_PE
-   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES
+   | SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY
 #endif
    | SEC_CODE | SEC_DATA),
 
@@ -596,7 +599,7 @@ const bfd_target
      bfd_getl32, bfd_getl_signed_32, bfd_putl32,
      bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
 
-/* Note that we allow an object file to be treated as a core file as well. */
+/* Note that we allow an object file to be treated as a core file as well.  */
     {_bfd_dummy_target, coff_object_p, /* bfd_check_format */
        bfd_generic_archive_p, coff_object_p},
     {bfd_false, coff_mkobject, _bfd_generic_mkarchive, /* bfd_set_format */
This page took 0.024418 seconds and 4 git commands to generate.