2005-09-27 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 28 Sep 2005 00:34:21 +0000 (00:34 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 28 Sep 2005 00:34:21 +0000 (00:34 +0000)
* ld.texinfo (ALIGN): Document it as forcing output section
alignment.

* ldgram.y (ALIGN): Support it for forcing output section
alignment.

ld/ChangeLog
ld/ld.texinfo
ld/ldgram.y

index 0aedf6b57564ee636f36a91bcae027d2e3ae30c6..85fc35a9006743dbe495ab1a2894f6b477f18624 100644 (file)
@@ -1,3 +1,11 @@
+2005-09-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * ld.texinfo (ALIGN): Document it as forcing output section
+       alignment.
+
+       * ldgram.y (ALIGN): Support it for forcing output section
+       alignment.
+
 2005-09-20  Alan Modra  <amodra@bigpond.net.au>
 
        * ldlang.h (lang_output_section_statement_struct): Change type of
index 2099971eb00868d476b9af03c16f6ff5de4ebffc..a95a329a1f7fc42c6aab310b76df2b323c38d0dc 100644 (file)
@@ -3065,7 +3065,7 @@ The full description of an output section looks like this:
 @smallexample
 @group
 @var{section} [@var{address}] [(@var{type})] :
-  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
+  [AT(@var{lma})] [ALIGN(@var{section_align})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -3641,7 +3641,7 @@ like this:
 @smallexample
 @group
 @var{section} [@var{address}] [(@var{type})] :
-  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
+  [AT(@var{lma})] [ALIGN(@var{section_align})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -3656,6 +3656,7 @@ remaining section attributes.
 @menu
 * Output Section Type::                Output section type
 * Output Section LMA::         Output section LMA
+* Forced Output Alignment::    Forced Output Alignment
 * Forced Input Alignment::     Forced Input Alignment
 * Output Section Region::      Output section region
 * Output Section Phdr::                Output section phdr
@@ -3769,6 +3770,15 @@ for (dst = &_bstart; dst< &_bend; dst++)
 @end group
 @end smallexample
 
+@node Forced Output Alignment
+@subsubsection Forced Output Alignment
+@kindex ALIGN(@var{section_align})
+@cindex forcing output section alignment
+@cindex output section alignment
+You can force an output section alignment by using ALIGN.  The value
+specified overrides any alignment given by input sections, whether
+larger or smaller.
+
 @node Forced Input Alignment
 @subsubsection Forced Input Alignment
 @kindex SUBALIGN(@var{subsection_align})
index c8cf6c1d262e9adc65885f09a242a73b997c277a..f6e2aa22151336763c95ddfc0dc617bad15173f6 100644 (file)
@@ -92,7 +92,7 @@ static int error_index;
 }
 
 %type <etree> exp opt_exp_with_type mustbe_exp opt_at phdr_type phdr_val
-%type <etree> opt_exp_without_type opt_subalign
+%type <etree> opt_exp_without_type opt_subalign opt_align
 %type <fill> fill_opt fill_exp
 %type <name_list> exclude_name_list
 %type <wildcard_list> file_NAME_list
@@ -889,6 +889,11 @@ opt_at:
        |       { $$ = 0; }
        ;
 
+opt_align:
+               ALIGN_K '(' exp ')' { $$ = $3; }
+       |       { $$ = 0; }
+       ;
+
 opt_subalign:
                SUBALIGN '(' exp ')' { $$ = $3; }
        |       { $$ = 0; }
@@ -904,20 +909,21 @@ sect_constraint:
 section:       NAME            { ldlex_expression(); }
                opt_exp_with_type
                opt_at
+               opt_align
                opt_subalign    { ldlex_popstate (); ldlex_script (); }
                sect_constraint
                '{'
                        {
                          lang_enter_output_section_statement($1, $3,
                                                              sectype,
-                                                             0, $5, $4, $7);
+                                                             $5, $6, $4, $8);
                        }
                statement_list_opt
                '}' { ldlex_popstate (); ldlex_expression (); }
                memspec_opt memspec_at_opt phdr_opt fill_opt
                {
                  ldlex_popstate ();
-                 lang_leave_output_section_statement ($16, $13, $15, $14);
+                 lang_leave_output_section_statement ($17, $14, $16, $15);
                }
                opt_comma
                {}