aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2015-07-08 22:18:34 +0930
committerAlan Modra <amodra@gmail.com>2015-07-10 20:08:55 +0930
commita2c59f280dda14a2f68d0175c8879238be1aa200 (patch)
treeee181b1fac3d8fbd51eedcc900fef1443c5e1061 /ld/ldexp.c
parent40f77f827b91ab9665ce27950c30c688f8fde983 (diff)
downloadgdb-a2c59f280dda14a2f68d0175c8879238be1aa200.zip
gdb-a2c59f280dda14a2f68d0175c8879238be1aa200.tar.gz
gdb-a2c59f280dda14a2f68d0175c8879238be1aa200.tar.bz2
Make ALIGN(x) behave as ALIGN(.,x)
Inside output sections, ALIGN(.,x) uses a section-relative value for dot. The unary ALIGN always used the absolute value of dot. * ldexp.c (align_dot_val): New function. (fold_unary <ALIGN_K, NEXT>): Use it.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index a5192b1..2c0fe5a 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -257,6 +257,14 @@ new_rel_from_abs (bfd_vma value)
expld.result.section = s;
}
+static void
+align_dot_val (bfd_vma align)
+{
+ bfd_vma base = expld.section->vma;
+
+ new_rel_from_abs (base + align_n (expld.dot - base, align));
+}
+
/* New-function for the definedness hash table. */
static struct bfd_hash_entry *
@@ -335,7 +343,7 @@ fold_unary (etree_type *tree)
{
case ALIGN_K:
if (expld.phase != lang_first_phase_enum)
- new_rel_from_abs (align_n (expld.dot, expld.result.value));
+ align_dot_val (expld.result.value);
else
expld.result.valid_p = FALSE;
break;
@@ -365,7 +373,7 @@ fold_unary (etree_type *tree)
if (expld.phase != lang_first_phase_enum)
{
make_abs ();
- expld.result.value = align_n (expld.dot, expld.result.value);
+ align_dot_val (expld.result.value);
}
else
expld.result.valid_p = FALSE;