diff options
author | Jan Beulich <jbeulich@suse.com> | 2024-11-18 11:37:31 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2024-11-18 11:37:31 +0100 |
commit | 20d9fb448c375d5f521eaed8cfc0c49a44803bd1 (patch) | |
tree | 4055cc9d591d472630db57d1d51f80f4139b7146 | |
parent | af3394d97a8c5187085c0eec5fb03e8da88db5fb (diff) | |
download | binutils-20d9fb448c375d5f521eaed8cfc0c49a44803bd1.zip binutils-20d9fb448c375d5f521eaed8cfc0c49a44803bd1.tar.gz binutils-20d9fb448c375d5f521eaed8cfc0c49a44803bd1.tar.bz2 |
gas: move had_errors() invocation in finishing of subsegs
Invoking this repeatedly in an inner loop is not only inefficient, but
may lead to inconsistencies in e.g. the listings that the original
comment author cared about. (Accept potential inconsistencies across
distinct sections though, to cover all invocations of the function.)
-rw-r--r-- | gas/write.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gas/write.c b/gas/write.c index 4188815..51e6726 100644 --- a/gas/write.c +++ b/gas/write.c @@ -1876,6 +1876,12 @@ subsegs_finish_section (asection *s) if (!seginfo) return; + /* This now gets called even if we had errors. In that case, any alignment + is meaningless, and, moreover, will look weird if we are generating a + listing. */ + if (had_errors ()) + do_not_pad_sections_to_alignment = 1; + for (frchainP = seginfo->frchainP; frchainP != NULL; frchainP = frchainP->frch_next) @@ -1884,12 +1890,6 @@ subsegs_finish_section (asection *s) subseg_set (s, frchainP->frch_subseg); - /* This now gets called even if we had errors. In that case, - any alignment is meaningless, and, moreover, will look weird - if we are generating a listing. */ - if (had_errors ()) - do_not_pad_sections_to_alignment = 1; - alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP); if ((bfd_section_flags (now_seg) & (SEC_MERGE | SEC_STRINGS)) && now_seg->entsize) |