gas/
[deliverable/binutils-gdb.git] / gas / config / obj-ieee.c
index 35b49da2bd7d04a2d29570dcf4dcf4422b4776ed..bac46757c1314f697553e6d22b81c0818b134364 100644 (file)
@@ -1,5 +1,5 @@
 /* obj-format for ieee-695 records.
 /* obj-format for ieee-695 records.
-   Copyright (C) 1991, 92, 93, 94, 95, 97, 98, 2000
+   Copyright 1991, 1992, 1993, 1994, 1997, 2000, 2001, 2002, 2003, 2005
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
    Free Software Foundation, Inc.
 
    This file is part of GAS, the GNU Assembler.
@@ -16,8 +16,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 /* Created by Steve Chamberlain <steve@cygnus.com>.  */
 
 
 /* Created by Steve Chamberlain <steve@cygnus.com>.  */
 
@@ -209,12 +209,6 @@ do_relocs_for (idx)
          reloc_ptr_vector[i] = to;
          to->howto = (reloc_howto_type *) (from->fx_r_type);
 
          reloc_ptr_vector[i] = to;
          to->howto = (reloc_howto_type *) (from->fx_r_type);
 
-#if 0
-         /* We can't represent complicated things in a reloc yet.  */
-         if (from->fx_addsy == 0 || from->fx_subsy != 0)
-           abort ();
-#endif
-
          s = &(from->fx_addsy->sy_symbol.sy);
          to->address = ((char *) (from->fx_frag->fr_address +
                                   from->fx_where))
          s = &(from->fx_addsy->sy_symbol.sy);
          to->address = ((char *) (from->fx_frag->fr_address +
                                   from->fx_where))
@@ -264,7 +258,7 @@ do_relocs_for (idx)
          from = from->fx_next;
        }
 
          from = from->fx_next;
        }
 
-      /* Attatch to the section.  */
+      /* Attach to the section.  */
       section->orelocation = reloc_ptr_vector;
       section->reloc_count = nrelocs;
       section->flags |= SEC_LOAD;
       section->orelocation = reloc_ptr_vector;
       section->reloc_count = nrelocs;
       section->flags |= SEC_LOAD;
@@ -292,7 +286,7 @@ do_symbols (abfd)
        {
          ptr->sy_symbol.sy.section =
            (asection *) (segment_info[ptr->sy_symbol.seg].user_stuff);
        {
          ptr->sy_symbol.sy.section =
            (asection *) (segment_info[ptr->sy_symbol.seg].user_stuff);
-         S_SET_VALUE (ptr, S_GET_VALUE (ptr) + ptr->sy_frag->fr_address);
+         S_SET_VALUE (ptr, S_GET_VALUE (ptr));
          if (ptr->sy_symbol.sy.flags == 0)
            ptr->sy_symbol.sy.flags = BSF_LOCAL;
        }
          if (ptr->sy_symbol.sy.flags == 0)
            ptr->sy_symbol.sy.flags = BSF_LOCAL;
        }
@@ -467,10 +461,6 @@ ok:
   input_line_pointer = p;
 }
 
   input_line_pointer = p;
 }
 
-void cons ();
-void s_ignore ();
-
-void s_globl ();
 const pseudo_typeS obj_pseudo_table[] =
 {
   {"section", obj_ieee_section, 0},
 const pseudo_typeS obj_pseudo_table[] =
 {
   {"section", obj_ieee_section, 0},
@@ -493,6 +483,20 @@ obj_symbol_new_hook (symbolP)
 }
 
 #if 1
 }
 
 #if 1
