From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.com 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PCzj7uJMgKixj0A5TrUnr4gdBK7nfmlRkGCV5kjI4mM=; b=M8mGzGaikQJboIhIoZoAT7yLPyaEI7xbpz0F8ce/kDqg5jJsMP/m5quUs7vXuIZ97/W61FnlBJHMYRaFddVl+1u28H9F6YaOhkgmHcEcHNPp89IQWSjSbQKtLVuavpmIKG84XmbU3t0SHOTECqkj+YXZGzzjo0Bl4rpxbXrsBHUCxhuJ6zkNFt5xUQZ1bbedeT4iIxoXbK/wd/wPTNrY35Ab8/LuikZeAuTqHN7JJrmvH7sEZyEM8ugkamuIRloqc+/GcK3i3oiUFfeXfDsZhbkCMaAIj5QblB4BBRKb0QPi8HoWqnqMwzYSzxtt1HucsYU0UEbwRU8ltiLZWjuUfA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; 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> From: Jan Beulich In-Reply-To: <5c07cdb4-ec26-c7bf-087a-4d0c75ef8549@suse.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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?B?eE5UZXlHY2tUTXpYZHhyUFBjN2hwY1p1NVNEZHBnemR0bTJsVkxFZjkwdCtO?= =?utf-8?B?aVlrb1ZlZnd4QVFIYmNSM0hsZW5DdDNnK0hZNjc5cTB5VzJnc3VMVkhURlB0?= =?utf-8?B?eTRKbE4yVzVyWXJLQXBRVFZ1azQ4Q0hnWEFndnk3cG52UmJZQ0wxeFcwS1ky?= =?utf-8?B?U0d1aUV6QWZvL1I5clo3eTBTMEppaXpJWkpIU2JiUDVsYWJZZDkxdk11cW1z?= =?utf-8?B?SWlrY3RtOW9pZ2JxSUlRNlNadmMz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6a0VjN2VwckdM?= =?utf-8?B?OXJZM0MybGloRndIRmE2MXZTUTJFOXRnL2pkOVpKOXphUlpJYXdkQWcvekla?= =?utf-8?Q?+Xvr6lorp0vwjLIFXNZ5dBszq?= 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 List-Id: 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];