From patchwork Tue Nov 22 18:19:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 24501 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2369235wrr; Tue, 22 Nov 2022 10:19:45 -0800 (PST) X-Google-Smtp-Source: AA0mqf6NUCw+C5IRHalIUj4ItcMjaRbgza0qWVtEVzg5Z9GEWuOV8Uq5Jd810hQxuHWyVrrgXMiW X-Received: by 2002:a17:907:2a10:b0:7a7:9b01:2a6c with SMTP id fd16-20020a1709072a1000b007a79b012a6cmr20713301ejc.153.1669141184951; Tue, 22 Nov 2022 10:19:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669141184; cv=none; d=google.com; s=arc-20160816; b=F1sDUJ1gSjUPp+duChwyRsmcGR34rl5Ut4CPI6S7cwHgc8bkIGz64HHBt9Nq9Erwrv ar7xttAnf9cVrAUes7Q/Pywk5EnGYhEI3ZAhO0zWwXVFD72UrKzyjj9xLQej4LkMqwAD kP1UOffF79fJqZEqEI0kLAv50SknNw8uIfYO6XEivYCUK+pKsn4/lk9tT+C9nAK1zbVE l1jtjUpSvU0h9aoZK4e7Rz3IMs4Zvg+JfLZH4v0ySRVnpp65SdAQMk3X9IiEmYF4EY/8 hLYZECuls/d8r4gmPgIGtcDpAxQOQaTMBURny6Ac4MxLkMtPymbdGalx3vacRZyShQQH 0DUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=cfHqnaC/vp8xwSuLyASQxmO+t2Yyqr+U0z2/4u9UDPU=; b=n1ocrq0MvdQ8dcS4EiLwtflefjypcMadLMJ9aemK+9OD/tteTpU5RWxCBnrwrbEVQX 92HFsiyQWFYFlNp5mTHVywidIQW5+M94g6u5KmOxqW4LosY7JdPZ27W/nI32I5rzx3cI f3aGHQ6AnIr9l93snk3Xfa77P+vaNLKo74ipDdkydBBE1ghrvdeKVG6tqyCvHpM1SWDa 2qGSPH1+Ms1cueTaT5j+OplRDro6zRhBbCSvUaUjU0ydeompWO7eeYW/Htm83rD8p8Te 0KRHkmyxFDVH77FjxZK6rpC+Ivqrwvz9C40Z8PNPqO/AfLjRurrXFJhzCbKZeNSGiA4M /uRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hsl+N1bm; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id l18-20020a056402255200b00463d1e263b1si13684195edb.364.2022.11.22.10.19.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 10:19:44 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=hsl+N1bm; spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="binutils-bounces+ouuuleilei=gmail.com@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BDAFB3858C2B for ; Tue, 22 Nov 2022 18:19:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BDAFB3858C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669141183; bh=cfHqnaC/vp8xwSuLyASQxmO+t2Yyqr+U0z2/4u9UDPU=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=hsl+N1bm2csZqKg3hmft8FNs7SkMrREtRWklMzLZbda7z86YK8mzQD0yzzaq+u63j LLOfhabtJUUitP3YrOWGhNwaxsxvVR1ZSeUKqQGNvsw+K3hqIvq7uhp9BLCHfVwlLR k+1BkE4L0x7uLXW4Ig4Sbs1Dtq7zbj31FKFMvt3w= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id CF7F03858D35 for ; Tue, 22 Nov 2022 18:19:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CF7F03858D35 Received: by mail-pf1-x42f.google.com with SMTP id g62so15105768pfb.10 for ; Tue, 22 Nov 2022 10:19:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=cfHqnaC/vp8xwSuLyASQxmO+t2Yyqr+U0z2/4u9UDPU=; b=ASLuWqnhpbSm0nag7Rg6B/3tElpx+jESsBayFNlckPnKECs84vDGSehhye3tC6pI27 +EhI5MFfNSF37+0Fc211hn3eMVEHMkvJ5LGG5RSULSR7A14v4lZuXa125bW/hm0cAIi5 RJPWmZ2c8hLWzCGQLJLwIoG07O2LDVRiGNpBQZkGTJskZaCDcSZz1/gbHVQh3xG2cyNj roJDxMCJAzZb+R0DN6q8Qqk+62IgRBMefHKF2UkkiNAkpN0Q53irCfQEs/Pt5lpMEw7l ocN3Xqinaxd/VDAvKMW+C9mO6Rwr6fP9qsqxZpMJTxsX56WXbP2AcM9wI48l8Zs3OqE9 /IvA== X-Gm-Message-State: ANoB5pmbtAUrYVKj4MBsJTET23f6Vi7TtpIZX4/QgZY9NE2vqk1ccvth S+/92lAWnJdUi9raS1UUKyjSDxXa+2c= X-Received: by 2002:a62:405:0:b0:573:9738:292f with SMTP id 5-20020a620405000000b005739738292fmr5277800pfe.9.1669141169424; Tue, 22 Nov 2022 10:19:29 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.56.31.158]) by smtp.gmail.com with ESMTPSA id m4-20020a170902db0400b0016c50179b1esm12436881plx.152.2022.11.22.10.19.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 10:19:28 -0800 (PST) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 842DEC04D9; Tue, 22 Nov 2022 10:19:27 -0800 (PST) To: binutils@sourceware.org Cc: Jan Beulich Subject: [PATCH] x86: Remove libopcodes dependency Date: Tue, 22 Nov 2022 10:19:27 -0800 Message-Id: <20221122181927.251937-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3026.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: "H.J. Lu via Binutils" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750221386862030518?= X-GMAIL-MSGID: =?utf-8?q?1750221386862030518?= Since i386-init.h and i386-tbl.h are only used by tc-i386.c, we can remove libopcodes dependency by including opcodes/i386-tbl.h directly. gas/ * Makefile.am ($(srcdir)/../opcodes/i386-init.h $(srcdir)/../opcodes/i386-tbl.h): New rule. * configure.ac (need_opcodes): Don't set for i386. * config/tc-i386.c: Include "opcodes/i386-tbl.h". * Makefile.in: Regenerated. * configure: Likewise. opcodes/ * Makefile.am (TARGET32_LIBOPCODES_CFILES): Remove i386-opc.c. (i386-opc.lo): Removed. (gen-i386-tbl): New rule. * configure.ac: Remove i386-opc.lo. * i386-opc.c: Removed. * i386-opc.h (insn_template): Change name to const char *. (i386_regtab): Removed. (i386_regtab_size): Likewise. * Makefile.in: Regenerated. * configure: Likewise. * po/POTFILES.in: Likewise. --- gas/Makefile.am | 6 ++++++ gas/Makefile.in | 6 ++++++ gas/config/tc-i386.c | 1 + gas/configure | 2 +- gas/configure.ac | 2 +- opcodes/Makefile.am | 6 +----- opcodes/Makefile.in | 7 +------ opcodes/configure | 2 +- opcodes/configure.ac | 2 +- opcodes/i386-opc.c | 24 ------------------------ opcodes/i386-opc.h | 5 +---- opcodes/po/POTFILES.in | 1 - 12 files changed, 20 insertions(+), 44 deletions(-) delete mode 100644 opcodes/i386-opc.c diff --git a/gas/Makefile.am b/gas/Makefile.am index 4661a718214..4deff602991 100644 --- a/gas/Makefile.am +++ b/gas/Makefile.am @@ -446,6 +446,12 @@ development.exp: $(BFDDIR)/development.sh $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \ | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@ +$(srcdir)/../opcodes/i386-init.h $(srcdir)/../opcodes/i386-tbl.h: \ + @MAINT@ $(srcdir)/../opcodes/i386-opc.tbl \ + $(srcdir)/../opcodes/i386-reg.tbl \ + $(srcdir)/../opcodes/i386-opc.h + cd ../opcodes; make gen-i386-tbl + EXTRA_as_new_SOURCES += config/m68k-parse.y config/m68k-parse.c: $(srcdir)/config/m68k-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/m68k-parse.y y.tab.c $@ -- $(YACCCOMPILE) diff --git a/gas/Makefile.in b/gas/Makefile.in index 1e01f343f32..29c12852572 100644 --- a/gas/Makefile.in +++ b/gas/Makefile.in @@ -2060,6 +2060,12 @@ check-DEJAGNU: site.exp development.exp: $(BFDDIR)/development.sh $(EGREP) "(development|experimental)=" $(BFDDIR)/development.sh \ | $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@ + +$(srcdir)/../opcodes/i386-init.h $(srcdir)/../opcodes/i386-tbl.h: \ + @MAINT@ $(srcdir)/../opcodes/i386-opc.tbl \ + $(srcdir)/../opcodes/i386-reg.tbl \ + $(srcdir)/../opcodes/i386-opc.h + cd ../opcodes; make gen-i386-tbl config/m68k-parse.c: $(srcdir)/config/m68k-parse.y $(SHELL) $(YLWRAP) $(srcdir)/config/m68k-parse.y y.tab.c $@ -- $(YACCCOMPILE) config/m68k-parse.h: config/m68k-parse.c diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index f54e7fddee0..39e56d9eac7 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -34,6 +34,7 @@ #include "sframe.h" #include "elf/x86-64.h" #include "opcodes/i386-init.h" +#include "opcodes/i386-tbl.h" #include #ifndef INFER_ADDR_PREFIX diff --git a/gas/configure b/gas/configure index d9800f8a53d..0a5d0ce4e18 100755 --- a/gas/configure +++ b/gas/configure @@ -12263,7 +12263,7 @@ _ACEOF # Do we need the opcodes library? case ${cpu_type} in - vax | tic30) + i386 | vax | tic30) ;; *) diff --git a/gas/configure.ac b/gas/configure.ac index feb43399ce8..7f165c9fe64 100644 --- a/gas/configure.ac +++ b/gas/configure.ac @@ -420,7 +420,7 @@ changequote([,])dnl # Do we need the opcodes library? case ${cpu_type} in - vax | tic30) + i386 | vax | tic30) ;; *) diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am index 93e9002be19..b227427672f 100644 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -162,7 +162,6 @@ TARGET32_LIBOPCODES_CFILES = \ h8300-dis.c \ hppa-dis.c \ i386-dis.c \ - i386-opc.c \ ip2k-asm.c \ ip2k-desc.c \ ip2k-dis.c \ @@ -562,10 +561,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) < $(srcdir)/i386-opc.tbl \ | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) -i386-opc.lo: $(srcdir)/i386-tbl.h -# While not really a dependency, specify i386-init.h here as well to make sure -# it is generated even if i386-tbl.h is present and up-to-date. -i386-opc.lo: $(srcdir)/i386-init.h +gen-i386-tbl: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIB_DEPS) $(AM_V_CCLD)$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBS) diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in index fe4539d6097..8bfa2118f58 100644 --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -554,7 +554,6 @@ TARGET32_LIBOPCODES_CFILES = \ h8300-dis.c \ hppa-dis.c \ i386-dis.c \ - i386-opc.c \ ip2k-asm.c \ ip2k-desc.c \ ip2k-dis.c \ @@ -947,7 +946,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h8300-dis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hppa-dis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-dis.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i386-opc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64-dis.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ia64-opc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ip2k-asm.Plo@am__quote@ @@ -1537,10 +1535,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) < $(srcdir)/i386-opc.tbl \ | ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir) -i386-opc.lo: $(srcdir)/i386-tbl.h -# While not really a dependency, specify i386-init.h here as well to make sure -# it is generated even if i386-tbl.h is present and up-to-date. -i386-opc.lo: $(srcdir)/i386-init.h +gen-i386-tbl: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h ia64-gen$(EXEEXT_FOR_BUILD): ia64-gen.o $(BUILD_LIB_DEPS) $(AM_V_CCLD)$(LINK_FOR_BUILD) ia64-gen.o $(BUILD_LIBS) diff --git a/opcodes/configure b/opcodes/configure index 08c57a33855..9dc87d6c19c 100755 --- a/opcodes/configure +++ b/opcodes/configure @@ -12534,7 +12534,7 @@ if test x${all_targets} = xfalse ; then bfd_h8300_arch) ta="$ta h8300-dis.lo" ;; bfd_hppa_arch) ta="$ta hppa-dis.lo" ;; bfd_i386_arch|bfd_iamcu_arch) - ta="$ta i386-dis.lo i386-opc.lo" ;; + ta="$ta i386-dis.lo" ;; bfd_ia64_arch) ta="$ta ia64-dis.lo ia64-opc.lo" ;; bfd_ip2k_arch) ta="$ta ip2k-asm.lo ip2k-desc.lo ip2k-dis.lo ip2k-ibld.lo ip2k-opc.lo" using_cgen=yes ;; bfd_epiphany_arch) ta="$ta epiphany-asm.lo epiphany-desc.lo epiphany-dis.lo epiphany-ibld.lo epiphany-opc.lo" using_cgen=yes ;; diff --git a/opcodes/configure.ac b/opcodes/configure.ac index e998d613436..8c79deb9ffc 100644 --- a/opcodes/configure.ac +++ b/opcodes/configure.ac @@ -282,7 +282,7 @@ if test x${all_targets} = xfalse ; then bfd_h8300_arch) ta="$ta h8300-dis.lo" ;; bfd_hppa_arch) ta="$ta hppa-dis.lo" ;; bfd_i386_arch|bfd_iamcu_arch) - ta="$ta i386-dis.lo i386-opc.lo" ;; + ta="$ta i386-dis.lo" ;; bfd_ia64_arch) ta="$ta ia64-dis.lo ia64-opc.lo" ;; bfd_ip2k_arch) ta="$ta ip2k-asm.lo ip2k-desc.lo ip2k-dis.lo ip2k-ibld.lo ip2k-opc.lo" using_cgen=yes ;; bfd_epiphany_arch) ta="$ta epiphany-asm.lo epiphany-desc.lo epiphany-dis.lo epiphany-ibld.lo epiphany-opc.lo" using_cgen=yes ;; diff --git a/opcodes/i386-opc.c b/opcodes/i386-opc.c deleted file mode 100644 index 729c22932b1..00000000000 --- a/opcodes/i386-opc.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Intel 80386 opcode table - Copyright (C) 2007-2022 Free Software Foundation, Inc. - - This file is part of the GNU opcodes library. - - This library is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. - - It is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, - MA 02110-1301, USA. */ - -#include "sysdep.h" -#include "libiberty.h" -#include "i386-opc.h" -#include "i386-tbl.h" diff --git a/opcodes/i386-opc.h b/opcodes/i386-opc.h index 459268f3656..51256dcfc0e 100644 --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -924,7 +924,7 @@ typedef union i386_operand_type typedef struct insn_template { /* instruction name sans width suffix ("mov" for movl insns) */ - char *name; + const char *name; /* Bitfield arrangement is such that individual fields can be easily extracted (in native builds at least) - either by at most a masking @@ -1011,6 +1011,3 @@ typedef struct #define Dw2Inval (-1) } reg_entry; - -extern const reg_entry i386_regtab[]; -extern const unsigned int i386_regtab_size; diff --git a/opcodes/po/POTFILES.in b/opcodes/po/POTFILES.in index 24f57af24a3..421f67c0791 100644 --- a/opcodes/po/POTFILES.in +++ b/opcodes/po/POTFILES.in @@ -74,7 +74,6 @@ hppa-dis.c i386-dis.c i386-gen.c i386-init.h -i386-opc.c i386-opc.h i386-tbl.h ia64-asmtab.c