* 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-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.
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.
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}
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}
@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
@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}
/* 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.
}
%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
%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
| { $$ = 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
'}'
{
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
/* 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;
/* 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
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
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
<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); }