aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-05-04 16:03:47 +0930
committerAlan Modra <amodra@gmail.com>2019-05-04 17:23:18 +0930
commit27cdfa03b5be812683c18e64009a5da042190ae6 (patch)
treef2c6abd546ec1b2c9a7f215914f569cd29a8c0c2 /ld
parenta288c270991de1578ad28ac312120f4167347234 (diff)
downloadgdb-27cdfa03b5be812683c18e64009a5da042190ae6.zip
gdb-27cdfa03b5be812683c18e64009a5da042190ae6.tar.gz
gdb-27cdfa03b5be812683c18e64009a5da042190ae6.tar.bz2
m32c padding with nops
m32c_md_end attempted to pad out a code section with nops, but this was just plain wrong in many ways: - The padding didn't happen at all if the last section emitted wasn't a code section. - The padding went to the wrong place if subsections were used, and the last subseg used wasn't the highest numbered subseg. - Padding wasn't added to all code sections. - If the last section was empty, it was padded to 4 bytes. - The padding didn't go to a 4-byte alignment boundary, instead it effectively made the last instruction 4 bytes in size. - The padding didn't take into account that code sections may have contents other than machine instructions. So, rip it out and handle nop padding properly, also fixing .align .balign/.p2align in the middle of code. gas/ * config/tc-m32c.c (insn_size): Delete static var. (md_begin): Don't set it. (m32c_md_end): Delete. (md_assemble): Add insn_size auto var. * config/tc-m32c.h (md_end): Don't define. (m32c_md_end): Delete. (NOP_OPCODE, HANDLE_ALIGN, MAX_MEM_FOR_RS_ALIGN_CODE): Define. * testsuite/gas/all/align.d: Remove m32c from notarget list. * testsuite/gas/all/incbin.d: Likewise. * testsuite/gas/elf/dwarf2-11.d: Likewise. * testsuite/gas/macros/semi.d: Likewise. * testsuite/gas/all/gas.exp (do_comment): Similarly. ld/ * testsuite/ld-scripts/fill.d: Don't xfail m32c * testsuite/ld-scripts/fill16.d: Likewise.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog5
-rw-r--r--ld/testsuite/ld-scripts/fill.d3
-rw-r--r--ld/testsuite/ld-scripts/fill16.d3
3 files changed, 7 insertions, 4 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 722e656..d62a2c4 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,10 @@
2019-05-04 Alan Modra <amodra@gmail.com>
+ * testsuite/ld-scripts/fill.d: Don't xfail m32c
+ * testsuite/ld-scripts/fill16.d: Likewise.
+
+2019-05-04 Alan Modra <amodra@gmail.com>
+
PR 24511
* testsuite/ld-elf/pr14156a.d: Allow for .init/.fini being a
data section on hppa64.
diff --git a/ld/testsuite/ld-scripts/fill.d b/ld/testsuite/ld-scripts/fill.d
index 4a26349..54715c5 100644
--- a/ld/testsuite/ld-scripts/fill.d
+++ b/ld/testsuite/ld-scripts/fill.d
@@ -6,7 +6,7 @@
#skip: ia64-*-* mips*-*-freebsd* mips*-*-gnu* mips*-*-irix* mips*-*-kfreebsd*
#skip: mips*-*-linux* mips*-*-netbsd* mips*-*-openbsd* mips*-*-sysv4*
#skip: tilegx*-*-* tilepro-*-* x86_64-*-cygwin x86_64-*-mingw* x86_64-*-pe*
-#xfail: alpha*-*-*ecoff m32c-*-* sh-*-pe sparc*-*-coff
+#xfail: alpha*-*-*ecoff sh-*-pe sparc*-*-coff
#xfail: tic30-*-coff tic4x-*-* tic54x-*-* z8k-*-*
#
# See also fill16.d. We use `skip' for configurations unsupported
@@ -16,7 +16,6 @@
#
# alpha-linuxecoff pads out code to 16 bytes.
# ia64 aligns code to minimum 16 bytes.
-# m32c pads out code sections with 4 NOPs (see `m32c_md_end').
# mips aligns to minimum 16 bytes (except for bare-metal ELF and VxWorks).
# sh-pe pads out code sections to 16 bytes
# sparc-coff aligns to 8 bytes
diff --git a/ld/testsuite/ld-scripts/fill16.d b/ld/testsuite/ld-scripts/fill16.d
index 693b80c..2f3e0fd 100644
--- a/ld/testsuite/ld-scripts/fill16.d
+++ b/ld/testsuite/ld-scripts/fill16.d
@@ -4,7 +4,7 @@
#ld: -T fill.t
#objdump: -s -j .text
#skip: arm-*-coff i[3-7]86-*-coff
-#xfail: alpha*-*-*ecoff m32c-*-* sh-*-pe sparc*-*-coff
+#xfail: alpha*-*-*ecoff sh-*-pe sparc*-*-coff
#xfail: tic30-*-coff tic4x-*-* tic54x-*-* z8k-*-*
#
# See also fill.d. We use `skip' for configurations unsupported
@@ -15,7 +15,6 @@
# alpha-linuxecoff pads out code to 16 bytes.
# arm-coff always aligns code to 4 bytes.
# i386-coff always aligns code to 4 bytes.
-# m32c pads out code sections with 4 NOPs (see `m32c_md_end').
# sh-pe pads out code sections to 16 bytes
# sparc-coff aligns to 8 bytes
# tic30-coff aligns to 2 bytes