diff options
author | Alan Modra <amodra@gmail.com> | 2019-05-04 16:03:47 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2019-05-04 17:23:18 +0930 |
commit | 27cdfa03b5be812683c18e64009a5da042190ae6 (patch) | |
tree | f2c6abd546ec1b2c9a7f215914f569cd29a8c0c2 /gas/config/tc-m32c.c | |
parent | a288c270991de1578ad28ac312120f4167347234 (diff) | |
download | fsf-binutils-gdb-27cdfa03b5be812683c18e64009a5da042190ae6.zip fsf-binutils-gdb-27cdfa03b5be812683c18e64009a5da042190ae6.tar.gz fsf-binutils-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 'gas/config/tc-m32c.c')
-rw-r--r-- | gas/config/tc-m32c.c | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/gas/config/tc-m32c.c b/gas/config/tc-m32c.c index d653186..07501df 100644 --- a/gas/config/tc-m32c.c +++ b/gas/config/tc-m32c.c @@ -86,7 +86,6 @@ size_t md_longopts_size = sizeof (md_longopts); static unsigned long m32c_mach = bfd_mach_m16c; static int cpu_mach = (1 << MACH_M16C); -static int insn_size; static int m32c_relax = 0; /* Flags to set in the elf header */ @@ -185,22 +184,6 @@ md_begin (void) /* Set the machine type */ bfd_default_set_arch_mach (stdoutput, bfd_arch_m32c, m32c_mach); - - insn_size = 0; -} - -void -m32c_md_end (void) -{ - int i, n_nops; - - if (bfd_get_section_flags (stdoutput, now_seg) & SEC_CODE) - { - /* Pad with nops for objdump. */ - n_nops = (32 - ((insn_size) % 32)) / 8; - for (i = 1; i <= n_nops; i++) - md_assemble ((char *) "nop"); - } } void @@ -335,6 +318,7 @@ md_assemble (char * str) char * errmsg; finished_insnS results; int rl_type; + int insn_size; if (m32c_mach == bfd_mach_m32c && m32c_indirect_operand (str)) return; |