diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2007-06-18 12:38:22 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@codesourcery.com> | 2007-06-18 12:38:22 +0000 |
commit | 362c1d1a0446425c24bb3ea8738b3d3d56344228 (patch) | |
tree | ded9c05175ee5950cbbed0c71356d7b58457e21c /ld/ldexp.c | |
parent | 42ba7415ccca9cf6b16c7127362b665cd312be63 (diff) | |
download | gdb-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.c | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -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; |