diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2004-02-20 15:32:13 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2004-02-20 15:32:13 +0000 |
commit | aa59a2adb9d7b0f3b63398d5572f1c50faeaf4a6 (patch) | |
tree | d921f2ccbc713337fb8ded95fbaa23a51c08bed6 | |
parent | a3f5c37a31f87650010fa15f1519924ca18f4335 (diff) | |
download | gdb-aa59a2adb9d7b0f3b63398d5572f1c50faeaf4a6.zip gdb-aa59a2adb9d7b0f3b63398d5572f1c50faeaf4a6.tar.gz gdb-aa59a2adb9d7b0f3b63398d5572f1c50faeaf4a6.tar.bz2 |
* ldgram.y (exp): Add two operand ALIGN.
* ldexp.c (fold_binary): Add ALIGN_K case.
* ld.texinfo (ALIGN): Document two operand version.
* ld-scripts/align.{s,t,exp}: New.
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/ld.texinfo | 26 | ||||
-rw-r--r-- | ld/ldexp.c | 4 | ||||
-rw-r--r-- | ld/ldgram.y | 2 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 4 |
5 files changed, 33 insertions, 9 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog index 3b3516e..12716fb 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2004-02-20 Nathan Sidwell <nathan@codesourcery.com> + + * ldgram.y (exp): Add two operand ALIGN. + * ldexp.c (fold_binary): Add ALIGN_K case. + * ld.texinfo (ALIGN): Document two operand version. + 2004-02-19 Nathan Sidwell <nathan@codesourcery.com> * ldlang.c (map_input_to_output_sections): Initialize sections diff --git a/ld/ld.texinfo b/ld/ld.texinfo index ed7b3d1..55f861e 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -4383,17 +4383,25 @@ SECTIONS @{ @dots{} @end group @end smallexample -@item ALIGN(@var{exp}) -@kindex ALIGN(@var{exp}) +@item ALIGN(@var{align}) +@itemx ALIGN(@var{exp},@var{align}) +@kindex ALIGN(@var{align}) +@kindex ALIGN(@var{exp},@var{align}) @cindex round up location counter @cindex align location counter -Return the location counter (@code{.}) aligned to the next @var{exp} -boundary. -@code{ALIGN} doesn't change the value of the location counter---it just -does arithmetic on it. Here is an example which aligns the output -@code{.data} section to the next @code{0x2000} byte boundary after the -preceding section and sets a variable within the section to the next -@code{0x8000} boundary after the input sections: +@cindex round up expression +@cindex align expression +Return the location counter (@code{.}) or arbitrary expression aligned +to the next @var{align} boundary. The single operand @code{ALIGN} +doesn't change the value of the location counter---it just does +arithmetic on it. The two operand @code{ALIGN} allows an arbitrary +expression to be aligned upwards (@code{ALIGN(@var{align})} is +equivalent to @code{ALIGN(., @var{align})}). + +Here is an example which aligns the output @code{.data} section to the +next @code{0x2000} byte boundary after the preceding section and sets a +variable within the section to the next @code{0x8000} boundary after the +input sections: @smallexample @group SECTIONS @{ @dots{} @@ -394,6 +394,10 @@ fold_binary (etree_type *tree, result = other; break; + case ALIGN_K: + result.value = align_n (result.value, other.value); + break; + case DATA_SEGMENT_ALIGN: if (allocation_done != lang_first_phase_enum && current_section == abs_output_section diff --git a/ld/ldgram.y b/ld/ldgram.y index e885f7d..6c46c85 100644 --- a/ld/ldgram.y +++ b/ld/ldgram.y @@ -804,6 +804,8 @@ exp : { $$ = exp_unop(ABSOLUTE, $3); } | ALIGN_K '(' exp ')' { $$ = exp_unop(ALIGN_K,$3); } + | ALIGN_K '(' exp ',' exp ')' + { $$ = exp_binop(ALIGN_K,$3,$5); } | DATA_SEGMENT_ALIGN '(' exp ',' exp ')' { $$ = exp_binop (DATA_SEGMENT_ALIGN, $3, $5); } | DATA_SEGMENT_END '(' exp ')' diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 23e41a9..b103d5b 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-02-20 Nathan Sidwell <nathan@codesourcery.com> + + * ld-scripts/align.{s,t,exp}: New. + 2004-02-19 Nathan Sidwell <nathan@codesourcery.com> * ld-scripts/data.{s,t,d,exp}: New. |