diff options
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-riscv.c | 25 |
2 files changed, 13 insertions, 17 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index b52259f..5dc06f5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2017-09-07 Palmer Dabbelt <palmer@dabbelt.com> + + * config/tc-riscv.c (riscv_frag_align_code): Emit the entire + alignment sequence inside R_RISCV_ALIGN. + 2017-09-05 Alexander Fedotov <alexander.fedotov@nxp.com> Edmar Wienskoski <edmar.wienskoski@nxp.com diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c index 4c644ab..1a15efc 100644 --- a/gas/config/tc-riscv.c +++ b/gas/config/tc-riscv.c @@ -2274,30 +2274,21 @@ bfd_boolean riscv_frag_align_code (int n) { bfd_vma bytes = (bfd_vma) 1 << n; - bfd_vma min_text_alignment_order = riscv_opts.rvc ? 1 : 2; - bfd_vma min_text_alignment = (bfd_vma) 1 << min_text_alignment_order; - - /* First, get back to minimal alignment. */ - frag_align_code (min_text_alignment_order, 0); + bfd_vma worst_case_bytes = bytes - 2; + char *nops = frag_more (worst_case_bytes); + expressionS ex; /* When not relaxing, riscv_handle_align handles code alignment. */ if (!riscv_opts.relax) return FALSE; - if (bytes > min_text_alignment) - { - bfd_vma worst_case_bytes = bytes - min_text_alignment; - char *nops = frag_more (worst_case_bytes); - expressionS ex; + ex.X_op = O_constant; + ex.X_add_number = worst_case_bytes; - ex.X_op = O_constant; - ex.X_add_number = worst_case_bytes; + riscv_make_nops (nops, worst_case_bytes); - riscv_make_nops (nops, worst_case_bytes); - - fix_new_exp (frag_now, nops - frag_now->fr_literal, 0, - &ex, FALSE, BFD_RELOC_RISCV_ALIGN); - } + fix_new_exp (frag_now, nops - frag_now->fr_literal, 0, + &ex, FALSE, BFD_RELOC_RISCV_ALIGN); return TRUE; } |