* elf32-rl78.c (GET_RELOC): Assert that there are relocs to get.
[binutils-gdb.git] / bfd / coffcode.h
index e71aadd30430bd903d652505e288b6a5555c68aa..49c13c3d124ea9a24617c5e2b83ef310fc8c29b6 100644 (file)
@@ -119,11 +119,11 @@ SUBSUBSECTION
 
        The Microsoft PE variants of the Coff object file format add
        an extension to support the use of long section names.  This
-       extension is defined in section 4 of the Microsoft PE/COFF 
+       extension is defined in section 4 of the Microsoft PE/COFF
        specification (rev 8.1).  If a section name is too long to fit
        into the section header's @code{s_name} field, it is instead
        placed into the string table, and the @code{s_name} field is
-       filled with a slash ("/") followed by the ASCII decimal 
+       filled with a slash ("/") followed by the ASCII decimal
        representation of the offset of the full name relative to the
        string table base.
 
@@ -140,11 +140,11 @@ SUBSUBSECTION
        expecting the MS standard format may become confused; @file{PEview} is
        one known example.
 
-       The functionality is supported in BFD by code implemented under 
+       The functionality is supported in BFD by code implemented under
        the control of the macro @code{COFF_LONG_SECTION_NAMES}.  If not
        defined, the format does not support long section names in any way.
-       If defined, it is used to initialise a flag, 
-       @code{_bfd_coff_long_section_names}, and a hook function pointer, 
+       If defined, it is used to initialise a flag,
+       @code{_bfd_coff_long_section_names}, and a hook function pointer,
        @code{_bfd_coff_set_long_section_names}, in the Coff backend data
        structure.  The flag controls the generation of long section names
        in output BFDs at runtime; if it is false, as it will be by default
@@ -153,7 +153,7 @@ SUBSUBSECTION
        points to a function that allows the value of the flag to be altered
        at runtime, on formats that support long section names at all; on
        other formats it points to a stub that returns an error indication.
-       
+
        With input BFDs, the flag is set according to whether any long section
        names are detected while reading the section headers.  For a completely
        new BFD, the flag is set to the default for the target format.  This
@@ -372,6 +372,7 @@ CODE_FRAGMENT
 #define STRING_SIZE_SIZE 4
 
 #define DOT_DEBUG      ".debug"
+#define DOT_ZDEBUG     ".zdebug"
 #define GNU_LINKONCE_WI ".gnu.linkonce.wi."
 #define GNU_LINKONCE_WT ".gnu.linkonce.wt."
 #define DOT_RELOC      ".reloc"
@@ -545,7 +546,8 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
       styp_flags = STYP_LIT;
 #endif /* _LIT */
     }
-  else if (CONST_STRNEQ (sec_name, DOT_DEBUG))
+  else if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+           || CONST_STRNEQ (sec_name, DOT_ZDEBUG))
     {
       /* Handle the XCOFF debug section and DWARF2 debug sections.  */
       if (!sec_name[6])
@@ -652,6 +654,7 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
   bfd_boolean is_dbg = FALSE;
 
   if (CONST_STRNEQ (sec_name, DOT_DEBUG)
+      || CONST_STRNEQ (sec_name, DOT_ZDEBUG)
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (sec_name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (sec_name, GNU_LINKONCE_WT)
@@ -670,7 +673,9 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
   /* FIXME: There is no gas syntax to specify the debug section flag.  */
   if (is_dbg)
     {
-      sec_flags &= (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD);
+      sec_flags &= (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD
+                   | SEC_LINK_DUPLICATES_SAME_CONTENTS
+                   | SEC_LINK_DUPLICATES_SAME_SIZE);
       sec_flags |= SEC_DEBUGGING | SEC_READONLY;
     }
 
@@ -698,7 +703,11 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
   /* skip SORT */
   if (sec_flags & SEC_LINK_ONCE)
     styp_flags |= IMAGE_SCN_LNK_COMDAT;
-  /* skip LINK_DUPLICATES */
+  if ((sec_flags
+       & (SEC_LINK_DUPLICATES_DISCARD | SEC_LINK_DUPLICATES_SAME_CONTENTS
+          | SEC_LINK_DUPLICATES_SAME_SIZE)) != 0)
+    styp_flags |= IMAGE_SCN_LNK_COMDAT;
+
   /* skip LINKER_CREATED */
 
   if ((sec_flags & SEC_COFF_NOREAD) == 0)
@@ -815,6 +824,7 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
        sec_flags |= SEC_ALLOC;
     }
   else if (CONST_STRNEQ (name, DOT_DEBUG)
+          || CONST_STRNEQ (name, DOT_ZDEBUG)
 #ifdef _COMMENT
           || strcmp (name, _COMMENT) == 0
 #endif
@@ -1152,6 +1162,7 @@ styp_to_sec_flags (bfd *abfd,
   bfd_boolean is_dbg = FALSE;
 
   if (CONST_STRNEQ (name, DOT_DEBUG)
+      || CONST_STRNEQ (name, DOT_ZDEBUG)
 #ifdef COFF_LONG_SECTION_NAMES
       || CONST_STRNEQ (name, GNU_LINKONCE_WI)
       || CONST_STRNEQ (name, GNU_LINKONCE_WT)
@@ -1374,7 +1385,7 @@ Special entry points for gdb to swap in coff symbol table parts:
 .  bfd_boolean _bfd_coff_long_section_names;
 .  bfd_boolean (*_bfd_coff_set_long_section_names)
 .    (bfd *, int);
-.  
+.
 .  unsigned int _bfd_coff_default_section_alignment_power;
 .  bfd_boolean _bfd_coff_force_symnames_in_strings;
 .  unsigned int _bfd_coff_debug_string_prefix_length;
@@ -5652,6 +5663,10 @@ static bfd_coff_backend_data ticoff1_swap_table =
 #define coff_bfd_gc_sections               bfd_generic_gc_sections
 #endif
 
+#ifndef coff_bfd_lookup_section_flags
+#define coff_bfd_lookup_section_flags      bfd_generic_lookup_section_flags
+#endif
+
 #ifndef coff_bfd_merge_sections
 #define coff_bfd_merge_sections                    bfd_generic_merge_sections
 #endif
@@ -5666,7 +5681,7 @@ static bfd_coff_backend_data ticoff1_swap_table =
 
 #ifndef coff_section_already_linked
 #define coff_section_already_linked \
-  _bfd_generic_section_already_linked
+  _bfd_coff_section_already_linked
 #endif
 
 #ifndef coff_bfd_define_common_symbol