This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [binutils-gdb] Add .nop assembler directive
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: "H.J.Lu" <hjl at sourceware dot org>, Binutils <binutils at sourceware dot org>
- Date: Mon, 19 Feb 2018 06:10:19 -0800
- Subject: Re: [binutils-gdb] Add .nop assembler directive
- Authentication-results: sourceware.org; auth=none
- References: <20180217132241.57892.qmail@sourceware.org> <20180219045019.GQ3812@bubble.grove.modra.org>
On Sun, Feb 18, 2018 at 8:50 PM, Alan Modra <amodra@gmail.com> wrote:
> On Sat, Feb 17, 2018 at 01:22:41PM -0000, H.J.Lu wrote:
>> https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=62a02d25b6e5d9f92c205260daa11355d0c62532
>>
>> commit 62a02d25b6e5d9f92c205260daa11355d0c62532
>> Author: H.J. Lu <hjl.tools@gmail.com>
>> Date: Sat Feb 17 05:20:42 2018 -0800
>>
>> Add .nop assembler directive
>
> It looks like this patch caused the following regressions. Please
> investigate.
>
> m68hc11-elf +FAIL: objdump -WL
> m68hc11-elf +FAIL: gas/elf/warn-2.s (test for warnings, line )
> m68hc11-elf +FAIL: lns-common-1
> m68hc11-elf +FAIL: all_insns
> m68hc11-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
> m68hc11-elf +FAIL: 68HC12 PC-relative addressing modes (bug-1825)
> m68hc11-elf +FAIL: XGATE instruction set and all modes
> m68hc11-elf +FAIL: ld-m68hc11/relax-group
> m68hc11-elf +FAIL: ld-m68hc11/xgate1
> m68hc12-elf +FAIL: objdump -WL
> m68hc12-elf +FAIL: gas/elf/warn-2.s (test for warnings, line )
> m68hc12-elf +FAIL: lns-common-1
> m68hc12-elf +FAIL: all_insns
> m68hc12-elf +FAIL: 68HC12 indexed addressing mode with 5, 9 and 16-bit offsets (indexed12)
> m68hc12-elf +FAIL: 68HC12 PC-relative addressing modes (bug-1825)
> m68hc12-elf +FAIL: XGATE instruction set and all modes
> m68hc12-elf +FAIL: ld-m68hc11/relax-group
> m68hc12-elf +FAIL: ld-m68hc11/xgate1
> m68k-elf +FAIL: MRI immediate constants
> m68k-linux +FAIL: MRI immediate constants
> m68k-netbsd +FAIL: MRI immediate constants
> spu-elf +FAIL: objdump -WL
> spu-elf +FAIL: gas/elf/warn-2.s (test for warnings, line )
> spu-elf +FAIL: lns-common-1
> spu-elf +FAIL: ld-spu/icache1
> xgate-elf +FAIL: objdump -WL
> xgate-elf +FAIL: gas/elf/warn-2.s (test for warnings, line )
> xgate-elf +FAIL: lns-common-1
> xgate-elf +FAIL: Dwarf2 test on insns.s
> xgate-elf +FAIL: all_insns
> xgate-elf +FAIL: insns
> z80-coff +FAIL: relative jump out of range (jr)
> z80-coff +FAIL: relative jump out of range (djnz)
> z80-coff +FAIL: miscellaneous instructions
>
These are caused by
config/tc-m68hc11.h:#define NO_PSEUDO_DOT 1
config/tc-m68k.h:#define NO_PSEUDO_DOT 1
config/tc-spu.h:#define NO_PSEUDO_DOT 1
config/tc-xgate.h:#define NO_PSEUDO_DOT 1
config/tc-xtensa.c:/* NO_PSEUDO_DOT hook */
config/tc-xtensa.h:#define NO_PSEUDO_DOT xtensa_check_inside_bundle ()
config/tc-z80.h:#define NO_PSEUDO_DOT 1
We match .nop diretive to nop instruction. This patch avoids
matching .nop diretive to nop instruction when NO_PSEUDO_DOT
is defined to 1. OK for master?
--
H.J.
From 70df112143b11d50771689a5d6024776e7f2077a Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 19 Feb 2018 06:06:18 -0800
Subject: [PATCH] Avoid matching .nop diretive to nop instruction
When NO_PSEUDO_DOT is defined to 1, we should avoid matching .nop
diretive to nop instruction.
* read.c (potable): Sort nop.
(read_a_source_file): Avoid matching .nop diretive to nop
instruction.
---
gas/read.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/gas/read.c b/gas/read.c
index 9ab88f8962..eddfac3247 100644
--- a/gas/read.c
+++ b/gas/read.c
@@ -416,6 +416,7 @@ static const pseudo_typeS potable[] = {
{"noaltmacro", s_altmacro, 0},
{"noformat", s_ignore, 0},
{"nolist", listing_list, 0}, /* Turn listing off. */
+ {"nop", s_nop, 0},
{"nopage", listing_nopage, 0},
{"octa", cons, 16},
{"offset", s_struct, 0},
@@ -442,7 +443,6 @@ static const pseudo_typeS potable[] = {
/* size */
{"space", s_space, 0},
{"skip", s_space, 0},
- {"nop", s_nop, 0},
{"sleb128", s_leb128, 1},
{"spc", s_ignore, 0},
{"stabd", s_stab, 'd'},
@@ -1067,8 +1067,19 @@ read_a_source_file (const char *name)
/* The MRI assembler uses pseudo-ops without
a period. */
pop = (pseudo_typeS *) hash_find (po_hash, s);
- if (pop != NULL && pop->poc_handler == NULL)
- pop = NULL;
+ if (pop != NULL)
+ {
+ if (pop->poc_handler == NULL)
+ pop = NULL;
+ else if (NO_PSEUDO_DOT
+ && pop->poc_handler == s_nop)
+ {
+ /* NB: When NO_PSEUDO_DOT is defined to
+ 1, avoid matching .nop diretive to nop
+ instruction. */
+ pop = NULL;
+ }
+ }
}
if (pop != NULL
--
2.14.3