From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by sourceware.org (Postfix) with ESMTPS id E22843857812 for ; Mon, 14 Sep 2020 15:27:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org E22843857812 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08EFOxSU067583; Mon, 14 Sep 2020 15:27:07 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 33gp9ky9pe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 14 Sep 2020 15:27:07 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 08EFPlFj066744; Mon, 14 Sep 2020 15:27:06 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 33hm2xbbut-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 Sep 2020 15:27:06 +0000 Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 08EFR6wR007065; Mon, 14 Sep 2020 15:27:06 GMT Received: from termi.oracle.com (/10.175.39.67) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 Sep 2020 15:27:05 +0000 From: "Jose E. Marchesi" To: Nick Clifton via Binutils Subject: Re: Commit: Gas: Add .nop directive. References: <87d02oe6h4.fsf@redhat.com> Date: Mon, 14 Sep 2020 17:27:00 +0200 In-Reply-To: <87d02oe6h4.fsf@redhat.com> (Nick Clifton via Binutils's message of "Mon, 14 Sep 2020 16:13:59 +0100") Message-ID: <87bli89y63.fsf@oracle.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9744 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009140125 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9744 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 adultscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 phishscore=0 spamscore=0 priorityscore=1501 suspectscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2009140125 X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_STOCKGEN, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2020 15:27:11 -0000 Hi Nick. > I am checking in the attached patch to add a ".nop" directive to the > assembler. This directive creates a single no-op instruction. It is > similar to the already existing ".nops" directive, apart from two > important differences: > > 1. It is implemented for all architectures, not just x86. > 2. The instruction it generates counts as a real instruction for the > purposes of DWARF line number table generation. > > Fact 1 is important as it allows the directive to be used to generate > architecture neutral test cases containing real instructions. > > Tested with a large variety of different targets. Very nice! In the same spirit, it would be awesome to be able to generate architecture-neutral data directives as well, for DWARF and CTF and the like :) > diff --git a/gas/config/tc-bpf.h b/gas/config/tc-bpf.h > index 5765833997..cb02d6c133 100644 > --- a/gas/config/tc-bpf.h > +++ b/gas/config/tc-bpf.h > @@ -48,3 +48,4 @@ > /* Values passed to md_apply_fix don't include the symbol value. */ > #define MD_APPLY_SYM_VALUE(FIX) 0 > > +#define md_single_noop_insn "mov %r1,%r1" For BPF we have this in GCC: (define_insn "nop" [(const_int 0)] "" "mov\t%%r0,%%r0" [(set_attr "type" "alu")]) I think it would be good to settle on the same way to encode nops in both GCC and binutils.