OSDN Git Service

* config/tc-ppc.c (ppc_csect): Pass alignment to ppc_change_csect.
authorAlan Modra <amodra@bigpond.net.au>
Wed, 18 Jun 2003 23:05:44 +0000 (23:05 +0000)
committerAlan Modra <amodra@bigpond.net.au>
Wed, 18 Jun 2003 23:05:44 +0000 (23:05 +0000)
(ppc_change_csect): Add align param.  Align frag at start of csect.
(ppc_section, ppc_named_section): Adjust ppc_change_csect calls.
(ppc_frob_section): Align vma.

gas/ChangeLog
gas/config/tc-ppc.c

index cd2c1d6..2974178 100644 (file)
@@ -1,3 +1,10 @@
+2003-06-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * config/tc-ppc.c (ppc_csect): Pass alignment to ppc_change_csect.
+       (ppc_change_csect): Add align param.  Align frag at start of csect.
+       (ppc_section, ppc_named_section): Adjust ppc_change_csect calls.
+       (ppc_frob_section): Align vma.
+
 2003-06-18  Jakub Jelinek  <jakub@redhat.com>
 
        * dw2gencfi.c (EH_FRAME_ALIGNMENT): Define if not defined.
        (s_d30v_align <ignore>): Likewise.
        (build_insn): Correct format string.
        (md_apply_fix3): Likewise.
-       * config/tc-fr30.c (md_parse_option <c,arg>):  Add ATTRIBUTE_UNUSED.
+       * config/tc-fr30.c (md_parse_option <c,arg>): Add ATTRIBUTE_UNUSED.
        (md_undefined_symbol <name>): Likewise.
        (md_convert_frag <all args>): Likewise.
        (md_cgen_lookup_reloc <insn>): Likewise.
 
 2002-11-21  Randolph Chung  <randolph@tausq.org>
 
-       * config/tc-hppa.h (tc_frob_symbol):  Frob undefined unused symbols
+       * config/tc-hppa.h (tc_frob_symbol): Frob undefined unused symbols
        only if they have default visibility.
 
 2002-11-21  Richard Henderson  <rth@redhat.com>
@@ -3073,14 +3080,14 @@ Thu Oct 10 14:31:30 2002  J"orn Rennecke <joern.rennecke@superh.com>
        * tc-v850.c (v850_relax): Declare.
        (v850_longcode): New routine.
        (v850_handle_align): New routine.
-       (md_pseudo_table):  Add longcall and longjump.
+       (md_pseudo_table): Add longcall and longjump.
        (md_parse_option): Check for relax option.
-       (tc_gen_reloc):  Handle BFD_RELOC_V850_LONGCALL,
+       (tc_gen_reloc): Handle BFD_RELOC_V850_LONGCALL,
        BFD_RELOC_V850_LONGJUMP, and BFD_RELOC_V850_ALIGN.
        (md_apply_fix3): Likewise.
        (v850_force_relocation): Likewise.
        (v850_comm): Change the current section.
-       (md_assemble):  Ensure that the correct value is put in the
+       (md_assemble): Ensure that the correct value is put in the
        fixup.
        (v850_sdata, v850_tdata, v850_zdata, v850_sbss, v850_tbss,
        v850_zbss, v850_rosdata, v850_rozdata): Fix section book keeping.
index caf6b7f..80146b7 100644 (file)
@@ -111,7 +111,7 @@ static void ppc_ec PARAMS ((int));
 static void ppc_ef PARAMS ((int));
 static void ppc_es PARAMS ((int));
 static void ppc_csect PARAMS ((int));
-static void ppc_change_csect PARAMS ((symbolS *));
+static void ppc_change_csect PARAMS ((symbolS *, offsetT));
 static void ppc_function PARAMS ((int));
 static void ppc_extern PARAMS ((int));
 static void ppc_lglobl PARAMS ((int));
@@ -3006,6 +3006,7 @@ ppc_csect (ignore)
   char *name;
   char endc;
   symbolS *sym;
+  offsetT align;
 
   name = input_line_pointer;
   endc = get_symbol_end ();
@@ -3020,22 +3021,24 @@ ppc_csect (ignore)
       symbol_get_tc (sym)->class = XMC_PR;
     }
 
-  ppc_change_csect (sym);
-
+  align = 2;
   if (*input_line_pointer == ',')
     {
       ++input_line_pointer;
-      symbol_get_tc (sym)->align = get_absolute_expression ();
+      align = get_absolute_expression ();
     }
 
+  ppc_change_csect (sym, align);
+
   demand_empty_rest_of_line ();
 }
 
 /* Change to a different csect.  */
 
 static void
-ppc_change_csect (sym)
+ppc_change_csect (sym, align)
      symbolS *sym;
+     offsetT align;
 {
   if (S_IS_DEFINED (sym))
     subseg_set (S_GET_SEGMENT (sym), symbol_get_tc (sym)->subseg);
@@ -3045,11 +3048,14 @@ ppc_change_csect (sym)
       int after_toc;
       int hold_chunksize;
       symbolS *list;
+      int is_code;
+      segT sec;
 
       /* This is a new csect.  We need to look at the symbol class to
         figure out whether it should go in the text section or the
         data section.  */
       after_toc = 0;
+      is_code = 0;
       switch (symbol_get_tc (sym)->class)
        {
        case XMC_PR:
@@ -3064,6 +3070,7 @@ ppc_change_csect (sym)
          symbol_get_tc (sym)->subseg = ppc_text_subsegment;
          ++ppc_text_subsegment;
          list_ptr = &ppc_text_csects;
+         is_code = 1;
          break;
        case XMC_RW:
        case XMC_TC0:
@@ -3091,18 +3098,24 @@ ppc_change_csect (sym)
       hold_chunksize = chunksize;
       chunksize = 64;
 
-      subseg_new (segment_name (S_GET_SEGMENT (sym)),
-                 symbol_get_tc (sym)->subseg);
+      sec = subseg_new (segment_name (S_GET_SEGMENT (sym)),
+                       symbol_get_tc (sym)->subseg);
 
       chunksize = hold_chunksize;
 
       if (after_toc)
        ppc_after_toc_frag = frag_now;
 
+      record_alignment (sec, align);
+      if (is_code)
+       frag_align_code (align, 0);
+      else
+       frag_align (align, 0, 0);
+
       symbol_set_frag (sym, frag_now);
       S_SET_VALUE (sym, (valueT) frag_now_fix ());
 
-      symbol_get_tc (sym)->align = 2;
+      symbol_get_tc (sym)->align = align;
       symbol_get_tc (sym)->output = 1;
       symbol_get_tc (sym)->within = sym;
 
@@ -3140,7 +3153,7 @@ ppc_section (type)
 
   sym = symbol_find_or_make (name);
 
-  ppc_change_csect (sym);
+  ppc_change_csect (sym, 2);
 
   demand_empty_rest_of_line ();
 }
@@ -3177,7 +3190,7 @@ ppc_named_section (ignore)
 
   sym = symbol_find_or_make (real_name);
 
-  ppc_change_csect (sym);
+  ppc_change_csect (sym, 2);
 
   demand_empty_rest_of_line ();
 }
@@ -5047,8 +5060,9 @@ void
 ppc_frob_section (sec)
      asection *sec;
 {
-  static bfd_size_type vma = 0;
+  static bfd_vma vma = 0;
 
+  vma = md_section_align (sec, vma);
   bfd_set_section_vma (stdoutput, sec, vma);
   vma += bfd_section_size (stdoutput, sec);
 }