* 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.
This commit is contained in:
Alan Modra
2003-07-27 11:58:28 +00:00
parent 5d35169e36
commit 7e7d57681b
6 changed files with 51 additions and 16 deletions

View 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> 2003-07-24 Nick Clifton <nickc@redhat.com>
* po/fr.po: Updated French translation. * po/fr.po: Updated French translation.

View File

@ -1217,7 +1217,7 @@ this option overrides it. @xref{BFD}.
Create a position independent executable. This is currently only supported on Create a position independent executable. This is currently only supported on
ELF platforms. Position independent executables are similar to shared ELF platforms. Position independent executables are similar to shared
libraries in that they are relocated by the dynamic linker to the virtual 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 normal dynamically linked executables they can be executed and symbols
defined in the executable cannot be overridden by shared libraries. 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: The full description of an output section looks like this:
@smallexample @smallexample
@group @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}
@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: like this:
@smallexample @smallexample
@group @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}
@var{output-section-command} @var{output-section-command}
@ -3222,6 +3224,7 @@ remaining section attributes.
@menu @menu
* Output Section Type:: Output section type * Output Section Type:: Output section type
* Output Section LMA:: Output section LMA * Output Section LMA:: Output section LMA
* Forced Input Alignment:: Forced Input Alignment
* Output Section Region:: Output section region * Output Section Region:: Output section region
* Output Section Phdr:: Output section phdr * Output Section Phdr:: Output section phdr
* Output Section Fill:: Output section fill * Output Section Fill:: Output section fill
@ -3329,6 +3332,15 @@ for (dst = &_bstart; dst< &_bend; dst++)
@end group @end group
@end smallexample @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 @node Output Section Region
@subsubsection Output Section Region @subsubsection Output Section Region
@kindex >@var{region} @kindex >@var{region}

View File

@ -1,6 +1,6 @@
/* A YACC grammar to parse a superset of the AT&T linker scripting language. /* 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, 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). Written by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
This file is part of GNU ld. 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> 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 <fill> fill_opt fill_exp
%type <name_list> exclude_name_list %type <name_list> exclude_name_list
%type <wildcard_list> file_NAME_list %type <wildcard_list> file_NAME_list
@ -142,7 +142,7 @@ static int error_index;
%token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS %token STARTUP HLL SYSLIB FLOAT NOFLOAT NOCROSSREFS
%token ORIGIN FILL %token ORIGIN FILL
%token LENGTH CREATE_OBJECT_SYMBOLS INPUT GROUP OUTPUT CONSTRUCTORS %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 <token> assign_op atype attributes_opt
%type <name> filename %type <name> filename
%token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K %token CHIP LIST SECT ABSOLUTE LOAD NEWLINE ENDWORD ORDER NAMEWORD ASSERT_K
@ -828,31 +828,37 @@ opt_at:
| { $$ = 0; } | { $$ = 0; }
; ;
opt_subalign:
SUBALIGN '(' exp ')' { $$ = $3; }
| { $$ = 0; }
;
section: NAME { ldlex_expression(); } section: NAME { ldlex_expression(); }
opt_exp_with_type 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, lang_enter_output_section_statement($1, $3,
sectype, sectype,
0, 0, 0, $4); 0, 0, $5, $4);
} }
statement_list_opt statement_list_opt
'}' { ldlex_popstate (); ldlex_expression (); } '}' { ldlex_popstate (); ldlex_expression (); }
memspec_opt memspec_at_opt phdr_opt fill_opt memspec_opt memspec_at_opt phdr_opt fill_opt
{ {
ldlex_popstate (); ldlex_popstate ();
lang_leave_output_section_statement ($14, $11, $13, $12); lang_leave_output_section_statement ($15, $12, $14, $13);
} }
opt_comma opt_comma
{} {}
| OVERLAY | OVERLAY
{ ldlex_expression (); } { ldlex_expression (); }
opt_exp_without_type opt_nocrossrefs opt_at opt_exp_without_type opt_nocrossrefs opt_at opt_subalign
{ ldlex_popstate (); ldlex_script (); } { ldlex_popstate (); ldlex_script (); }
'{' '{'
{ {
lang_enter_overlay ($3); lang_enter_overlay ($3, $6);
} }
overlay_section overlay_section
'}' '}'
@ -861,7 +867,7 @@ section: NAME { ldlex_expression(); }
{ {
ldlex_popstate (); ldlex_popstate ();
lang_leave_overlay ($5, (int) $4, lang_leave_overlay ($5, (int) $4,
$15, $12, $14, $13); $16, $13, $15, $14);
} }
opt_comma opt_comma
| /* The GROUP case is just enough to support the gcc | /* The GROUP case is just enough to support the gcc

View File

@ -4649,6 +4649,8 @@ lang_add_nocrossref (struct lang_nocrossref *l)
/* The overlay virtual address. */ /* The overlay virtual address. */
static etree_type *overlay_vma; static etree_type *overlay_vma;
/* And subsection alignment. */
static etree_type *overlay_subalign;
/* An expression for the maximum section size seen so far. */ /* An expression for the maximum section size seen so far. */
static etree_type *overlay_max; static etree_type *overlay_max;
@ -4665,12 +4667,15 @@ static struct overlay_list *overlay_list;
/* Start handling an overlay. */ /* Start handling an overlay. */
void 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. */ /* 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_vma = vma_expr;
overlay_subalign = subalign;
} }
/* Start a section in an overlay. We handle this by calling /* 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; etree_type *size;
lang_enter_output_section_statement (name, overlay_vma, normal_section, 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 /* If this is the first section, then base the VMA of future
sections on this one. This will work correctly even if `.' is sections on this one. This will work correctly even if `.' is

View File

@ -492,7 +492,7 @@ extern void lang_new_phdr
extern void lang_add_nocrossref extern void lang_add_nocrossref
(struct lang_nocrossref *); (struct lang_nocrossref *);
extern void lang_enter_overlay extern void lang_enter_overlay
(etree_type *); (etree_type *, etree_type *);
extern void lang_enter_overlay_section extern void lang_enter_overlay_section
(const char *); (const char *);
extern void lang_leave_overlay_section extern void lang_leave_overlay_section

View File

@ -306,6 +306,7 @@ V_IDENTIFIER [*?.$_a-zA-Z\[\]\-\!\^]([*?.$_a-zA-Z0-9\[\]\-\!\^]|::)*
<BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);} <BOTH,SCRIPT>"INCLUDE" { RTOKEN(INCLUDE);}
<BOTH,SCRIPT>"PHDRS" { RTOKEN (PHDRS); } <BOTH,SCRIPT>"PHDRS" { RTOKEN (PHDRS); }
<EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);} <EXPRESSION,BOTH,SCRIPT>"AT" { RTOKEN(AT);}
<EXPRESSION,BOTH,SCRIPT>"SUBALIGN" { RTOKEN(SUBALIGN);}
<EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); } <EXPRESSION,BOTH,SCRIPT>"PROVIDE" { RTOKEN(PROVIDE); }
<EXPRESSION,BOTH,SCRIPT>"KEEP" { RTOKEN(KEEP); } <EXPRESSION,BOTH,SCRIPT>"KEEP" { RTOKEN(KEEP); }
<EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); } <EXPRESSION,BOTH,SCRIPT>"EXCLUDE_FILE" { RTOKEN(EXCLUDE_FILE); }