]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* ld.texinfo: Typo fixes. Document SUBALIGN.
authorAlan Modra <amodra@gmail.com>
Sun, 27 Jul 2003 11:58:28 +0000 (11:58 +0000)
committerAlan Modra <amodra@gmail.com>
Sun, 27 Jul 2003 11:58:28 +0000 (11:58 +0000)
* ldgram.y (opt_subalign): Add.
* ldlex.l (SUBALIGN): Recognize.
* ldlang.c (overlay_subalign): New var.
(lang_enter_overlay): Add subalign param.
(lang_enter_overlay_section): Pass overlay_subalign to
lang_enter_output_section_statement.
* ldlang.h (lang_enter_overlay): Update.

ld/ChangeLog
ld/ld.texinfo
ld/ldgram.y
ld/ldlang.c
ld/ldlang.h
ld/ldlex.l

index 243caa7494955ef4d93a6db76ef935427b12d52b..e1937bd7bb703676394e3e9dcd0b41c61b4f9022 100644 (file)
@@ -1,3 +1,14 @@
+2003-07-27  Alan Modra  <amodra@bigpond.net.au>
+
+       * ld.texinfo: Typo fixes.  Document SUBALIGN.
+       * ldgram.y (opt_subalign): Add.
+       * ldlex.l (SUBALIGN): Recognize.
+       * ldlang.c (overlay_subalign): New var.
+       (lang_enter_overlay): Add subalign param.
+       (lang_enter_overlay_section): Pass overlay_subalign to
+       lang_enter_output_section_statement.
+       * ldlang.h (lang_enter_overlay): Update.
+
 2003-07-24  Nick Clifton  <nickc@redhat.com>
 
        * po/fr.po: Updated French translation.
index c9691a0a01e283a8706348a5611123bbe6d871cc..aeeded036571da24c5456e677b7eadb2289330fa 100644 (file)
@@ -1217,7 +1217,7 @@ this option overrides it.  @xref{BFD}.
 Create a position independent executable.  This is currently only supported on
 ELF platforms.  Position independent executables are similar to shared
 libraries in that they are relocated by the dynamic linker to the virtual
-address OS chooses for them (which can varry between invocations), like
+address the OS chooses for them (which can vary between invocations).  Like
 normal dynamically linked executables they can be executed and symbols
 defined in the executable cannot be overridden by shared libraries.
 
@@ -2686,7 +2686,8 @@ in the first input file.  The first section will be at address zero.
 The full description of an output section looks like this:
 @smallexample
 @group
-@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
+@var{section} [@var{address}] [(@var{type})] :
+  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -3207,7 +3208,8 @@ We showed above that the full description of an output section looked
 like this:
 @smallexample
 @group
