summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gas/ChangeLog10
-rw-r--r--gas/testsuite/gas/all/gas.exp2
-rw-r--r--gas/testsuite/gas/all/pr20312.l2
-rw-r--r--gas/testsuite/gas/all/pr20312.s3
-rw-r--r--gas/write.c32
5 files changed, 33 insertions, 16 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 04a84fab418..300d5ca37b7 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,13 @@
+2016-06-30 Maciej W. Rozycki <macro@imgtec.com>
+
+ PR gas/20312
+ * write.c (subsegs_finish_section): Force no section padding to
+ alignment on failed assembly, always set last frag's alignment
+ from section.
+ * testsuite/gas/all/pr20312.l: New list test.
+ * testsuite/gas/all/pr20312.s: New test source.
+ * testsuite/gas/all/gas.exp: Run the new test
+
2016-06-30 Matthew Wahab <matthew.wahab@arm.com>
* testsuite/gas/arm/armv8_2+rdma.d: New.
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index d5d2445ab63..bfb13ed22cd 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -448,6 +448,8 @@ if [is_elf_format] {
run_dump_test quoted-sym-names
+run_list_test pr20312
+
load_lib gas-dg.exp
dg-init
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/err-*.s $srcdir/$subdir/warn-*.s]] "" ""
diff --git a/gas/testsuite/gas/all/pr20312.l b/gas/testsuite/gas/all/pr20312.l
new file mode 100644
index 00000000000..47328e7b9a9
--- /dev/null
+++ b/gas/testsuite/gas/all/pr20312.l
@@ -0,0 +1,2 @@
+.*: Assembler messages:
+.*:3: Error: \.err encountered
diff --git a/gas/testsuite/gas/all/pr20312.s b/gas/testsuite/gas/all/pr20312.s
new file mode 100644
index 00000000000..d88c6ba627d
--- /dev/null
+++ b/gas/testsuite/gas/all/pr20312.s
@@ -0,0 +1,3 @@
+ .text
+ .byte 0
+ .err
diff --git a/gas/write.c b/gas/write.c
index 8873e5519f4..c502b08aed6 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1732,31 +1732,31 @@ subsegs_finish_section (asection *s)
frchainP != NULL;
frchainP = frchainP->frch_next)
{
- int alignment = 0;
+ int alignment;
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 ())
- {
- alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP);
- if ((bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE)
- && now_seg->entsize)
- {
- unsigned int entsize = now_seg->entsize;
- int entalign = 0;
+ if (had_errors ())
+ do_not_pad_sections_to_alignment = 1;
- while ((entsize & 1) == 0)
- {
- ++entalign;
- entsize >>= 1;
- }
+ alignment = SUB_SEGMENT_ALIGN (now_seg, frchainP);
+ if ((bfd_get_section_flags (now_seg->owner, now_seg) & SEC_MERGE)
+ && now_seg->entsize)
+ {
+ unsigned int entsize = now_seg->entsize;
+ int entalign = 0;
- if (entalign > alignment)
- alignment = entalign;
+ while ((entsize & 1) == 0)
+ {
+ ++entalign;
+ entsize >>= 1;
}
+
+ if (entalign > alignment)
+ alignment = entalign;
}
if (subseg_text_p (now_seg))