aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ld/ChangeLog11
-rw-r--r--ld/ld.texinfo18
-rw-r--r--ld/ldgram.y24
-rw-r--r--ld/ldlang.c11
-rw-r--r--ld/ldlang.h2
-rw-r--r--ld/ldlex.l1
6 files changed, 51 insertions, 16 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 243caa7..e1937bd 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -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.
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index c9691a0..aeeded0 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -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}
diff --git a/ld/ldgram.y b/ld/ldgram.y
index 22dbb24..9038ebc 100644
--- a/ld/ldgram.y
+++ b/ld/ldgram.y
@@ -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
diff --git a/ld/ldlang.c b/ld/ldlang.c
index 56d65eb..f443acd 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -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
diff --git a/ld/ldlang.h b/ld/ldlang.h
index 9fc930b..d3e87b1 100644
--- a/ld/ldlang.h
+++ b/ld/ldlang.h
@@ -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
diff --git a/ld/ldlex.l b/ld/ldlex.l
index b55ebe7..b52e1cf 100644
--- a/ld/ldlex.l
+++ b/ld/ldlex.l
@@ -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); }