-@var{section} [@var{address}] [(@var{type})] : [AT(@var{lma})]
+@var{section} [@var{address}] [(@var{type})] :
+  [AT(@var{lma})] [SUBALIGN(@var{subsection_align})]
   @{
     @var{output-section-command}
     @var{output-section-command}
@@ -3222,6 +3224,7 @@ remaining section attributes.
 @menu
 * Output Section Type::                Output section type
 * Output Section LMA::         Output section LMA
+* Forced Input Alignment::     Forced Input Alignment
 * Output Section Region::      Output section region
 * Output Section Phdr::                Output section phdr
 * Output Section Fill::                Output section fill
@@ -3329,6 +3332,15 @@ for (dst = &_bstart; dst< &_bend; dst++)
 @end group
 @end smallexample
 
+@node Forced Input Alignment
+@subsubsection Forced Input Alignment
+@kindex SUBALIGN(@var{subsection_align})
+@cindex forcing input section alignment
+@cindex input section alignment
+You can force input section alignment within an output section by using
+SUBALIGN.  The value specified overrides any alignment given by input
+sections, whether larger or smaller.
+
 @node Output Section Region
 @subsubsection Output Section Region
 @kindex >@var{region}
index 22dbb248ce4441326fd14f053ce11c1f456c722f..9038ebc1ae404679096b3110c3b015c1c3f9c0a7 100644 (file)
@@ -1,6 +1,6 @@
 /* A YACC grammar to parse a superset of the AT&T linker scripting language.
    Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2003 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
 
 This file is part of GNU ld.
@@ -94,7 +94,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
+%type <etree> opt_exp_without_type opt_subalign
 %type <fill> fill_opt fill_exp
 %type <name_list> exclude_name_list
 %type <wildcard_list> file_NAME_list
@@ -142,7 +142,7 @@ static int error_index;
 %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
 %token ORIGIN FILL
 %token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS
-%token ALIGNMOD AT PROVIDE
+%token ALIGNMOD AT SUBALIGN PROVIDE
 %type <token> assign_op atype attributes_opt
 %type <name>  filename
 %token CHIP LIST SECT ABSOLUTE  LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
@@ -828,31 +828,37 @@ opt_at:
        |       { $$ = 0; }
        ;
 
+opt_subalign:
+               SUBALIGN '(' exp ')' { $$ = $3; }
+       |       { $$ = 0; }
+       ;
+
 section:       NAME            { ldlex_expression(); }
                opt_exp_with_type
-               opt_at          { ldlex_popstate (); ldlex_script (); }
+               opt_at
+               opt_subalign    { ldlex_popstate (); ldlex_script (); }
                '{'
                        {
                          lang_enter_output_section_statement($1, $3,
                                                              sectype,
-                                                             0, 0, 0, $4);
+                                                             0, 0, $5, $4);
                        }
                statement_list_opt
                '}' { ldlex_popstate (); ldlex_expression (); }
                memspec_opt memspec_at_opt phdr_opt fill_opt
                {
                  ldlex_popstate ();
-                 lang_leave_output_section_statement ($14, $11, $13, $12);
+                 lang_leave_output_section_statement ($15, $12, $14, $13);
                }
                opt_comma
                {}
        |       OVERLAY
                        { ldlex_expression (); }
-               opt_exp_without_type opt_nocrossrefs opt_at
+               opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
                        { ldlex_popstate (); ldlex_script (); }
                '{'
                        {
-                         lang_enter_overlay ($3);
+                         lang_enter_overlay ($3, $6);
                        }
                overlay_section
                '}'
@@ -861,7 +867,7 @@ section:    NAME            { ldlex_expression(); }
                        {
                          ldlex_popstate ();
                          lang_leave_overlay ($5, (int) $4,
-                                             $15, $12, $14, $13);
+                                             $16, $13, $15, $14);
                        }
                opt_comma
        |       /* The GROUP case is just enough to support the gcc
index 56d65eb40ab17e4976c1f98400e445b6f53bba34..f443acd058b0dfa1c35193218a19e184f5660a7c 100644 (file)
@@ -4649,6 +4649,8 @@ lang_add_nocrossref (struct lang_nocrossref *l)
 
 /* The overlay virtual address.  */
 static etree_type *overlay_vma;
+/* And subsection alignment.  */
+static etree_type *overlay_subalign;
 
 /* An expression for the maximum section size seen so far.  */
 static etree_type *overlay_max;
@@ -4665,12 +4667,15 @@ static struct overlay_list *overlay_list;
 /* Start handling an overlay.  */
 
 void
-lang_enter_overlay (etree_type *vma_expr)
+lang_enter_overlay (etree_type *vma_expr, etree_type *subalign)
 {
   /* The grammar should prevent nested overlays from occurring.  */
-  ASSERT (overlay_vma == NULL && overlay_max == NULL);
+  ASSERT (overlay_vma == NULL
+         && overlay_subalign == NULL
+         && overlay_max == NULL);
 
   overlay_vma = vma_expr;
+  overlay_subalign = subalign;
 }
 
 /* Start a section in an overlay.  We handle this by calling
@@ -4684,7 +4689,7 @@ lang_enter_overlay_section (const char *name)
   etree_type *size;
 
   lang_enter_output_section_statement (name, overlay_vma, normal_section,
-                                      0, 0, 0, 0);
+                                      0, 0, overlay_subalign, 0);
 
   /* If this is the first section, then base the VMA of future
      sections on this one.  This will work correctly even if `.' is
index 9fc930b03af0b89d54784fa8ff5e3b225e50a675..d3e87b128b7372c7563a93e6d3252e1484ecd244 100644 (file)
@@ -492,7 +492,7 @@ extern void lang_new_phdr
 extern void lang_add_nocrossref
   (struct lang_nocrossref *);
 extern void lang_enter_overlay
-  (etree_type *);
+  (etree_type *, etree_type *);
 extern void lang_enter_overlay_section
   (const char *);
 extern void lang_leave_overlay_section
index b55ebe77ddac2affe53136889f749026d72b511b..b52e1cfd7be9ad25eb1007a62f86d55b8cfb86bb 100644 (file)
@@ -306,6 +306,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
 <BOTH,SCRIPT>"INCLUDE"                 { RTOKEN(INCLUDE);}
 <BOTH,SCRIPT>"PHDRS"                   { RTOKEN (PHDRS); }
 <EXPRESSION,BOTH,SCRIPT>"AT"                   { RTOKEN(AT);}
+<EXPRESSION,BOTH,SCRIPT>"SUBALIGN"             { RTOKEN(SUBALIGN);}
 <EXPRESSION,BOTH,SCRIPT>"PROVIDE"              { RTOKEN(PROVIDE); }
 <EXPRESSION,BOTH,SCRIPT>"KEEP"         { RTOKEN(KEEP); }
 <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE"        { RTOKEN(EXCLUDE_FILE); }