+
+#ifndef SUB_SEGMENT_ALIGN
+#ifdef HANDLE_ALIGN
+/* The last subsegment gets an alignment corresponding to the alignment
+   of the section.  This allows proper nop-filling at the end of
+   code-bearing sections.  */
+#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN)                                        \
+  (!(FRCHAIN)->frch_next || (FRCHAIN)->frch_next->frch_seg != (SEG)    \
+   ? get_recorded_alignment (SEG) : 0)
+#else
+#define SUB_SEGMENT_ALIGN(SEG, FRCHAIN) 2
+#endif
+#endif
+
 extern void
 write_object_file ()
 {
 extern void
 write_object_file ()
 {
@@ -512,20 +516,33 @@ write_object_file ()
   subseg_set (1, 0);
   subseg_set (2, 0);
   subseg_set (3, 0);
   subseg_set (1, 0);
   subseg_set (2, 0);
   subseg_set (3, 0);
+
+  /* Run through all the sub-segments and align them up.  Also
+     close any open frags.  We tack a .fill onto the end of the
+     frag chain so that any .align's size can be worked by looking
+     at the next frag.  */
   for (frchain_ptr = frchain_root;
        frchain_ptr != (struct frchain *) NULL;
        frchain_ptr = frchain_ptr->frch_next)
     {
   for (frchain_ptr = frchain_root;
        frchain_ptr != (struct frchain *) NULL;
        frchain_ptr = frchain_ptr->frch_next)
     {
-      /* Run through all the sub-segments and align them up.  Also
-        close any open frags.  We tack a .fill onto the end of the
-        frag chain so that any .align's size can be worked by looking
-        at the next frag.  */
+      int alignment;
 
       subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
 
       subseg_set (frchain_ptr->frch_seg, frchain_ptr->frch_subseg);
-#ifndef SUB_SEGMENT_ALIGN
-#define SUB_SEGMENT_ALIGN(SEG) 2
+
+      alignment = SUB_SEGMENT_ALIGN (now_seg, frchain_ptr)
+
+#ifdef md_do_align
+      md_do_align (alignment, (char *) NULL, 0, 0, alignment_done);
+#endif
+      if (subseg_text_p (now_seg))
+       frag_align_code (alignment, 0);
+      else
+       frag_align (alignment, 0, 0);
+
+#ifdef md_do_align
+    alignment_done:
 #endif
 #endif
-      frag_align (SUB_SEGMENT_ALIGN (now_seg), 0, 0);
+
       frag_wane (frag_now);
       frag_now->fr_fix = 0;
       know (frag_now->fr_next == NULL);
       frag_wane (frag_now);
       frag_now->fr_fix = 0;
       know (frag_now->fr_next == NULL);
@@ -538,26 +555,15 @@ write_object_file ()
       fragS **prev_frag_ptr_ptr;
       struct frchain *next_frchain_ptr;
 
       fragS **prev_frag_ptr_ptr;
       struct frchain *next_frchain_ptr;
 
-#if 0
-      struct frag **head_ptr = segment_info[i].frag_root;
-#endif
-
       segment_info[i].frag_root = segment_info[i].frchainP->frch_root;
       segment_info[i].frag_root = segment_info[i].frchainP->frch_root;
-#if 0
-      /* I'm not sure what this is for.  */
-      for (frchain_ptr = segment_info[i].frchainP->frch_root;
-          frchain_ptr != (struct frchain *) NULL;
-          frchain_ptr = frchain_ptr->frch_next)
-       {
-         *head_ptr = frchain_ptr;
-         head_ptr = &frchain_ptr->next;
-       }
-#endif
     }
 
   for (i = SEG_E0; i < SEG_UNKNOWN; i++)
     relax_segment (segment_info[i].frag_root, i);
 
     }
 
   for (i = SEG_E0; i < SEG_UNKNOWN; i++)
     relax_segment (segment_info[i].frag_root, i);
 
+  /* Relaxation has completed.  Freeze all syms.  */
+  finalize_syms = 1;
+
   /* Now the addresses of the frags are correct within the segment.  */
 
   bfd_as_write_hook ();
   /* Now the addresses of the frags are correct within the segment.  */
 
   bfd_as_write_hook ();
This page took 0.024885 seconds and 4 git commands to generate.