From: Alan Modra Date: Wed, 8 Jul 2015 12:48:34 +0000 (+0930) Subject: Make ALIGN(x) behave as ALIGN(.,x) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a2c59f28;p=binutils-gdb.git 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 ): Use it. --- diff --git a/ld/ChangeLog b/ld/ChangeLog index 9228ead9ebf..aec6288a80a 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2015-07-10 Alan Modra + + * ldexp.c (align_dot_val): New function. + (fold_unary ): Use it. + 2015-07-03 Kai Tietz PR ld/11539 diff --git a/ld/ldexp.c b/ld/ldexp.c index a5192b1eaad..2c0fe5a16fd 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;