aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2007-06-18 12:38:22 +0000
committerNathan Sidwell <nathan@codesourcery.com>2007-06-18 12:38:22 +0000
commit362c1d1a0446425c24bb3ea8738b3d3d56344228 (patch)
treeded9c05175ee5950cbbed0c71356d7b58457e21c /ld/ldexp.c
parent42ba7415ccca9cf6b16c7127362b665cd312be63 (diff)
downloadgdb-362c1d1a0446425c24bb3ea8738b3d3d56344228.zip
gdb-362c1d1a0446425c24bb3ea8738b3d3d56344228.tar.gz
gdb-362c1d1a0446425c24bb3ea8738b3d3d56344228.tar.bz2
* ldlex.l, ldgram.y: Add ALIGNOF.
* ldexp.c (exp_print_token, foldname): Likewise. * ld.texinfo: Likewise. ld/testsuite/ * ld-scripts/alignof.s: New. * ld-scripts/alignof.t: New * ld-scripts/alignof.exp: New.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 43f96ea..4f1d61d 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -97,6 +97,7 @@ exp_print_token (token_code_type code, int infix_p)
{ MAP, "MAP" },
{ ENTRY, "ENTRY" },
{ NEXT, "NEXT" },
+ { ALIGNOF, "ALIGNOF" },
{ SIZEOF, "SIZEOF" },
{ ADDR, "ADDR" },
{ LOADADDR, "LOADADDR" },
@@ -606,9 +607,9 @@ fold_name (etree_type *tree)
break;
case SIZEOF:
+ case ALIGNOF:
if (expld.phase != lang_first_phase_enum)
{
- int opb = bfd_octets_per_byte (output_bfd);
lang_output_section_statement_type *os;
os = lang_output_section_find (tree->name.name);
@@ -620,7 +621,16 @@ fold_name (etree_type *tree)
new_abs (0);
}
else if (os->processed_vma)
- new_abs (os->bfd_section->size / opb);
+ {
+ bfd_vma val;
+
+ if (tree->type.node_code == SIZEOF)
+ val = os->bfd_section->size / bfd_octets_per_byte (output_bfd);
+ else
+ val = (bfd_vma)1 << os->bfd_section->alignment_power;
+
+ new_abs (val);
+ }
}
break;