From patchwork Thu Nov 17 13:29:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 21662 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp398879wrr; Thu, 17 Nov 2022 05:29:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf63WZQw8WPyMBXPPPi4r+0PeWgX8yCXCdPhRNLnXYPJ3lK9f2TKMw9baM8Oh3p4vNLE8o6h X-Received: by 2002:a17:907:10c3:b0:7ae:98fc:aaa3 with SMTP id rv3-20020a17090710c300b007ae98fcaaa3mr2132066ejb.547.1668691757021; Thu, 17 Nov 2022 05:29:17 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id m10-20020a50ef0a000000b0045807f73ad5si763856eds.570.2022.11.17.05.29.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 05:29:17 -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=lw1G1RhL; arc=fail (signature failed); 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 CFF7B39960E3 for ; Thu, 17 Nov 2022 13:29:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CFF7B39960E3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668691755; bh=PCzj7uJMgKixj0A5TrUnr4gdBK7nfmlRkGCV5kjI4mM=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=lw1G1RhLqhyJuMT2wHZrESFKH42X/3AodQLQVsQavADSf+xvDn7uY0fmqgB/VH/dm LE/3fikY5yCp+7+v0fGO9hcUPNzT/nsra0X2dVCDtqej9qz4onmEjW3zBh3isBhKhJ mDNZtCje5WTa7zalzvClmkOmE26t9uGCNRbDtk2k= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2053.outbound.protection.outlook.com [40.107.247.53]) by sourceware.org (Postfix) with ESMTPS id 7D3AB39960E3 for ; Thu, 17 Nov 2022 13:29:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D3AB39960E3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QZ0dreExu/V1VmhFGk4awrPJnT9IJ+k41V7oXKo61fFfLb6lHbXr95T/2LUWHxA5kHMC7uo87osG3iV/t3wyQuWT+5PbhXxYk/bJd/pzy1HordgSpz+HYcVTIZ+zUInLGoFYeRdEMVNWMUc7qL9J5qEr3je28mNiiUGB328wXUPRv3t9jEkPfth/GxlKkfW+wwUjuARkPW4+I/+yr75qy3e63s06wZSSm/XcMATbeKC/EAaWxjRPsA4GOI74yApShWW5NhLDmrQ446CBVhgwG+EW6+jc4aMbemIzh1Lrf21hGzt2wydhWtCqkV8YlS37zenHHQwssbk7FHh68ppJmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PCzj7uJMgKixj0A5TrUnr4gdBK7nfmlRkGCV5kjI4mM=; b=cYcgsGgCcTffcysKqvHe+20s191UOWX3SDR44OAMnl2/1S3PXW3Y21y9Fvgete73DRkhJHrsuC0bgbLYD6+092wwGjNrJSmJG7vuh0L6Jo5F9I5YQ+qfm3oSfUj0fIDYhOijWKfeqMMuVBM5kAtEtrZ9M0452z5NrguX4s0bhqOiAeZNCFfGA5TirfXpu55YwdO+CaNO3ckkGUg1g8gBpevOAfHjM+ekNcQ+u0JESLPrAbYVtuYRVagH4t51HCK3j8gSF8G12zmUNdhY0fN1sWdxDZsHbNP5rtnEikBn60WZHyADjCPexk1HjdYvTJ4pyVsnfn2vgkZx/LEhn5eqBw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM8PR04MB7988.eurprd04.prod.outlook.com (2603:10a6:20b:24e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12; Thu, 17 Nov 2022 13:29:03 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5813.018; Thu, 17 Nov 2022 13:29:03 +0000 Message-ID: Date: Thu, 17 Nov 2022 14:29:02 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: [PATCH 1/2] x86: instantiate i386_{op, reg}tab[] in gas instead of in libopcodes Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: <5c07cdb4-ec26-c7bf-087a-4d0c75ef8549@suse.com> In-Reply-To: <5c07cdb4-ec26-c7bf-087a-4d0c75ef8549@suse.com> X-ClientProxiedBy: FR2P281CA0168.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:99::17) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7988:EE_ X-MS-Office365-Filtering-Correlation-Id: a63a72af-9448-471a-b5da-08dac89fb1c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h2Gf0EDwHeb8DEiJLg49UBunHfNw/PwbyhV/wLPShb87V2TQTLYTl604XeqvMi6LOmPZMQOC96Zu2i6tmeXtuqFx7zXxrkrO/fHFTDZB41CwAMzhdNq9It0bsJDyIl+EUJQHoMP2G2fCnUtg1lnMFvsohm1KjlgtNF7p/E2CIibguPbo8yyLd2TOtvuuBfbXACnNjOv0XRPw54YzA0aPPtzYOPQ4t3oq1m3DZ1MYMk4JRVY6XW6XAoccQtRL9uU4G9Ta5xVjGhbzn77mav2eVF0wHVIFoGFZDAJHa1+ALfVpF2esnDfTMwBCE3us/qCMBqu1ojRgYFLfIbSZimH/Fz+JkdY0lKppLnyAoAEz0HoSZ1u40Icltk85nk1cZ4mcY6YiPZztCdNtuU1poCSGwgwYQuHjRUrc3Nec+GI5HNJFkmLELxeI39L/ujf7ClBXBsZTw4+bl4eBgJgrZt3Lkrni/qEhb27Vdi/7JpPx8zOTNC6q1d4rLceJoC1BJjTA1JmLnVcBuOkU+9xnYsni1I9Ycb4KFO2I9wdHikYWCkDRnbzbmRUR6vfIWaupn2Zvf4nABsq6ktmnoRaWwLrbVs0haoiorWohtZtnSNTYX3HlrUq8cS4ukp7IWPh3SMpVy59fyhO2U/Uax6Yf2GVDsLY1rleLMgUg1BFjw6WQLhZ9gG+nVgeHVaEYdEwFWKp78yu3mTy4TXvZgmy+i8/3SzRh4P7lNEqfjo4po5TKI9Q= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(366004)(39860400002)(396003)(376002)(451199015)(478600001)(31686004)(6486002)(86362001)(66476007)(2616005)(66556008)(66946007)(41300700001)(26005)(6512007)(8936002)(186003)(316002)(5660300002)(6916009)(4326008)(6506007)(2906002)(83380400001)(31696002)(8676002)(36756003)(38100700002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xNTeyGckTMzXdxrPPc7hpcZu5SDd?= =?utf-8?q?pgzdtm2lVLEf90t+NiYkoVefwxAQHbcR3HlenCt3g+HY679q0yW2gsuLVHTFPty4J?= =?utf-8?q?lN2W5rYrKApQTVuk48CHgXAgvy7pnvRbYCL1xW0KY2SGuiEzAfo/R9rZ7y0S0Jiiz?= =?utf-8?q?IZJHSbbP5labYd91vMuqmsIikctm9oigbqIIQ6SZvc3ElqL/BaWrUxzFLvbS/P7Be?= =?utf-8?q?Z8T5EJUsqV1jLqH96pj1IuXtvWFwgFLSRP5yfhXmGGt4x99+Ww13cRnTMOCPJ2DhW?= =?utf-8?q?9TCrNI1iyPKCHdHHe4NC7HBMBj1fWYlphupc2fEd+TwY5u6kJnLgEOxMfbSRfqX29?= =?utf-8?q?YhP2EyhXuWwl2tSxTmDqkYtUiQ+aL/FwE3j26oFovjIyiFTakxn4F+NB4FJxLQaZN?= =?utf-8?q?c5dsFql+bpxCn04C4f9KtVU3u4k1OUPjchEE2jH2TCIn0na2R9JSFAJ4CY77VmK8q?= =?utf-8?q?n62MBGqQsqVpjU/2ac1DxcdErkQS0lAcZdgoO5yhpxt353EY/LBmvn0ac7hv8meyN?= =?utf-8?q?UBnHjjZCb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wJJZtBTpS8+mRtjNPLiNQQOPN46cBf5pFPEtYKX5jFgjqmra0zkE?= =?utf-8?q?c7eprGL9rY3C2lihFwHFa61vSQ2E9tg/jd9ZJ9zaRZIawdAg/zIZ+Xvr6lorp0vwj?= =?utf-8?q?LIFXNZ5dBszq?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: a63a72af-9448-471a-b5da-08dac89fb1c0 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 13:29:03.5617 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: vXSSZDalhBVbkdxpyZ89p2Uu2ddfksoPyiYq/NMK8XwFrP4l3qnWw6MFIGkgLYfK7DrVcJe7wcwZhzEA1yJi0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7988 X-Spam-Status: No, score=-3029.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich 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?1749750127725138127?= X-GMAIL-MSGID: =?utf-8?q?1749750127725138127?= Unlike many other architectures, x86 does not share an opcode table between assembly and disassembly. Any consumer of libopcodes would only ever access one of the two. Since gas is the only consumer of the assembly data, move it there. While doing so mark respective entities "static" in i386-gen (we may want to do away with i386_regtab_size altogether). This also shrinks the number of relocations to be processed for libopcodes.so by about 30%. --- 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 --- a/opcodes/Makefile.am +++ b/opcodes/Makefile.am @@ -562,10 +562,9 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init < $(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 +# While not really dependencies, specify i386-{init,tbl}.h here as well to +# make sure they are re-generated as necessary. +i386-opc.lo: $(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) --- a/opcodes/Makefile.in +++ b/opcodes/Makefile.in @@ -1537,10 +1537,9 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init < $(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 +# While not really dependencies, specify i386-{init,tbl}.h here as well to +# make sure they are re-generated as necessary. +i386-opc.lo: $(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) --- a/opcodes/i386-gen.c +++ b/opcodes/i386-gen.c @@ -1816,7 +1816,7 @@ process_i386_opcodes (FILE *table) xcalloc, free); fprintf (table, "\n/* i386 opcode table. */\n\n"); - fprintf (table, "const insn_template i386_optab[] =\n{\n"); + fprintf (table, "static const insn_template i386_optab[] =\n{\n"); /* Put everything on opcode array. */ while (!feof (fp)) @@ -1946,7 +1946,7 @@ process_i386_registers (FILE *table) xstrerror (errno)); fprintf (table, "\n/* i386 register table. */\n\n"); - fprintf (table, "const reg_entry i386_regtab[] =\n{\n"); + fprintf (table, "static const reg_entry i386_regtab[] =\n{\n"); while (!feof (fp)) { @@ -2009,7 +2009,7 @@ process_i386_registers (FILE *table) fprintf (table, "};\n"); - fprintf (table, "\nconst unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);\n"); + fprintf (table, "\nstatic const unsigned int i386_regtab_size = ARRAY_SIZE (i386_regtab);\n"); } static void --- a/opcodes/i386-opc.c +++ b/opcodes/i386-opc.c @@ -21,7 +21,6 @@ #include "sysdep.h" #include "libiberty.h" #include "i386-opc.h" -#include "i386-tbl.h" /* To be indexed by segment register number. */ const unsigned char i386_seg_prefixes[] = { --- 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 @@ -990,8 +990,6 @@ typedef struct insn_template } insn_template; -extern const insn_template i386_optab[]; - /* these are for register name --> number & type hash lookup */ typedef struct { @@ -1012,6 +1010,4 @@ typedef struct } reg_entry; -extern const reg_entry i386_regtab[]; -extern const unsigned int i386_regtab_size; extern const unsigned char i386_seg_prefixes[6]; From patchwork Thu Nov 17 13:29:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 21663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp399132wrr; Thu, 17 Nov 2022 05:29:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf555jLmDly/DDwwMqygDiiI4YHbvDNkbeA3XtuPk++ZYKdCwVTQNiZlxOGUbJrF893Qm7si X-Received: by 2002:a17:906:708d:b0:7ad:b45c:dbe7 with SMTP id b13-20020a170906708d00b007adb45cdbe7mr2056407ejk.617.1668691794004; Thu, 17 Nov 2022 05:29:54 -0800 (PST) Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id cx27-20020a05640222bb00b00461b96334eesi721717edb.500.2022.11.17.05.29.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Nov 2022 05:29:53 -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=VBdI6Swm; arc=fail (signature failed); 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 2F5123AA803E for ; Thu, 17 Nov 2022 13:29:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2F5123AA803E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1668691792; bh=JoXbqPYlHofEfIQbYoKkcFyaHol3zF6eViy0Yzk7Svk=; h=Date:Subject:To:Cc:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=VBdI6SwmsnVGw9/bxWPIeE/6DFSDZZ8tKhm624AVNl6zRvCuwBR6VGhLA8xIJTVw0 nnae1FPn+NUAkaS4AkodrW/JHTdyhWLq7k4HsySLlrORB9BbNRGmgRz4f0adOBXPTn oQW3tfNFGO2hUQHbgpro3onHx3cLUtpFQwYrgSZc= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2079.outbound.protection.outlook.com [40.107.21.79]) by sourceware.org (Postfix) with ESMTPS id C12B639960EB for ; Thu, 17 Nov 2022 13:29:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C12B639960EB ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R0d6LgVJPiO3LFMxQrMxtpX675HCLkARlEapKUZOobRzvPLhgqxjj4wplvMxe5RNn/IkbMgE0qr2hABaGK6iRf71yFtFsfLQ+z0PLo5YqMpJnveNBpzCb/HKMo0C1+rRDmjTgTUQ62DJNQeOu4XAfN7tbD/iX5J7zDxBwTnhy2Vu1bfNN93SyhbkzSKDzrOotg6UGkvgBeS9xSFQEaMsaWN/+CDfCkLi1sAVDpsJu5zIeg0yhdEIxpoftEq80xZGbX+sS5DyczWQJLIy7hWWKUYkgoRKeMpUAp7rbLjqo5LNeoocLQ5nDLlA9k7YCq1JdGdcdX8zHFigOEUV+KE0oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JoXbqPYlHofEfIQbYoKkcFyaHol3zF6eViy0Yzk7Svk=; b=AnOzJg8IJicDgOYW0qq+B0ttufEbSFiq6wVvyNMZiMj0/yRFXH3JhdmIw/PShU9wIdvXEQNVFbofpondv0l2HTmDfx22ILWRsbG6mivNgshn7ielRy+l36kGhbB+se9rsFbqNUGDxYHPtjV6C164xv+MO38xdEfQ6+0TjMe3rtjItuRYDI91LNrdHozxlhTxfh5UxB1bgwMIysMcUvODDi7xYS7CWRRxIEiOgRkRCfd84m1SbZkdqXd/tClyLe/eUte/GQN/NcO4hsiMjwjXot8DSwz3R7v1Pc2V/HAsHjKhAiO8ls+ICGmiITmFwPqzNEgdTm0uLFXJJVJE8hJv9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Received: from VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) by AM8PR04MB7988.eurprd04.prod.outlook.com (2603:10a6:20b:24e::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5813.12; Thu, 17 Nov 2022 13:29:37 +0000 Received: from VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8]) by VE1PR04MB6560.eurprd04.prod.outlook.com ([fe80::4da2:ea8b:e71e:b8d8%4]) with mapi id 15.20.5813.018; Thu, 17 Nov 2022 13:29:37 +0000 Message-ID: Date: Thu, 17 Nov 2022 14:29:36 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: [PATCH 2/2] x86: break gas dependency on libopcodes Content-Language: en-US To: Binutils Cc: "H.J. Lu" References: <5c07cdb4-ec26-c7bf-087a-4d0c75ef8549@suse.com> In-Reply-To: <5c07cdb4-ec26-c7bf-087a-4d0c75ef8549@suse.com> X-ClientProxiedBy: FR2P281CA0166.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:99::13) To VE1PR04MB6560.eurprd04.prod.outlook.com (2603:10a6:803:122::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB6560:EE_|AM8PR04MB7988:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e0fe7ca-3fd6-43c3-0e91-08dac89fc615 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: j/mzcSz/vG0twUF6QeORpQtX6l7p/vVgfWW96GgRXDNxWaIlUxBhwmjqn9FcqYNz0MVFahEtttSFDaOP8p91Dqa0iiR+oh8sOIDwB/+JNNRzGBth1wNaBINk3ukJ1s8AIcXFeizaGC5XlWn2GKBKVDBnoa6CIh34jq2EMz64k0HaaPBuzUqW4nPq6ckPXHpW19nxNDlMwbnmV6ZX8BPMXo/ShrOPBGuKF0VmfjmTvrTWBkmIZfZInksF893HHh85YtknlYT59Cccd7op5Fkdc1ENvgHwKxo+uWRwvoY+Loag8TWUTr0gD3ruIZnfqG1qi74sqTxNoKcABaQbjr+mnyAV2wzNo/t89UgdK7MYjX69WzPSYaEXXkObC8ySTRsyWiHUq3qsze4h4xrZ9YYirxfGjYyKFlN5t5/22SIVa3mAmOCwEycpfz+aHmfKGbhoTa8Wr0Eeu4d+KJrNEPjp6XI5LOHbB6VA6O7BDXCN2U10OEv3f7/Z7+BhelkNUM0rwO834lOYUZBOECum2jg2MCUAkXv2bOUqyh77wwHLNTWs3TV4li2gVxDeygNf6mkVDX7Ja5kuViGK7sLEKMx0Cg6kWQVrLwa/wWgoIafRwwwFod9S7BC/Jxw2avExE+tV4TWE+ZNDNi23eO9GLJ+Rh1/DGuMYSskQ9JW5g5Ba96EOxGrYLokrf5QXz/alxjy4yTHJC6qTw61roNDGeaiQ9/MkmdFcET9aa1v7VmVxxecYzDRvejfRgrCiDo0tLGvH X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR04MB6560.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(136003)(346002)(366004)(39860400002)(396003)(376002)(451199015)(478600001)(31686004)(6486002)(86362001)(66476007)(2616005)(66556008)(66946007)(41300700001)(26005)(6512007)(8936002)(186003)(316002)(5660300002)(6916009)(4326008)(6506007)(2906002)(31696002)(8676002)(36756003)(38100700002)(2004002)(45980500001)(43740500002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?xBCJSmHzTktffwija4BXGb7wFMz/?= =?utf-8?q?4GNS9MztWoeCm61z5lYvtSfZZionJbbpfqSN0VqadZs3ubSTI6CwbnWMgCpclppEC?= =?utf-8?q?KueYWuke0O4eeu1GdIWC/eIEbldTq/AVkP3+OrRiGmcj7j69opU5HimJXCKtYUPRu?= =?utf-8?q?HhkVtBgqF/nyKCJWlgptTf1AlNb/jGD6f7Z5AqZDZrCCWLPb239pq5t0m0axuvN8Z?= =?utf-8?q?oUaw76myLsGc+JWa8s6psXZn418Uc5hgXCdV8lNAxywbuwgWZFy1jYukIi9cNaxTX?= =?utf-8?q?XkH3JJOySZexRzjn28oudY/R2HS2zqisgPmwTm0Im89/QlIciQL0pr4ztoCHazym9?= =?utf-8?q?PLO6x1t662bpBRmownylqRaRabwMZzxFcoZpFXTd7jAOamNCqnDd+V82gxpOjAKPh?= =?utf-8?q?izvljR2zBwtTBDm165Npj2hZMPHqd4xt1YCXbO07argvgCFseTQZnABAsXgs/kUB3?= =?utf-8?q?J1o/kp634Mpc7XHThWk0+zVWdxAdEwjo1WUb1/cTd+io+vi8vPTOCH4D0nuck0Er3?= =?utf-8?q?K/uwK/OQmUuBuLAcBIM79WIs/jJ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/EdHKdA7WxVrmtxZTcCMNoXVk402lVxKgLiE3ic?= =?utf-8?q?H3g61OEGTg+V8TPLDQAC8eFWptBT5sLUKs8P4M91do3OHUTUDdNK8kOq0W1SQyZQ7?= =?utf-8?q?QwoGVUsN7EAq?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0fe7ca-3fd6-43c3-0e91-08dac89fc615 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6560.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2022 13:29:37.6064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: mm4QQLdjoN405bYvyQEslfptonpAC+JlmPnR6+UhkJD2AWjpwE1LUZv91WNkJ404otPm3iNtX38d5KQE9JvMZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7988 X-Spam-Status: No, score=-3029.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, 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: Jan Beulich via Binutils From: Jan Beulich Reply-To: Jan Beulich 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?1749750038739366062?= X-GMAIL-MSGID: =?utf-8?q?1749750166928224426?= The only item gas still consumes from libopcodes is i386_seg_prefixes[], which again is used by gas alone. Move it into the assembler, allowing to remove the linking in of libopcodes. To compensate, tie table generation in opcodes/ to the building of i386-dis.o, despite the file not really depending on the generated data. --- RFC: Is there a better way to specify extra dependencies, such that table generation and compilation of i386-dis.c could be kept separate (and hence processable in parallel)? --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -445,6 +445,16 @@ struct _i386_insn typedef struct _i386_insn i386_insn; +/* To be indexed by segment register number. */ +static const unsigned char i386_seg_prefixes[] = { + ES_PREFIX_OPCODE, + CS_PREFIX_OPCODE, + SS_PREFIX_OPCODE, + DS_PREFIX_OPCODE, + FS_PREFIX_OPCODE, + GS_PREFIX_OPCODE +}; + /* Link RC type with corresponding string, that'll be looked for in asm. */ struct RC_name --- a/gas/configure +++ b/gas/configure @@ -12263,7 +12263,7 @@ _ACEOF # Do we need the opcodes library? case ${cpu_type} in - vax | tic30) + vax | tic30 | i386) ;; *) --- 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) + vax | tic30 | i386) ;; *) --- 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 \ @@ -564,7 +563,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init # While not really dependencies, specify i386-{init,tbl}.h here as well to # make sure they are re-generated as necessary. -i386-opc.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h +i386-dis.lo: $(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) --- 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@ @@ -1539,7 +1537,7 @@ $(srcdir)/i386%tbl.h $(srcdir)/i386%init # While not really dependencies, specify i386-{init,tbl}.h here as well to # make sure they are re-generated as necessary. -i386-opc.lo: $(srcdir)/i386-tbl.h $(srcdir)/i386-init.h +i386-dis.lo: $(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) --- a/opcodes/i386-opc.c +++ /dev/null @@ -1,33 +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" - -/* To be indexed by segment register number. */ -const unsigned char i386_seg_prefixes[] = { - ES_PREFIX_OPCODE, - CS_PREFIX_OPCODE, - SS_PREFIX_OPCODE, - DS_PREFIX_OPCODE, - FS_PREFIX_OPCODE, - GS_PREFIX_OPCODE -}; --- a/opcodes/i386-opc.h +++ b/opcodes/i386-opc.h @@ -1003,5 +1003,3 @@ typedef struct #define Dw2Inval (-1) } reg_entry; - -extern const unsigned char i386_seg_prefixes[6];