bfd
[deliverable/binutils-gdb.git] / bfd / coffcode.h
index 0fbaa97d411833a587848e77e2a131cd9e4eeb57..b6deddd687a033af9c074190f68b7bfc318c0f2a 100644 (file)
@@ -581,6 +581,17 @@ sec_to_styp_flags (const char *sec_name, flagword sec_flags)
     {
       styp_flags = STYP_TYPCHK;
     }
+  else if (sec_flags & SEC_DEBUGGING)
+    {
+      int i;
+
+      for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++)
+        if (!strcmp (sec_name, xcoff_dwsect_names[i].name))
+          {
+            styp_flags = STYP_DWARF | xcoff_dwsect_names[i].flag;
+            break;
+          }
+    }
 #endif
   /* Try and figure out what it should be */
   else if (sec_flags & SEC_CODE)
@@ -658,7 +669,10 @@ 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_DEBUGGING | SEC_READONLY;
+    {
+      sec_flags &= (SEC_LINK_ONCE | SEC_LINK_DUPLICATES_DISCARD);
+      sec_flags |= SEC_DEBUGGING | SEC_READONLY;
+    }
 
   /* skip LOAD */
   /* READONLY later */
@@ -773,6 +787,10 @@ styp_to_sec_flags (bfd *abfd ATTRIBUTE_UNUSED,
     }
   else if (styp_flags & STYP_PAD)
     sec_flags = 0;
+#ifdef RS6000COFF_C
+  else if (styp_flags & STYP_DWARF)
+    sec_flags |= SEC_DEBUGGING;
+#endif
   else if (strcmp (name, _TEXT) == 0)
     {
       if (sec_flags & SEC_NEVER_LOAD)
@@ -1714,6 +1732,7 @@ coff_new_section_hook (bfd * abfd, asection * section)
 {
   combined_entry_type *native;
   bfd_size_type amt;
+  unsigned char sclass = C_STAT;
 
   section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;
 
@@ -1721,9 +1740,22 @@ coff_new_section_hook (bfd * abfd, asection * section)
   if (bfd_xcoff_text_align_power (abfd) != 0
       && strcmp (bfd_get_section_name (abfd, section), ".text") == 0)
     section->alignment_power = bfd_xcoff_text_align_power (abfd);
-  if (bfd_xcoff_data_align_power (abfd) != 0
+  else if (bfd_xcoff_data_align_power (abfd) != 0
       && strcmp (bfd_get_section_name (abfd, section), ".data") == 0)
     section->alignment_power = bfd_xcoff_data_align_power (abfd);
+  else
+    {
+      int i;
+
+      for (i = 0; i < XCOFF_DWSECT_NBR_NAMES; i++)
+        if (strcmp (bfd_get_section_name (abfd, section),
+                    xcoff_dwsect_names[i].name) == 0)
+          {
+            section->alignment_power = 0;
+            sclass = C_DWARF;
+            break;
+          }
+    }
 #endif
 
   /* Set up the section symbol.  */
@@ -1747,7 +1779,7 @@ coff_new_section_hook (bfd * abfd, asection * section)
      for n_numaux is already correct.  */
 
   native->u.syment.n_type = T_NULL;
-  native->u.syment.n_sclass = C_STAT;
+  native->u.syment.n_sclass = sclass;
 
   coffsymbol (section->symbol)->native = native;
 
@@ -3297,6 +3329,8 @@ coff_compute_section_file_positions (bfd * abfd)
       if (!(current->flags & SEC_HAS_CONTENTS))
        continue;
 
+      current->rawsize = current->size;
+
 #ifdef COFF_IMAGE_WITH_PE
       /* Make sure we skip empty sections in a PE image.  */
       if (current->size == 0)
@@ -3363,7 +3397,7 @@ coff_compute_section_file_positions (bfd * abfd)
 
 #ifdef COFF_IMAGE_WITH_PE
       /* Set the padded size.  */
-      current->size = (current->size + page_size -1) & -page_size;
+      current->size = (current->size + page_size - 1) & -page_size;
 #endif
 
       sofar += current->size;
@@ -4749,6 +4783,10 @@ coff_slurp_symbol_table (bfd * abfd)
            case C_THUMBSTAT:    /* Thumb static.  */
            case C_THUMBLABEL:   /* Thumb label.  */
            case C_THUMBSTATFUNC:/* Thumb static function.  */
+#endif
+#ifdef RS6000COFF_C
+            case C_DWARF:       /* A label in a dwarf section.  */
+            case C_INFO:        /* A label in a comment section.  */
 #endif
            case C_LABEL:        /* Label.  */
              if (src->u.syment.n_scnum == N_DEBUG)
@@ -4896,6 +4934,11 @@ coff_slurp_symbol_table (bfd * abfd)
                  && src->u.syment.n_value == 0
                  && src->u.syment.n_scnum == 0)
                break;
+#ifdef RS6000COFF_C
+              /* XCOFF specific: deleted entry.  */
+              if (src->u.syment.n_value == C_NULL_VALUE)
+                break;
+#endif
              /* Fall through.  */
            case C_EXTDEF:      /* External definition.  */
            case C_ULABEL:      /* Undefined label.  */
This page took 0.028775 seconds and 4 git commands to generate.