From patchwork Fri Jul 21 07:49:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Iannetta X-Patchwork-Id: 123632 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp38422vqg; Fri, 21 Jul 2023 00:53:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlF2GU/bhiAhG4duA9q01OtsxQiSLAL1flnyZeuThDjgU5YSHgXDNKudLlaxTJQeyuCn8RCJ X-Received: by 2002:a17:906:7386:b0:993:dd1d:824d with SMTP id f6-20020a170906738600b00993dd1d824dmr1203270ejl.19.1689926016839; Fri, 21 Jul 2023 00:53:36 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g8-20020a170906594800b009936f6d726fsi1888695ejr.169.2023.07.21.00.53.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 00:53:36 -0700 (PDT) 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=lHpysN7G; 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 734593850210 for ; Fri, 21 Jul 2023 07:52:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 734593850210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689925929; bh=h0+y+41J5KgY0xOOAnGEMKw1hXltFtyY4JaBPpxaH6g=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=lHpysN7GisMoUTzR6Wu/c3g1OUsiC2+Gd6SP16BCoSWpap6R93wreD6MA0OmJmpHc I7HYWaCCqnYzN8mpRAr799MJh3SorPkfi7AYVbYBIOJAZbIn5su/tiH6HUbvxtdyJM edq3/oP6lKjH6erf3OoStbjTC87H7bT1tQlHTrp8= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id AB8BA385DC30 for ; Fri, 21 Jul 2023 07:50:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AB8BA385DC30 Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 7E614349601 for ; Fri, 21 Jul 2023 09:50:18 +0200 (CEST) Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 57293349553 for ; Fri, 21 Jul 2023 09:50:18 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01lp0108.outbound.protection.outlook.com [104.47.25.108]) by fx409.security-mail.net (Postfix) with ESMTPS id 14ADC3495C2 for ; Fri, 21 Jul 2023 09:50:10 +0200 (CEST) Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) by MR1P264MB1731.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 07:50:08 +0000 Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d]) by MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d%7]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 07:50:08 +0000 X-Virus-Scanned: E-securemail Secumail-id: <12564.64ba38b2.c1d63.1> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m3E6P6FW4e6mhzES72NECCgiQ9Qlj+/gJBh8eqpf8e1S3om4/yjw7476S7XIBMo3dBfDHr5neYjdWwWWnm6adfSOfQ5Vl5Rjg7G7ysL+3H0adSM9y0L1P3c9goPUJGOs2gk+yAvcyrjF5poJewoDvMVelXiyutc/zEyrg/VN3koPl6abPIM/C8AK2E+ApHFiEncXJBEmYEiX7/r9eWRDoAvdqXkR95OqhIv9x5kMoVze3KXCVNe71IGZ/LvCzE1GhLKeKiMS40kuwLXRVHJiJeQ8XfXHbXPCi43ze7y+ijSoWxyRO23uoy0Sq2+jiW6i1cVzcJ5PLUDh4xP4rVO1rQ== 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=h0+y+41J5KgY0xOOAnGEMKw1hXltFtyY4JaBPpxaH6g=; b=CVOH3tzecAKnuU1/n9hBc6AIA/vQnrTdeZX0d2ZizkLK7NJUhjI+BY5wP5y4ZIcKLHr2X52bvgIJDVHvVPLnvbKLKTqcTyA75uTF/ADQvStUqgJd55MnHSTPEv1XvS83BxKj2eiDSYmedxEZurHcfyYAum2Pn2v0SW6UUGSLc7WUrkWRV+0k2vf/D6a1wwBNTUxaorzcA3UuqlcTq/1Gbr0hbKfkIXhb8s1dFa0sE36Ccbu7QiFE1FNF9VWCP5nb5u5fFLOXFtfAjnD/BbkWlh7XXCXE3vYI3PiHRyqR/i9qHblUyssJT1Ymj1wusXyeU7MmUdryyl55OGFjIg1qOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none To: binutils@sourceware.org Cc: Paul Iannetta Subject: [PATCH 1/7] kvx: Add bf files. Date: Fri, 21 Jul 2023 09:49:50 +0200 Message-ID: <20230721074956.7188-2-piannetta@kalrayinc.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230721074956.7188-1-piannetta@kalrayinc.com> References: <20230721074956.7188-1-piannetta@kalrayinc.com> X-ClientProxiedBy: LO4P265CA0044.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::23) To MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2482:EE_|MR1P264MB1731:EE_ X-MS-Office365-Filtering-Correlation-Id: 22e4f145-d891-42a5-602b-08db89bf1a76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7UjznYDpw5Mr6jV6TPcX8E2kcxOMqa4M1CGQvz3yi66+Rr0oT8mFY/1Dc9mOGVL/TwuxP9i3T8rJgmx8osnuijxEs9ey4AzWR6+FSSGZczm8NVUozITDs9rR43HJbmP1lbfBK1FF4Cl8Lspm8QhRPOUxGH2y4dtqn2B8tKzTa1jCTCxdBboBuQnGDRacjdARGjK7IDC866yfHaMGBd4QW9ShTiGzPmwjzMJ4Vz5wAdd2VwxXtMSveap2K+S4cBf1XylaKOmymQtxcHtT6Pqig+MU9cRlfQ0xsycdTlysfbFjSvCHCGWCU4vl+Tq4wkOcQbPd3T/1nOW/3s1iCHqDcZ4PJArlJyCJ9N3c+44fEZ15jbdW+UceGPQuH2xCuzRZJeeKt1lKL5G2dDJQ7I20FQqwwA6xiUJXSbWcWIsj0f1Zo09L34Z0IQ9+Y0kMUPvjgXSN3ckiK7tHOVDy6d6Y7fGQszlQVW+LcIaCR/8daP0MwhEz+x6MuwgrivMa51sKCbbb026xUx7ZazIs47D+ZAfhvdLxbEkBO8bLSPf8myakuA4Ca+VsmiuV2aGhv6JVHVP3nvw0LE8Siw3izER2q2CdGpGXariQohwmcYAd3sqWEz4EW43fk5KlFhgUkW0s X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(39850400004)(346002)(376002)(451199021)(6666004)(6486002)(478600001)(83380400001)(6916009)(26005)(6506007)(1076003)(107886003)(6512007)(4326008)(38100700002)(66556008)(66476007)(66946007)(186003)(2616005)(5660300002)(8676002)(30864003)(8936002)(2906002)(41300700001)(316002)(86362001)(36756003)(2004002)(21314003)(579004)(559001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sSGHWtj/ehBIVs7UKVetaO6ZHs7xMUr8IYczZaRWtSmD2tR+UzpjNHhLGaj7HFJjvHMtmzvEJUaB6hePmyky8HpNnE7VVpdKhjnjE2LUzw9Lb2XMx6BOmZRM+zmjvc0ltOQ2Kuy46gpvLvn7VdsIkC2Fe/mpvptlckQ7Dc0J2T4a/8M2YOrLk/x9dX6nWHfIdkzl5TnexJxXmUYX34qVWTLzMQda9M6qhaEyxV/sEN8ajJ4i+qxa0tfxLbAoKRkK3fWHPUPMKqrlxHz0Mf3gs7ecPfVYKVbH2DCksNLhIL7IjEkZ5ZKwPWvCw50wYgxUnTiNql6AIKhOiUwfbOmqQhvNrWgQKg+luEkZvkkwrxeafupqFasl8FiVH+pi/XEER4fRIit3gGWMj1zPxVG3w9KbByC+ZokKMWgRf3RFxv1p9oSdGmkzh6goDUAhqqgmJDApj6ZcfwOppRHj2/7fV4GjO9zkxyfurFaQPr+qqibq03ImkuVKK+9bjA/pvYF6yRi9yty9NnUNqHuLi0ZlB0oHf0aLpWSQJtmHp6yztbA3HZU6D2c47I8SB8Gl0epo94chA6mHnN6f1Usd7mWyWDffyChwTumL2xGlV/omKXvvoW5ybBEmVb3jZDRcNY152QMLHKNaew0MO/hz4C+LlCFOcrSYdTjtnXhcjHiQnEH7TPRS87P7fqZpqhgxdNM6sJU2pIFl6+GvNMuFXernzgvdNupBzFh7hZc8cLQSDsbmkHWWfa/xch5OvGccY8rLkpwzdfr5dfHEgg88NCp/qkJqwDoxxDyVoKTH+c4+YIrDT3dcPAsW+7LsGXnsb3XjhHc9esBdVMfRRa+Ze910bjrQ/cufmv8u4BCauuHriXdfDoSr+HIxtiDkuKBmcxDskGcKkSyvTbi+EN1yXNYBiEtXAAy8JlYIWSyndvjDfbb+U3VTSMuTt690rwS0vEgF bBZ9k3YKmdSI6uHC2q5Si6fE9eSBncC3NS+2ELrucb+lsY/OCrfGCooUVYXsezU4GHf72mB4ObeKxiL3okOaGY4jLr7ZV0BxNfGJXnY0hEeV+lfP9ZRfLvcF3kX6moqT42GtzoGnQj9TTwoZdr3mfxueJcZ8Fzd7wpOGIcXEWQpJI99AEJou+Gdno+mPkyn6vYI3CBYJweoX+eFjN06gFUjpON8cuVUXENqqjT9p4xOWn3LKoAu8L7NtzXrhAEEKkI2P+Hps+nzpvEpphENICXGQrEX4IMR/3SjbnjKb2ldqEgRWH74LmpBtdLsW0zNwwGte1nAqII/Rb3nKRLq+68E0RMRr+NRCv+A76B5Gx5jfftoiKk98QNt6hJXseCqK/54RUdEv7HNvTX2BD9mEhrAx+3dpdxgnDGMjlAJqmHLAEt9ObEGAwB5ie6RQ9iDtEkiZBLRER71ExVENEmnhhkROGjOT2acyyDYlNNeD44kR7SPFePMUhOvcgf+Je7qLoNjHPXXsATWclrtzFVMElrXieLCQPPHpAGJQzacVLD83m4GEHYzjh0DsdUTJurwlKDvxhjKi5EvaSD3D5SNxIrDQAP0TohqZA0gVHto2lTabN4vmCN1N790fWjITYvJ4bZ9zZwSZSN1qQQPAsRdodA== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 22e4f145-d891-42a5-602b-08db89bf1a76 X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 07:50:08.0846 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9Z06j/9+X/Z11ZMlrPPxCHbMwUul2zfpgLyyVIhxRfPxMLgVPWSjqxwkTBNihkRiNMZYWffRX1amiRRvxtYb+w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1731 X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Paul Iannetta via Binutils From: Paul Iannetta Reply-To: Paul Iannetta Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772015863038214061 X-GMAIL-MSGID: 1772015863038214061 bfd/ChangeLog: 2023-07-20 Paul Iannetta * Makefile.am (ALL_MACHINES): Add cpu-kvx.lo. (ALL_MACHINES_CFILES): Add cpu-kvx.c. (BFD32_BACKENDS): Add elf32-kvx.lo, elfxx-kvx.lo. (BFD32_BACKENDS_CFILES): Add elfxx-kvx.c. (BFD64_BACKENDS): Add elfxx-kvx.lo. (BFD64_BACKENDS_CFILES): Add elfxx-kvx.c. (BUILD_CFILES): Add elf32-kvx.c elf64-kvx.c. * Makefile.in: Regenerate. * archures.c (bfd_architecture): Define bfd_mach_kv3_unknown, bfd_mach_kv3_1, bfd_mach_kv3_1_64, bfd_mach_kv3_1_usr, bfd_mach_kv3_2, bfd_mach_kv3_2_64, bfd_mach_kv3_2_usr, bfd_mach_kv4_1, bfd_mach_kv4_1_64, bfd_mach_kv4_1_usr. (bfd_arch_info): Add bfd_kvx_arch. (bfd_archures_list): Add bfd_kvx_arch. * bfd-in2.h: Regenerate. * config.bfd: Handle kvx-*-* and kvx-*-linux* * configure: Regenerate. * configure.ac: Handle kvx_elf32_vec, kvx_elf64_vec, kvx_elf64_linux_vec. * cpu-kvx.c: New file. * elf-bfd.h (enum elf_target_id): Define KVX_ELF_DATA. * elfnn-kvx.c: New file. * elfxx-kvx-relocs.h: New file. * elfxx-kvx.c: New file. * elfxx-kvx.h: New file. * libbfd.h: Regenerate. * po/BLD-POTFILES.in: Add elf32-kvx.c, elf64-kvx.c. * po/SRC-POTFILES.in: Add cpu-kvx.c, elfxx-kvx.c. * reloc.c: Add BFD_RELOC_KVX_{NONE, 16, 32, 64, S16_PCREL, PCREL17, PCREL27, 32_PCREL, S37_PCREL_LO10, S37_PCREL_UP27, S43_PCREL_LO10, S43_PCREL_UP27, S43_PCREL_EX6, S64_PCREL_LO10, S64_PCREL_UP27, S64_PCREL_EX27, 64_PCREL, S16, S32_LO5, S32_UP27, S37_LO10, S37_UP27, S37_GOTOFF_LO10, S37_GOTOFF_UP27, S43_GOTOFF_LO10, S43_GOTOFF_UP27, S43_GOTOFF_EX6, 32_GOTOFF, 64_GOTOFF, 32_GOT, S37_GOT_LO10, S37_GOT_UP27, S43_GOT_LO10, S43_GOT_UP27, S43_GOT_EX6, 64_GOT, GLOB_DAT, COPY, JMP_SLOT, RELATIVE, S43_LO10, S43_UP27, S43_EX6, S64_LO10, S64_UP27, S64_EX27, S37_GOTADDR_LO10, S37_GOTADDR_UP27, S43_GOTADDR_LO10, S43_GOTADDR_UP27, S43_GOTADDR_EX6, S64_GOTADDR_LO10, S64_GOTADDR_UP27, S64_GOTADDR_EX27, 64_DTPMOD, 64_DTPOFF, S37_TLS_DTPOFF_LO10, S37_TLS_DTPOFF_UP27, S43_TLS_DTPOFF_LO10, S43_TLS_DTPOFF_UP27, S43_TLS_DTPOFF_EX6, S37_TLS_GD_LO10, S37_TLS_GD_UP27, S43_TLS_GD_LO10, S43_TLS_GD_UP27, S43_TLS_GD_EX6, S37_TLS_LD_LO10, S37_TLS_LD_UP27, S43_TLS_LD_LO10, S43_TLS_LD_UP27, S43_TLS_LD_EX6, 64_TPOFF, S37_TLS_IE_LO10, S37_TLS_IE_UP27, S43_TLS_IE_LO10, S43_TLS_IE_UP27, S43_TLS_IE_EX6, S37_TLS_LE_LO10, S37_TLS_LE_UP27, S43_TLS_LE_LO10, S43_TLS_LE_UP27, S43_TLS_LE_EX6, 8}. * targets.c (kvx_elf32_vec): Declare. (kvx_elf64_vec): Declare. (kvx_elf64_linux_vec): Declare. (_bfd_target_vector): Add kvx_elf32_vec, kvx_elf64_vec, kvx_elf64_linux_vec. --- bfd/Makefile.am | 20 + bfd/Makefile.in | 25 + bfd/archures.c | 13 + bfd/bfd-in2.h | 111 + bfd/config.bfd | 16 + bfd/configure | 3 + bfd/configure.ac | 3 + bfd/cpu-kvx.c | 124 ++ bfd/elf-bfd.h | 1 + bfd/elfnn-kvx.c | 4798 ++++++++++++++++++++++++++++++++++++++++ bfd/elfxx-kvx-relocs.h | 1105 +++++++++ bfd/elfxx-kvx.c | 218 ++ bfd/elfxx-kvx.h | 71 + bfd/libbfd.h | 85 + bfd/po/BLD-POTFILES.in | 2 + bfd/po/SRC-POTFILES.in | 2 + bfd/reloc.c | 186 +- bfd/targets.c | 10 + 18 files changed, 6792 insertions(+), 1 deletion(-) create mode 100644 bfd/cpu-kvx.c create mode 100644 bfd/elfnn-kvx.c create mode 100644 bfd/elfxx-kvx-relocs.h create mode 100644 bfd/elfxx-kvx.c create mode 100644 bfd/elfxx-kvx.h diff --git a/bfd/Makefile.am b/bfd/Makefile.am index 5c5fdefd3b8..5fc2b822974 100644 --- a/bfd/Makefile.am +++ b/bfd/Makefile.am @@ -122,6 +122,7 @@ ALL_MACHINES = \ cpu-ip2k.lo \ cpu-iq2000.lo \ cpu-lm32.lo \ + cpu-kvx.lo \ cpu-loongarch.lo \ cpu-m10200.lo \ cpu-m10300.lo \ @@ -201,6 +202,7 @@ ALL_MACHINES_CFILES = \ cpu-hppa.c \ cpu-i386.c \ cpu-iamcu.c \ + cpu-kvx.c \ cpu-ia64.c \ cpu-ip2k.c \ cpu-iq2000.c \ @@ -317,6 +319,8 @@ BFD32_BACKENDS = \ elfxx-x86.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ + elf32-kvx.lo \ + elfxx-kvx.lo \ elf32-lm32.lo \ elf32-m32c.lo \ elf32-m32r.lo \ @@ -452,6 +456,7 @@ BFD32_BACKENDS_CFILES = \ elfxx-x86.c \ elf32-ip2k.c \ elf32-iq2000.c \ + elfxx-kvx.c \ elf32-lm32.c \ elf32-m32c.c \ elf32-m32r.c \ @@ -556,6 +561,7 @@ BFD64_BACKENDS = \ elf64-ia64.lo \ elf64-ia64-vms.lo \ elfxx-ia64.lo \ + elfxx-kvx.lo \ elf32-loongarch.lo \ elf64-loongarch.lo \ elfxx-loongarch.lo \ @@ -618,6 +624,7 @@ BFD64_BACKENDS_CFILES = \ elfn32-mips.c \ elfxx-aarch64.c \ elfxx-ia64.c \ + elfxx-kvx.c \ elfxx-loongarch.c \ elfxx-mips.c \ elfxx-riscv.c \ @@ -681,6 +688,7 @@ SOURCE_CFILES = \ BUILD_CFILES = \ elf32-aarch64.c elf64-aarch64.c \ + elf32-kvx.c elf64-kvx.c \ elf32-ia64.c elf64-ia64.c \ elf32-loongarch.c elf64-loongarch.c \ elf32-riscv.c elf64-riscv.c \ @@ -850,6 +858,18 @@ elf64-ia64.c : elfnn-ia64.c $(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@ $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@ +elf32-kvx.c : elfnn-kvx.c + rm -f elf32-kvx.c + echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf32-kvx.new + sed -e s/NN/32/g < $(srcdir)/elfnn-kvx.c >> elf32-kvx.new + mv -f elf32-kvx.new elf32-kvx.c + +elf64-kvx.c : elfnn-kvx.c + rm -f elf64-kvx.c + echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf64-kvx.new + sed -e s/NN/64/g < $(srcdir)/elfnn-kvx.c >> elf64-kvx.new + mv -f elf64-kvx.new elf64-kvx.c + elf32-loongarch.c : elfnn-loongarch.c $(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@ $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@ diff --git a/bfd/Makefile.in b/bfd/Makefile.in index 4edfedee924..c80fba86a0b 100644 --- a/bfd/Makefile.in +++ b/bfd/Makefile.in @@ -468,6 +468,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -573,6 +574,7 @@ ALL_MACHINES = \ cpu-hppa.lo \ cpu-i386.lo \ cpu-iamcu.lo \ + cpu-kvx.lo \ cpu-ia64.lo \ cpu-ip2k.lo \ cpu-iq2000.lo \ @@ -656,6 +658,7 @@ ALL_MACHINES_CFILES = \ cpu-hppa.c \ cpu-i386.c \ cpu-iamcu.c \ + cpu-kvx.c \ cpu-ia64.c \ cpu-ip2k.c \ cpu-iq2000.c \ @@ -773,6 +776,8 @@ BFD32_BACKENDS = \ elfxx-x86.lo \ elf32-ip2k.lo \ elf32-iq2000.lo \ + elf32-kvx.lo \ + elfxx-kvx.lo \ elf32-lm32.lo \ elf32-m32c.lo \ elf32-m32r.lo \ @@ -908,6 +913,7 @@ BFD32_BACKENDS_CFILES = \ elfxx-x86.c \ elf32-ip2k.c \ elf32-iq2000.c \ + elfxx-kvx.c \ elf32-lm32.c \ elf32-m32c.c \ elf32-m32r.c \ @@ -1013,6 +1019,7 @@ BFD64_BACKENDS = \ elf64-ia64.lo \ elf64-ia64-vms.lo \ elfxx-ia64.lo \ + elfxx-kvx.lo \ elf32-loongarch.lo \ elf64-loongarch.lo \ elfxx-loongarch.lo \ @@ -1075,6 +1082,7 @@ BFD64_BACKENDS_CFILES = \ elfn32-mips.c \ elfxx-aarch64.c \ elfxx-ia64.c \ + elfxx-kvx.c \ elfxx-loongarch.c \ elfxx-mips.c \ elfxx-riscv.c \ @@ -1137,6 +1145,7 @@ SOURCE_CFILES = \ BUILD_CFILES = \ elf32-aarch64.c elf64-aarch64.c \ + elf32-kvx.c elf64-kvx.c \ elf32-ia64.c elf64-ia64.c \ elf32-loongarch.c elf64-loongarch.c \ elf32-riscv.c elf64-riscv.c \ @@ -1483,6 +1492,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-iamcu.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-ip2k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-iq2000.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-kvx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-lm32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-loongarch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpu-m10200.Plo@am__quote@ @@ -1577,6 +1587,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ia64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-ip2k.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-iq2000.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-kvx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-lm32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-loongarch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf32-m32c.Plo@am__quote@ @@ -1629,6 +1640,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-hppa.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64-vms.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-ia64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-kvx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-loongarch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mips.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elf64-mmix.Plo@am__quote@ @@ -1644,6 +1656,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfn32-mips.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-aarch64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-ia64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-kvx.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-loongarch.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-mips.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfxx-riscv.Plo@am__quote@ @@ -2348,6 +2361,18 @@ elf64-ia64.c : elfnn-ia64.c $(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@ $(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@ +elf32-kvx.c : elfnn-kvx.c + rm -f elf32-kvx.c + echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf32-kvx.new + sed -e s/NN/32/g < $(srcdir)/elfnn-kvx.c >> elf32-kvx.new + mv -f elf32-kvx.new elf32-kvx.c + +elf64-kvx.c : elfnn-kvx.c + rm -f elf64-kvx.c + echo "#line 1 \"$(srcdir)/elfnn-kvx.c\"" > elf64-kvx.new + sed -e s/NN/64/g < $(srcdir)/elfnn-kvx.c >> elf64-kvx.new + mv -f elf64-kvx.new elf64-kvx.c + elf32-loongarch.c : elfnn-loongarch.c $(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@ $(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@ diff --git a/bfd/archures.c b/bfd/archures.c index 5a2a76c3de1..b59979e60ac 100644 --- a/bfd/archures.c +++ b/bfd/archures.c @@ -515,6 +515,17 @@ DESCRIPTION . bfd_arch_lm32, {* Lattice Mico32. *} .#define bfd_mach_lm32 1 . bfd_arch_microblaze,{* Xilinx MicroBlaze. *} +. bfd_arch_kvx, {* Kalray VLIW core of the MPPA processor family *} +.#define bfd_mach_kv3_unknown 0 +.#define bfd_mach_kv3_1 1 +.#define bfd_mach_kv3_1_64 2 +.#define bfd_mach_kv3_1_usr 3 +.#define bfd_mach_kv3_2 4 +.#define bfd_mach_kv3_2_64 5 +.#define bfd_mach_kv3_2_usr 6 +.#define bfd_mach_kv4_1 7 +.#define bfd_mach_kv4_1_64 8 +.#define bfd_mach_kv4_1_usr 9 . bfd_arch_tilepro, {* Tilera TILEPro. *} . bfd_arch_tilegx, {* Tilera TILE-Gx. *} .#define bfd_mach_tilepro 1 @@ -642,6 +653,7 @@ extern const bfd_arch_info_type bfd_iamcu_arch; extern const bfd_arch_info_type bfd_ia64_arch; extern const bfd_arch_info_type bfd_ip2k_arch; extern const bfd_arch_info_type bfd_iq2000_arch; +extern const bfd_arch_info_type bfd_kvx_arch; extern const bfd_arch_info_type bfd_lm32_arch; extern const bfd_arch_info_type bfd_loongarch_arch; extern const bfd_arch_info_type bfd_m32c_arch; @@ -730,6 +742,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] = &bfd_ia64_arch, &bfd_ip2k_arch, &bfd_iq2000_arch, + &bfd_kvx_arch, &bfd_lm32_arch, &bfd_loongarch_arch, &bfd_m32c_arch, diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 1b9a801966c..e2ddcb8dedc 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -1771,6 +1771,17 @@ enum bfd_architecture bfd_arch_lm32, /* Lattice Mico32. */ #define bfd_mach_lm32 1 bfd_arch_microblaze,/* Xilinx MicroBlaze. */ + bfd_arch_kvx, /* Kalray VLIW core of the MPPA processor family */ +#define bfd_mach_kv3_unknown 0 +#define bfd_mach_kv3_1 1 +#define bfd_mach_kv3_1_64 2 +#define bfd_mach_kv3_1_usr 3 +#define bfd_mach_kv3_2 4 +#define bfd_mach_kv3_2_64 5 +#define bfd_mach_kv3_2_usr 6 +#define bfd_mach_kv4_1 7 +#define bfd_mach_kv4_1_64 8 +#define bfd_mach_kv4_1_usr 9 bfd_arch_tilepro, /* Tilera TILEPro. */ bfd_arch_tilegx, /* Tilera TILE-Gx. */ #define bfd_mach_tilepro 1 @@ -6497,6 +6508,106 @@ value in two words (with an imm instruction). The relocation is relative offset from start of TEXT. */ BFD_RELOC_MICROBLAZE_64_TEXTREL, +/* KVX pseudo relocation code to mark the start of the KVX +relocation enumerators. N.B. the order of the enumerators is +important as several tables in the KVX bfd backend are indexed +by these enumerators; make sure they are all synced."; */ + BFD_RELOC_KVX_RELOC_START, + +/* KVX null relocation code. */ + BFD_RELOC_KVX_NONE, + +/* KVX Relocations. */ + BFD_RELOC_KVX_16, + BFD_RELOC_KVX_32, + BFD_RELOC_KVX_64, + BFD_RELOC_KVX_S16_PCREL, + BFD_RELOC_KVX_PCREL17, + BFD_RELOC_KVX_PCREL27, + BFD_RELOC_KVX_32_PCREL, + BFD_RELOC_KVX_S37_PCREL_LO10, + BFD_RELOC_KVX_S37_PCREL_UP27, + BFD_RELOC_KVX_S43_PCREL_LO10, + BFD_RELOC_KVX_S43_PCREL_UP27, + BFD_RELOC_KVX_S43_PCREL_EX6, + BFD_RELOC_KVX_S64_PCREL_LO10, + BFD_RELOC_KVX_S64_PCREL_UP27, + BFD_RELOC_KVX_S64_PCREL_EX27, + BFD_RELOC_KVX_64_PCREL, + BFD_RELOC_KVX_S16, + BFD_RELOC_KVX_S32_LO5, + BFD_RELOC_KVX_S32_UP27, + BFD_RELOC_KVX_S37_LO10, + BFD_RELOC_KVX_S37_UP27, + BFD_RELOC_KVX_S37_GOTOFF_LO10, + BFD_RELOC_KVX_S37_GOTOFF_UP27, + BFD_RELOC_KVX_S43_GOTOFF_LO10, + BFD_RELOC_KVX_S43_GOTOFF_UP27, + BFD_RELOC_KVX_S43_GOTOFF_EX6, + BFD_RELOC_KVX_32_GOTOFF, + BFD_RELOC_KVX_64_GOTOFF, + BFD_RELOC_KVX_32_GOT, + BFD_RELOC_KVX_S37_GOT_LO10, + BFD_RELOC_KVX_S37_GOT_UP27, + BFD_RELOC_KVX_S43_GOT_LO10, + BFD_RELOC_KVX_S43_GOT_UP27, + BFD_RELOC_KVX_S43_GOT_EX6, + BFD_RELOC_KVX_64_GOT, + BFD_RELOC_KVX_GLOB_DAT, + BFD_RELOC_KVX_COPY, + BFD_RELOC_KVX_JMP_SLOT, + BFD_RELOC_KVX_RELATIVE, + BFD_RELOC_KVX_S43_LO10, + BFD_RELOC_KVX_S43_UP27, + BFD_RELOC_KVX_S43_EX6, + BFD_RELOC_KVX_S64_LO10, + BFD_RELOC_KVX_S64_UP27, + BFD_RELOC_KVX_S64_EX27, + BFD_RELOC_KVX_S37_GOTADDR_LO10, + BFD_RELOC_KVX_S37_GOTADDR_UP27, + BFD_RELOC_KVX_S43_GOTADDR_LO10, + BFD_RELOC_KVX_S43_GOTADDR_UP27, + BFD_RELOC_KVX_S43_GOTADDR_EX6, + BFD_RELOC_KVX_S64_GOTADDR_LO10, + BFD_RELOC_KVX_S64_GOTADDR_UP27, + BFD_RELOC_KVX_S64_GOTADDR_EX27, + BFD_RELOC_KVX_64_DTPMOD, + BFD_RELOC_KVX_64_DTPOFF, + BFD_RELOC_KVX_S37_TLS_DTPOFF_LO10, + BFD_RELOC_KVX_S37_TLS_DTPOFF_UP27, + BFD_RELOC_KVX_S43_TLS_DTPOFF_LO10, + BFD_RELOC_KVX_S43_TLS_DTPOFF_UP27, + BFD_RELOC_KVX_S43_TLS_DTPOFF_EX6, + BFD_RELOC_KVX_S37_TLS_GD_LO10, + BFD_RELOC_KVX_S37_TLS_GD_UP27, + BFD_RELOC_KVX_S43_TLS_GD_LO10, + BFD_RELOC_KVX_S43_TLS_GD_UP27, + BFD_RELOC_KVX_S43_TLS_GD_EX6, + BFD_RELOC_KVX_S37_TLS_LD_LO10, + BFD_RELOC_KVX_S37_TLS_LD_UP27, + BFD_RELOC_KVX_S43_TLS_LD_LO10, + BFD_RELOC_KVX_S43_TLS_LD_UP27, + BFD_RELOC_KVX_S43_TLS_LD_EX6, + BFD_RELOC_KVX_64_TPOFF, + BFD_RELOC_KVX_S37_TLS_IE_LO10, + BFD_RELOC_KVX_S37_TLS_IE_UP27, + BFD_RELOC_KVX_S43_TLS_IE_LO10, + BFD_RELOC_KVX_S43_TLS_IE_UP27, + BFD_RELOC_KVX_S43_TLS_IE_EX6, + BFD_RELOC_KVX_S37_TLS_LE_LO10, + BFD_RELOC_KVX_S37_TLS_LE_UP27, + BFD_RELOC_KVX_S43_TLS_LE_LO10, + BFD_RELOC_KVX_S43_TLS_LE_UP27, + BFD_RELOC_KVX_S43_TLS_LE_EX6, + BFD_RELOC_KVX_8, + +/* KVX pseudo relocation code to mark the end of the KVX +relocation enumerators that have direct mapping to ELF reloc codes. +There are a few more enumerators after this one; those are mainly +used by the KVX assembler for the internal fixup or to select +one of the above enumerators. */ + BFD_RELOC_KVX_RELOC_END, + /* AArch64 pseudo relocation code to mark the start of the AArch64 relocation enumerators. N.B. the order of the enumerators is important as several tables in the AArch64 bfd backend are indexed diff --git a/bfd/config.bfd b/bfd/config.bfd index 81ddbcd09c9..3ac1f72f1ff 100644 --- a/bfd/config.bfd +++ b/bfd/config.bfd @@ -196,6 +196,7 @@ fido*) targ_archs=bfd_m68k_arch ;; hppa*) targ_archs=bfd_hppa_arch ;; i[3-7]86) targ_archs=bfd_i386_arch ;; ia16) targ_archs=bfd_i386_arch ;; +kvx) targ_archs=bfd_kvx_arch ;; loongarch*) targ_archs=bfd_loongarch_arch ;; m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;; m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;; @@ -797,6 +798,21 @@ case "${targ}" in targ_defvec=iq2000_elf32_vec ;; +#ifdef BFD64 + kvx-*-linux*) + targ_defvec=kvx_elf64_vec + want64=true + ;; +#endif + + kvx-*-*) + targ_defvec=kvx_elf32_vec + targ_selvecs="kvx_elf32_vec" +#ifdef BFD64 + targ64_selvecs=kvx_elf64_vec +#endif + ;; + lm32-*-elf | lm32-*-rtems*) targ_defvec=lm32_elf32_vec targ_selvecs=lm32_elf32_fdpic_vec diff --git a/bfd/configure b/bfd/configure index 3d6ec5721f1..03c89b41bef 100755 --- a/bfd/configure +++ b/bfd/configure @@ -13928,6 +13928,9 @@ do ia64_pei_vec) tb="$tb pei-ia64.lo pepigen.lo $coff"; target_size=64 ;; ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;; iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; + kvx_elf32_vec) tb="$tb elf32-kvx.lo elfxx-kvx.lo elf32.lo $elf $ipa" ;; + kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; + kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; diff --git a/bfd/configure.ac b/bfd/configure.ac index f044616f4d9..0d1cd814af6 100644 --- a/bfd/configure.ac +++ b/bfd/configure.ac @@ -495,6 +495,9 @@ do ia64_pei_vec) tb="$tb pei-ia64.lo pepigen.lo $coff"; target_size=64 ;; ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;; iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;; + kvx_elf32_vec) tb="$tb elf32-kvx.lo elfxx-kvx.lo elf32.lo $elf $ipa" ;; + kvx_elf64_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; + kvx_elf64_linux_vec) tb="$tb elf64-kvx.lo elfxx-kvx.lo elf64.lo $elf $ipa" ;; lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;; loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;; diff --git a/bfd/cpu-kvx.c b/bfd/cpu-kvx.c new file mode 100644 index 00000000000..61d9d5daf69 --- /dev/null +++ b/bfd/cpu-kvx.c @@ -0,0 +1,124 @@ +/* BFD support for KVX. + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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 of the License, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#include "sysdep.h" +#include "bfd.h" +#include "libbfd.h" + +/* This routine is provided two arch_infos and returns if machines + are compatible. +*/ + +static const bfd_arch_info_type * +kvx_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b) +{ + long amach = a->mach, bmach = b->mach; + /* If a & b are for different architecture we can do nothing. */ + if (a->arch != b->arch) + return NULL; + + if ((amach == bfd_mach_kv3_1_64 && bmach == bfd_mach_kv3_1_usr) + || (amach == bfd_mach_kv3_2_64 && bmach == bfd_mach_kv3_2_usr)) + return b; + + if ((bmach == bfd_mach_kv3_1_64 && amach == bfd_mach_kv3_1_usr) + || (bmach == bfd_mach_kv3_2_64 && amach == bfd_mach_kv3_2_usr)) + return a; + + /* Otherwise if either a or b is the 'default' machine + * then it can be polymorphed into the other. + * This will enable to execute merge_private_bfd_data + */ + if (a->the_default) + return b; + + if (b->the_default) + return a; + + /* We do not want to transmute some machine into another one */ + if (amach != bmach) + return NULL; + + /* If a & b are for the same machine then all is well. */ + if (amach == bmach) + return a; + + return NULL; +} + +static bool +scan (const struct bfd_arch_info *info, const char *string) +{ + /* First test for an exact match. */ + if (strcasecmp (string, info->printable_name) == 0) + return true; + + /* Finally check for the default architecture. */ + if (strcasecmp (string, "kvx") == 0) + return info->the_default; + + return false; +} + +#define N(addr_bits, machine, print, default, next) \ +{ \ + 32, /* 32 bits in a word. */ \ + addr_bits, /* bits in an address. */ \ + 8, /* 8 bits in a byte. */ \ + bfd_arch_kvx, \ + machine, /* Machine number. */ \ + "kvx", /* Architecture name. */ \ + print, /* Printable name. */ \ + 4, /* Section align power. */ \ + default, /* Is this the default ? */ \ + kvx_compatible, \ + scan, \ + bfd_arch_default_fill, \ + next, \ + 0 \ +} + + +const bfd_arch_info_type bfd_kv4_1_usr_arch = + N (64 , bfd_mach_kv4_1_usr , "kvx:kv4-1:usr" , false , NULL); + +const bfd_arch_info_type bfd_kv3_2_usr_arch = + N (64 , bfd_mach_kv3_2_usr , "kvx:kv3-2:usr" , false , &bfd_kv4_1_usr_arch); + +const bfd_arch_info_type bfd_kv3_1_usr_arch = + N (64 , bfd_mach_kv3_1_usr , "kvx:kv3-1:usr" , false , &bfd_kv3_2_usr_arch); + +const bfd_arch_info_type bfd_kv4_1_64_arch = + N (64 , bfd_mach_kv4_1_64 , "kvx:kv4-1:64" , false , &bfd_kv3_1_usr_arch); + +const bfd_arch_info_type bfd_kv3_2_64_arch = + N (64 , bfd_mach_kv3_2_64 , "kvx:kv3-2:64" , false , &bfd_kv4_1_64_arch); + +const bfd_arch_info_type bfd_kv3_1_64_arch = + N (64 , bfd_mach_kv3_1_64 , "kvx:kv3-1:64" , false , &bfd_kv3_2_64_arch); + +const bfd_arch_info_type bfd_kv4_1_arch = + N (32 , bfd_mach_kv4_1 , "kvx:kv4-1" , false , &bfd_kv3_1_64_arch); + +const bfd_arch_info_type bfd_kv3_2_arch = + N (32 , bfd_mach_kv3_2 , "kvx:kv3-2" , false , &bfd_kv4_1_arch); + +const bfd_arch_info_type bfd_kvx_arch = + N (32 , bfd_mach_kv3_1 , "kvx:kv3-1" , true , &bfd_kv3_2_arch); diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h index ec856764519..869e86b7749 100644 --- a/bfd/elf-bfd.h +++ b/bfd/elf-bfd.h @@ -545,6 +545,7 @@ enum elf_target_id HPPA64_ELF_DATA, I386_ELF_DATA, IA64_ELF_DATA, + KVX_ELF_DATA, LM32_ELF_DATA, LARCH_ELF_DATA, M32R_ELF_DATA, diff --git a/bfd/elfnn-kvx.c b/bfd/elfnn-kvx.c new file mode 100644 index 00000000000..1cd000d62de --- /dev/null +++ b/bfd/elfnn-kvx.c @@ -0,0 +1,4798 @@ +/* KVX-specific support for NN-bit ELF. + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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 of the License, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#include "sysdep.h" +#include "bfd.h" +#include "libiberty.h" +#include "libbfd.h" +#include "elf-bfd.h" +#include "bfdlink.h" +#include "objalloc.h" +#include "elf/kvx.h" +#include "elfxx-kvx.h" + +#define ARCH_SIZE NN + +#if ARCH_SIZE == 64 +#define LOG_FILE_ALIGN 3 +#endif + +#if ARCH_SIZE == 32 +#define LOG_FILE_ALIGN 2 +#endif + +#define IS_KVX_TLS_RELOC(R_TYPE) \ + ((R_TYPE) == BFD_RELOC_KVX_S37_TLS_LE_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_LE_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LE_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LE_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LE_EX6 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_DTPOFF_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_DTPOFF_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_DTPOFF_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_DTPOFF_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_DTPOFF_EX6 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_IE_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_IE_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_IE_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_IE_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_IE_EX6 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_GD_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_GD_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_GD_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_GD_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_GD_EX6 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_LD_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S37_TLS_LD_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LD_LO10 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LD_UP27 \ + || (R_TYPE) == BFD_RELOC_KVX_S43_TLS_LD_EX6 \ + ) + +#define IS_KVX_TLS_RELAX_RELOC(R_TYPE) 0 + +#define ELIMINATE_COPY_RELOCS 0 + +/* Return size of a relocation entry. HTAB is the bfd's + elf_kvx_link_hash_entry. */ +#define RELOC_SIZE(HTAB) (sizeof (ElfNN_External_Rela)) + +/* GOT Entry size - 8 bytes in ELF64 and 4 bytes in ELF32. */ +#define GOT_ENTRY_SIZE (ARCH_SIZE / 8) +#define PLT_ENTRY_SIZE (32) + +#define PLT_SMALL_ENTRY_SIZE (4*4) + +/* Encoding of the nop instruction */ +#define INSN_NOP 0x00f0037f + +#define kvx_compute_jump_table_size(htab) \ + (((htab)->root.srelplt == NULL) ? 0 \ + : (htab)->root.srelplt->reloc_count * GOT_ENTRY_SIZE) + +static const bfd_byte elfNN_kvx_small_plt0_entry[PLT_ENTRY_SIZE] = +{ + /* FIXME KVX: no first entry, not used yet */ + 0 +}; + +/* Per function entry in a procedure linkage table looks like this + if the distance between the PLTGOT and the PLT is < 4GB use + these PLT entries. */ +static const bfd_byte elfNN_kvx_small_plt_entry[PLT_SMALL_ENTRY_SIZE] = +{ + 0x10, 0x00, 0xc4, 0x0f, /* get $r16 = $pc ;; */ +#if ARCH_SIZE == 32 + 0x10, 0x00, 0x40, 0xb0, /* lwz $r16 = 0[$r16] ;; */ +#else + 0x10, 0x00, 0x40, 0xb8, /* ld $r16 = 0[$r16] ;; */ +#endif + 0x00, 0x00, 0x00, 0x18, /* upper 27 bits for LSU */ + 0x10, 0x00, 0xd8, 0x0f, /* igoto $r16 ;; */ +}; + +/* Long stub use 43bits format of make. */ +static const uint32_t elfNN_kvx_long_branch_stub[] = +{ + 0xe0400000, /* make $r16 = LO10 EX6 */ + 0x00000000, /* UP27 ;; */ + 0x0fd80010, /* igoto "r16 ;; */ +}; + +#define elf_info_to_howto elfNN_kvx_info_to_howto +#define elf_info_to_howto_rel elfNN_kvx_info_to_howto + +#define KVX_ELF_ABI_VERSION 0 + +/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */ +#define ALL_ONES (~ (bfd_vma) 0) + +/* Indexed by the bfd interal reloc enumerators. + Therefore, the table needs to be synced with BFD_RELOC_KVX_* + in reloc.c. */ + +#define KVX_KV3_V1_KV3_V2_KV4_V1 +#include "elfxx-kvx-relocs.h" +#undef KVX_KV3_V1_KV3_V2_KV4_V1 + +/* Given HOWTO, return the bfd internal relocation enumerator. */ + +static bfd_reloc_code_real_type +elfNN_kvx_bfd_reloc_from_howto (reloc_howto_type *howto) +{ + const int size = (int) ARRAY_SIZE (elf_kvx_howto_table); + const ptrdiff_t offset = howto - elf_kvx_howto_table; + + if (offset >= 0 && offset < size) + return BFD_RELOC_KVX_RELOC_START + offset + 1; + + return BFD_RELOC_KVX_RELOC_START + 1; +} + +/* Given R_TYPE, return the bfd internal relocation enumerator. */ + +static bfd_reloc_code_real_type +elfNN_kvx_bfd_reloc_from_type (bfd *abfd ATTRIBUTE_UNUSED, unsigned int r_type) +{ + static bool initialized_p = false; + /* Indexed by R_TYPE, values are offsets in the howto_table. */ + static unsigned int offsets[R_KVX_end]; + + if (!initialized_p) + { + unsigned int i; + + for (i = 0; i < ARRAY_SIZE (elf_kvx_howto_table); ++i) + offsets[elf_kvx_howto_table[i].type] = i; + + initialized_p = true; + } + + /* PR 17512: file: b371e70a. */ + if (r_type >= R_KVX_end) + { + bfd_set_error (bfd_error_bad_value); + return BFD_RELOC_KVX_RELOC_END; + } + + return (BFD_RELOC_KVX_RELOC_START + 1) + offsets[r_type]; +} + +struct elf_kvx_reloc_map +{ + bfd_reloc_code_real_type from; + bfd_reloc_code_real_type to; +}; + +/* Map bfd generic reloc to KVX-specific reloc. */ +static const struct elf_kvx_reloc_map elf_kvx_reloc_map[] = +{ + {BFD_RELOC_NONE, BFD_RELOC_KVX_NONE}, + + /* Basic data relocations. */ + {BFD_RELOC_CTOR, BFD_RELOC_KVX_NN}, + {BFD_RELOC_64, BFD_RELOC_KVX_64}, + {BFD_RELOC_32, BFD_RELOC_KVX_32}, + {BFD_RELOC_16, BFD_RELOC_KVX_16}, + {BFD_RELOC_8, BFD_RELOC_KVX_8}, + + {BFD_RELOC_64_PCREL, BFD_RELOC_KVX_64_PCREL}, + {BFD_RELOC_32_PCREL, BFD_RELOC_KVX_32_PCREL}, +}; + +/* Given the bfd internal relocation enumerator in CODE, return the + corresponding howto entry. */ + +static reloc_howto_type * +elfNN_kvx_howto_from_bfd_reloc (bfd_reloc_code_real_type code) +{ + unsigned int i; + + /* Convert bfd generic reloc to KVX-specific reloc. */ + if (code < BFD_RELOC_KVX_RELOC_START || code > BFD_RELOC_KVX_RELOC_END) + for (i = 0; i < ARRAY_SIZE (elf_kvx_reloc_map) ; i++) + if (elf_kvx_reloc_map[i].from == code) + { + code = elf_kvx_reloc_map[i].to; + break; + } + + if (code > BFD_RELOC_KVX_RELOC_START && code < BFD_RELOC_KVX_RELOC_END) + return &elf_kvx_howto_table[code - (BFD_RELOC_KVX_RELOC_START + 1)]; + + return NULL; +} + +static reloc_howto_type * +elfNN_kvx_howto_from_type (bfd *abfd, unsigned int r_type) +{ + bfd_reloc_code_real_type val; + reloc_howto_type *howto; + +#if ARCH_SIZE == 32 + if (r_type > 256) + { + bfd_set_error (bfd_error_bad_value); + return NULL; + } +#endif + + val = elfNN_kvx_bfd_reloc_from_type (abfd, r_type); + howto = elfNN_kvx_howto_from_bfd_reloc (val); + + if (howto != NULL) + return howto; + + bfd_set_error (bfd_error_bad_value); + return NULL; +} + +static bool +elfNN_kvx_info_to_howto (bfd *abfd ATTRIBUTE_UNUSED, arelent *bfd_reloc, + Elf_Internal_Rela *elf_reloc) +{ + unsigned int r_type; + + r_type = ELFNN_R_TYPE (elf_reloc->r_info); + bfd_reloc->howto = elfNN_kvx_howto_from_type (abfd, r_type); + + if (bfd_reloc->howto == NULL) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: unsupported relocation type %#x"), abfd, r_type); + return false; + } + return true; +} + +static reloc_howto_type * +elfNN_kvx_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type code) +{ + reloc_howto_type *howto = elfNN_kvx_howto_from_bfd_reloc (code); + + if (howto != NULL) + return howto; + + bfd_set_error (bfd_error_bad_value); + return NULL; +} + +static reloc_howto_type * +elfNN_kvx_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, + const char *r_name) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE (elf_kvx_howto_table); ++i) + if (elf_kvx_howto_table[i].name != NULL + && strcasecmp (elf_kvx_howto_table[i].name, r_name) == 0) + return &elf_kvx_howto_table[i]; + + return NULL; +} + +#define TARGET_LITTLE_SYM kvx_elfNN_vec +#define TARGET_LITTLE_NAME "elfNN-kvx" + +/* The linker script knows the section names for placement. + The entry_names are used to do simple name mangling on the stubs. + Given a function name, and its type, the stub can be found. The + name can be changed. The only requirement is the %s be present. */ +#define STUB_ENTRY_NAME "__%s_veneer" + +/* The name of the dynamic interpreter. This is put in the .interp + section. */ +#define ELF_DYNAMIC_INTERPRETER "/lib/ld.so.1" + + +/* PCREL 27 is signed-extended and scaled by 4 */ +#define KVX_MAX_FWD_CALL_OFFSET \ + (((1 << 26) - 1) << 2) +#define KVX_MAX_BWD_CALL_OFFSET \ + (-((1 << 26) << 2)) + +/* Check that the destination of the call is within the PCREL27 + range. */ +static int +kvx_valid_call_p (bfd_vma value, bfd_vma place) +{ + bfd_signed_vma offset = (bfd_signed_vma) (value - place); + return (offset <= KVX_MAX_FWD_CALL_OFFSET + && offset >= KVX_MAX_BWD_CALL_OFFSET); +} + +/* Section name for stubs is the associated section name plus this + string. */ +#define STUB_SUFFIX ".stub" + +enum elf_kvx_stub_type +{ + kvx_stub_none, + kvx_stub_long_branch, +}; + +struct elf_kvx_stub_hash_entry +{ + /* Base hash table entry structure. */ + struct bfd_hash_entry root; + + /* The stub section. */ + asection *stub_sec; + + /* Offset within stub_sec of the beginning of this stub. */ + bfd_vma stub_offset; + + /* Given the symbol's value and its section we can determine its final + value when building the stubs (so the stub knows where to jump). */ + bfd_vma target_value; + asection *target_section; + + enum elf_kvx_stub_type stub_type; + + /* The symbol table entry, if any, that this was derived from. */ + struct elf_kvx_link_hash_entry *h; + + /* Destination symbol type */ + unsigned char st_type; + + /* Where this stub is being called from, or, in the case of combined + stub sections, the first input section in the group. */ + asection *id_sec; + + /* The name for the local symbol at the start of this stub. The + stub name in the hash table has to be unique; this does not, so + it can be friendlier. */ + char *output_name; +}; + +/* Used to build a map of a section. This is required for mixed-endian + code/data. */ + +typedef struct elf_elf_section_map +{ + bfd_vma vma; + char type; +} +elf_kvx_section_map; + + +typedef struct _kvx_elf_section_data +{ + struct bfd_elf_section_data elf; + unsigned int mapcount; + unsigned int mapsize; + elf_kvx_section_map *map; +} +_kvx_elf_section_data; + +#define elf_kvx_section_data(sec) \ + ((_kvx_elf_section_data *) elf_section_data (sec)) + +struct elf_kvx_local_symbol +{ + unsigned int got_type; + bfd_signed_vma got_refcount; + bfd_vma got_offset; +}; + +struct elf_kvx_obj_tdata +{ + struct elf_obj_tdata root; + + /* local symbol descriptors */ + struct elf_kvx_local_symbol *locals; + + /* Zero to warn when linking objects with incompatible enum sizes. */ + int no_enum_size_warning; + + /* Zero to warn when linking objects with incompatible wchar_t sizes. */ + int no_wchar_size_warning; +}; + +#define elf_kvx_tdata(bfd) \ + ((struct elf_kvx_obj_tdata *) (bfd)->tdata.any) + +#define elf_kvx_locals(bfd) (elf_kvx_tdata (bfd)->locals) + +#define is_kvx_elf(bfd) \ + (bfd_get_flavour (bfd) == bfd_target_elf_flavour \ + && elf_tdata (bfd) != NULL \ + && elf_object_id (bfd) == KVX_ELF_DATA) + +static bool +elfNN_kvx_mkobject (bfd *abfd) +{ + return bfd_elf_allocate_object (abfd, sizeof (struct elf_kvx_obj_tdata), + KVX_ELF_DATA); +} + +#define elf_kvx_hash_entry(ent) \ + ((struct elf_kvx_link_hash_entry *)(ent)) + +#define GOT_UNKNOWN 0 +#define GOT_NORMAL 1 + +#define GOT_TLS_GD 2 +#define GOT_TLS_IE 4 +#define GOT_TLS_LD 8 + +/* KVX ELF linker hash entry. */ +struct elf_kvx_link_hash_entry +{ + struct elf_link_hash_entry root; + + /* Since PLT entries have variable size, we need to record the + index into .got.plt instead of recomputing it from the PLT + offset. */ + bfd_signed_vma plt_got_offset; + + /* Bit mask representing the type of GOT entry(s) if any required by + this symbol. */ + unsigned int got_type; + + /* A pointer to the most recently used stub hash entry against this + symbol. */ + struct elf_kvx_stub_hash_entry *stub_cache; +}; + +/* Get the KVX elf linker hash table from a link_info structure. */ +#define elf_kvx_hash_table(info) \ + ((struct elf_kvx_link_hash_table *) ((info)->hash)) + +#define kvx_stub_hash_lookup(table, string, create, copy) \ + ((struct elf_kvx_stub_hash_entry *) \ + bfd_hash_lookup ((table), (string), (create), (copy))) + +/* KVX ELF linker hash table. */ +struct elf_kvx_link_hash_table +{ + /* The main hash table. */ + struct elf_link_hash_table root; + + /* Nonzero to force PIC branch veneers. */ + int pic_veneer; + + /* The number of bytes in the initial entry in the PLT. */ + bfd_size_type plt_header_size; + + /* The number of bytes in the subsequent PLT etries. */ + bfd_size_type plt_entry_size; + + /* The bytes of the subsequent PLT entry. */ + const bfd_byte *plt_entry; + + /* Short-cuts to get to dynamic linker sections. */ + asection *sdynbss; + asection *srelbss; + + /* Small local sym cache. */ + struct sym_cache sym_cache; + + /* For convenience in allocate_dynrelocs. */ + bfd *obfd; + + /* The amount of space used by the reserved portion of the sgotplt + section, plus whatever space is used by the jump slots. */ + bfd_vma sgotplt_jump_table_size; + + /* The stub hash table. */ + struct bfd_hash_table stub_hash_table; + + /* Linker stub bfd. */ + bfd *stub_bfd; + + /* Linker call-backs. */ + asection *(*add_stub_section) (const char *, asection *); + void (*layout_sections_again) (void); + + /* Array to keep track of which stub sections have been created, and + information on stub grouping. */ + struct map_stub + { + /* This is the section to which stubs in the group will be + attached. */ + asection *link_sec; + /* The stub section. */ + asection *stub_sec; + } *stub_group; + + /* Assorted information used by elfNN_kvx_size_stubs. */ + unsigned int bfd_count; + unsigned int top_index; + asection **input_list; +}; + +/* Create an entry in an KVX ELF linker hash table. */ + +static struct bfd_hash_entry * +elfNN_kvx_link_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, + const char *string) +{ + struct elf_kvx_link_hash_entry *ret = + (struct elf_kvx_link_hash_entry *) entry; + + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (ret == NULL) + ret = bfd_hash_allocate (table, + sizeof (struct elf_kvx_link_hash_entry)); + if (ret == NULL) + return (struct bfd_hash_entry *) ret; + + /* Call the allocation method of the superclass. */ + ret = ((struct elf_kvx_link_hash_entry *) + _bfd_elf_link_hash_newfunc ((struct bfd_hash_entry *) ret, + table, string)); + if (ret != NULL) + { + ret->got_type = GOT_UNKNOWN; + ret->plt_got_offset = (bfd_vma) - 1; + ret->stub_cache = NULL; + } + + return (struct bfd_hash_entry *) ret; +} + +/* Initialize an entry in the stub hash table. */ + +static struct bfd_hash_entry * +stub_hash_newfunc (struct bfd_hash_entry *entry, + struct bfd_hash_table *table, const char *string) +{ + /* Allocate the structure if it has not already been allocated by a + subclass. */ + if (entry == NULL) + { + entry = bfd_hash_allocate (table, + sizeof (struct + elf_kvx_stub_hash_entry)); + if (entry == NULL) + return entry; + } + + /* Call the allocation method of the superclass. */ + entry = bfd_hash_newfunc (entry, table, string); + if (entry != NULL) + { + struct elf_kvx_stub_hash_entry *eh; + + /* Initialize the local fields. */ + eh = (struct elf_kvx_stub_hash_entry *) entry; + eh->stub_sec = NULL; + eh->stub_offset = 0; + eh->target_value = 0; + eh->target_section = NULL; + eh->stub_type = kvx_stub_none; + eh->h = NULL; + eh->id_sec = NULL; + } + + return entry; +} + +/* Copy the extra info we tack onto an elf_link_hash_entry. */ + +static void +elfNN_kvx_copy_indirect_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *dir, + struct elf_link_hash_entry *ind) +{ + struct elf_kvx_link_hash_entry *edir, *eind; + + edir = (struct elf_kvx_link_hash_entry *) dir; + eind = (struct elf_kvx_link_hash_entry *) ind; + + if (ind->root.type == bfd_link_hash_indirect) + { + /* Copy over PLT info. */ + if (dir->got.refcount <= 0) + { + edir->got_type = eind->got_type; + eind->got_type = GOT_UNKNOWN; + } + } + + _bfd_elf_link_hash_copy_indirect (info, dir, ind); +} + +/* Destroy a KVX elf linker hash table. */ + +static void +elfNN_kvx_link_hash_table_free (bfd *obfd) +{ + struct elf_kvx_link_hash_table *ret + = (struct elf_kvx_link_hash_table *) obfd->link.hash; + + bfd_hash_table_free (&ret->stub_hash_table); + _bfd_elf_link_hash_table_free (obfd); +} + +/* Create a KVX elf linker hash table. */ + +static struct bfd_link_hash_table * +elfNN_kvx_link_hash_table_create (bfd *abfd) +{ + struct elf_kvx_link_hash_table *ret; + bfd_size_type amt = sizeof (struct elf_kvx_link_hash_table); + + ret = bfd_zmalloc (amt); + if (ret == NULL) + return NULL; + + if (!_bfd_elf_link_hash_table_init + (&ret->root, abfd, elfNN_kvx_link_hash_newfunc, + sizeof (struct elf_kvx_link_hash_entry), KVX_ELF_DATA)) + { + free (ret); + return NULL; + } + + ret->plt_header_size = PLT_ENTRY_SIZE; + ret->plt_entry_size = PLT_SMALL_ENTRY_SIZE; + ret->plt_entry = elfNN_kvx_small_plt_entry; + + ret->obfd = abfd; + + if (!bfd_hash_table_init (&ret->stub_hash_table, stub_hash_newfunc, + sizeof (struct elf_kvx_stub_hash_entry))) + { + _bfd_elf_link_hash_table_free (abfd); + return NULL; + } + + ret->root.root.hash_table_free = elfNN_kvx_link_hash_table_free; + + return &ret->root.root; +} + +static bfd_reloc_status_type +kvx_relocate (unsigned int r_type, bfd *input_bfd, asection *input_section, + bfd_vma offset, bfd_vma value) +{ + reloc_howto_type *howto; + bfd_vma place; + + howto = elfNN_kvx_howto_from_type (input_bfd, r_type); + place = (input_section->output_section->vma + input_section->output_offset + + offset); + + r_type = elfNN_kvx_bfd_reloc_from_type (input_bfd, r_type); + value = _bfd_kvx_elf_resolve_relocation (r_type, place, value, 0, false); + return _bfd_kvx_elf_put_addend (input_bfd, + input_section->contents + offset, r_type, + howto, value); +} + +/* Determine the type of stub needed, if any, for a call. */ + +static enum elf_kvx_stub_type +kvx_type_of_stub (asection *input_sec, + const Elf_Internal_Rela *rel, + asection *sym_sec, + unsigned char st_type, + bfd_vma destination) +{ + bfd_vma location; + bfd_signed_vma branch_offset; + unsigned int r_type; + enum elf_kvx_stub_type stub_type = kvx_stub_none; + + if (st_type != STT_FUNC + && (sym_sec == input_sec)) + return stub_type; + + /* Determine where the call point is. */ + location = (input_sec->output_offset + + input_sec->output_section->vma + rel->r_offset); + + branch_offset = (bfd_signed_vma) (destination - location); + + r_type = ELFNN_R_TYPE (rel->r_info); + + /* We don't want to redirect any old unconditional jump in this way, + only one which is being used for a sibcall, where it is + acceptable for the R16 and R17 registers to be clobbered. */ + if (r_type == R_KVX_PCREL27 + && (branch_offset > KVX_MAX_FWD_CALL_OFFSET + || branch_offset < KVX_MAX_BWD_CALL_OFFSET)) + { + stub_type = kvx_stub_long_branch; + } + + return stub_type; +} + +/* Build a name for an entry in the stub hash table. */ + +static char * +elfNN_kvx_stub_name (const asection *input_section, + const asection *sym_sec, + const struct elf_kvx_link_hash_entry *hash, + const Elf_Internal_Rela *rel) +{ + char *stub_name; + bfd_size_type len; + + if (hash) + { + len = 8 + 1 + strlen (hash->root.root.root.string) + 1 + 16 + 1; + stub_name = bfd_malloc (len); + if (stub_name != NULL) + snprintf (stub_name, len, "%08x_%s+%" PRIx64 "x", + (unsigned int) input_section->id, + hash->root.root.root.string, + rel->r_addend); + } + else + { + len = 8 + 1 + 8 + 1 + 8 + 1 + 16 + 1; + stub_name = bfd_malloc (len); + if (stub_name != NULL) + snprintf (stub_name, len, "%08x_%x:%x+%" PRIx64 "x", + (unsigned int) input_section->id, + (unsigned int) sym_sec->id, + (unsigned int) ELFNN_R_SYM (rel->r_info), + rel->r_addend); + } + + return stub_name; +} + +/* Return true if symbol H should be hashed in the `.gnu.hash' section. For + executable PLT slots where the executable never takes the address of those + functions, the function symbols are not added to the hash table. */ + +static bool +elf_kvx_hash_symbol (struct elf_link_hash_entry *h) +{ + if (h->plt.offset != (bfd_vma) -1 + && !h->def_regular + && !h->pointer_equality_needed) + return false; + + return _bfd_elf_hash_symbol (h); +} + + +/* Look up an entry in the stub hash. Stub entries are cached because + creating the stub name takes a bit of time. */ + +static struct elf_kvx_stub_hash_entry * +elfNN_kvx_get_stub_entry (const asection *input_section, + const asection *sym_sec, + struct elf_link_hash_entry *hash, + const Elf_Internal_Rela *rel, + struct elf_kvx_link_hash_table *htab) +{ + struct elf_kvx_stub_hash_entry *stub_entry; + struct elf_kvx_link_hash_entry *h = + (struct elf_kvx_link_hash_entry *) hash; + const asection *id_sec; + + if ((input_section->flags & SEC_CODE) == 0) + return NULL; + + /* If this input section is part of a group of sections sharing one + stub section, then use the id of the first section in the group. + Stub names need to include a section id, as there may well be + more than one stub used to reach say, printf, and we need to + distinguish between them. */ + id_sec = htab->stub_group[input_section->id].link_sec; + + if (h != NULL && h->stub_cache != NULL + && h->stub_cache->h == h && h->stub_cache->id_sec == id_sec) + { + stub_entry = h->stub_cache; + } + else + { + char *stub_name; + + stub_name = elfNN_kvx_stub_name (id_sec, sym_sec, h, rel); + if (stub_name == NULL) + return NULL; + + stub_entry = kvx_stub_hash_lookup (&htab->stub_hash_table, + stub_name, false, false); + if (h != NULL) + h->stub_cache = stub_entry; + + free (stub_name); + } + + return stub_entry; +} + + +/* Create a stub section. */ + +static asection * +_bfd_kvx_create_stub_section (asection *section, + struct elf_kvx_link_hash_table *htab) + +{ + size_t namelen; + bfd_size_type len; + char *s_name; + + namelen = strlen (section->name); + len = namelen + sizeof (STUB_SUFFIX); + s_name = bfd_alloc (htab->stub_bfd, len); + if (s_name == NULL) + return NULL; + + memcpy (s_name, section->name, namelen); + memcpy (s_name + namelen, STUB_SUFFIX, sizeof (STUB_SUFFIX)); + return (*htab->add_stub_section) (s_name, section); +} + + +/* Find or create a stub section for a link section. + + Fix or create the stub section used to collect stubs attached to + the specified link section. */ + +static asection * +_bfd_kvx_get_stub_for_link_section (asection *link_section, + struct elf_kvx_link_hash_table *htab) +{ + if (htab->stub_group[link_section->id].stub_sec == NULL) + htab->stub_group[link_section->id].stub_sec + = _bfd_kvx_create_stub_section (link_section, htab); + return htab->stub_group[link_section->id].stub_sec; +} + + +/* Find or create a stub section in the stub group for an input + section. */ + +static asection * +_bfd_kvx_create_or_find_stub_sec (asection *section, + struct elf_kvx_link_hash_table *htab) +{ + asection *link_sec = htab->stub_group[section->id].link_sec; + return _bfd_kvx_get_stub_for_link_section (link_sec, htab); +} + + +/* Add a new stub entry in the stub group associated with an input + section to the stub hash. Not all fields of the new stub entry are + initialised. */ + +static struct elf_kvx_stub_hash_entry * +_bfd_kvx_add_stub_entry_in_group (const char *stub_name, + asection *section, + struct elf_kvx_link_hash_table *htab) +{ + asection *link_sec; + asection *stub_sec; + struct elf_kvx_stub_hash_entry *stub_entry; + + link_sec = htab->stub_group[section->id].link_sec; + stub_sec = _bfd_kvx_create_or_find_stub_sec (section, htab); + + /* Enter this entry into the linker stub hash table. */ + stub_entry = kvx_stub_hash_lookup (&htab->stub_hash_table, stub_name, + true, false); + if (stub_entry == NULL) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: cannot create stub entry %s"), + section->owner, stub_name); + return NULL; + } + + stub_entry->stub_sec = stub_sec; + stub_entry->stub_offset = 0; + stub_entry->id_sec = link_sec; + + return stub_entry; +} + +static bool +kvx_build_one_stub (struct bfd_hash_entry *gen_entry, + void *in_arg) +{ + struct elf_kvx_stub_hash_entry *stub_entry; + asection *stub_sec; + bfd *stub_bfd; + bfd_byte *loc; + bfd_vma sym_value; + unsigned int template_size; + const uint32_t *template; + unsigned int i; + struct bfd_link_info *info; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf_kvx_stub_hash_entry *) gen_entry; + + info = (struct bfd_link_info *) in_arg; + + /* Fail if the target section could not be assigned to an output + section. The user should fix his linker script. */ + if (stub_entry->target_section->output_section == NULL + && info->non_contiguous_regions) + info->callbacks->einfo (_("%F%P: Could not assign '%pA' to an output section. " + "Retry without " + "--enable-non-contiguous-regions.\n"), + stub_entry->target_section); + + stub_sec = stub_entry->stub_sec; + + /* Make a note of the offset within the stubs for this entry. */ + stub_entry->stub_offset = stub_sec->size; + loc = stub_sec->contents + stub_entry->stub_offset; + + stub_bfd = stub_sec->owner; + + /* This is the address of the stub destination. */ + sym_value = (stub_entry->target_value + + stub_entry->target_section->output_offset + + stub_entry->target_section->output_section->vma); + + switch (stub_entry->stub_type) + { + case kvx_stub_long_branch: + template = elfNN_kvx_long_branch_stub; + template_size = sizeof (elfNN_kvx_long_branch_stub); + break; + default: + abort (); + } + + for (i = 0; i < (template_size / sizeof template[0]); i++) + { + bfd_putl32 (template[i], loc); + loc += 4; + } + + stub_sec->size += template_size; + + switch (stub_entry->stub_type) + { + case kvx_stub_long_branch: + /* + The stub uses a make insn with 43bits immediate. + We need to apply 3 relocations: + BFD_RELOC_KVX_S43_LO10 + BFD_RELOC_KVX_S43_UP27 + BFD_RELOC_KVX_S43_EX6 + */ + if (kvx_relocate (R_KVX_S43_LO10, stub_bfd, stub_sec, + stub_entry->stub_offset , sym_value) != bfd_reloc_ok) + BFD_FAIL (); + if (kvx_relocate (R_KVX_S43_EX6, stub_bfd, stub_sec, + stub_entry->stub_offset , sym_value) != bfd_reloc_ok) + BFD_FAIL (); + if (kvx_relocate (R_KVX_S43_UP27, stub_bfd, stub_sec, + stub_entry->stub_offset + 4, sym_value) != bfd_reloc_ok) + BFD_FAIL (); + break; + default: + abort (); + } + + return true; +} + +/* As above, but don't actually build the stub. Just bump offset so + we know stub section sizes. */ + +static bool +kvx_size_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg ATTRIBUTE_UNUSED) +{ + struct elf_kvx_stub_hash_entry *stub_entry; + int size; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf_kvx_stub_hash_entry *) gen_entry; + + switch (stub_entry->stub_type) + { + case kvx_stub_long_branch: + size = sizeof (elfNN_kvx_long_branch_stub); + break; + default: + abort (); + } + + stub_entry->stub_sec->size += size; + return true; +} + +/* External entry points for sizing and building linker stubs. */ + +/* Set up various things so that we can make a list of input sections + for each output section included in the link. Returns -1 on error, + 0 when no stubs will be needed, and 1 on success. */ + +int +elfNN_kvx_setup_section_lists (bfd *output_bfd, + struct bfd_link_info *info) +{ + bfd *input_bfd; + unsigned int bfd_count; + unsigned int top_id, top_index; + asection *section; + asection **input_list, **list; + bfd_size_type amt; + struct elf_kvx_link_hash_table *htab = + elf_kvx_hash_table (info); + + if (!is_elf_hash_table ((const struct bfd_link_hash_table *)htab)) + return 0; + + /* Count the number of input BFDs and find the top input section id. */ + for (input_bfd = info->input_bfds, bfd_count = 0, top_id = 0; + input_bfd != NULL; input_bfd = input_bfd->link.next) + { + bfd_count += 1; + for (section = input_bfd->sections; + section != NULL; section = section->next) + { + if (top_id < section->id) + top_id = section->id; + } + } + htab->bfd_count = bfd_count; + + amt = sizeof (struct map_stub) * (top_id + 1); + htab->stub_group = bfd_zmalloc (amt); + if (htab->stub_group == NULL) + return -1; + + /* We can't use output_bfd->section_count here to find the top output + section index as some sections may have been removed, and + _bfd_strip_section_from_output doesn't renumber the indices. */ + for (section = output_bfd->sections, top_index = 0; + section != NULL; section = section->next) + { + if (top_index < section->index) + top_index = section->index; + } + + htab->top_index = top_index; + amt = sizeof (asection *) * (top_index + 1); + input_list = bfd_malloc (amt); + htab->input_list = input_list; + if (input_list == NULL) + return -1; + + /* For sections we aren't interested in, mark their entries with a + value we can check later. */ + list = input_list + top_index; + do + *list = bfd_abs_section_ptr; + while (list-- != input_list); + + for (section = output_bfd->sections; + section != NULL; section = section->next) + { + if ((section->flags & SEC_CODE) != 0) + input_list[section->index] = NULL; + } + + return 1; +} + +/* Used by elfNN_kvx_next_input_section and group_sections. */ +#define PREV_SEC(sec) (htab->stub_group[(sec)->id].link_sec) + +/* The linker repeatedly calls this function for each input section, + in the order that input sections are linked into output sections. + Build lists of input sections to determine groupings between which + we may insert linker stubs. */ + +void +elfNN_kvx_next_input_section (struct bfd_link_info *info, asection *isec) +{ + struct elf_kvx_link_hash_table *htab = + elf_kvx_hash_table (info); + + if (isec->output_section->index <= htab->top_index) + { + asection **list = htab->input_list + isec->output_section->index; + + if (*list != bfd_abs_section_ptr) + { + /* Steal the link_sec pointer for our list. */ + /* This happens to make the list in reverse order, + which is what we want. */ + PREV_SEC (isec) = *list; + *list = isec; + } + } +} + +/* See whether we can group stub sections together. Grouping stub + sections may result in fewer stubs. More importantly, we need to + put all .init* and .fini* stubs at the beginning of the .init or + .fini output sections respectively, because glibc splits the + _init and _fini functions into multiple parts. Putting a stub in + the middle of a function is not a good idea. */ + +static void +group_sections (struct elf_kvx_link_hash_table *htab, + bfd_size_type stub_group_size, + bool stubs_always_after_branch) +{ + asection **list = htab->input_list; + + do + { + asection *tail = *list; + asection *head; + + if (tail == bfd_abs_section_ptr) + continue; + + /* Reverse the list: we must avoid placing stubs at the + beginning of the section because the beginning of the text + section may be required for an interrupt vector in bare metal + code. */ +#define NEXT_SEC PREV_SEC + head = NULL; + while (tail != NULL) + { + /* Pop from tail. */ + asection *item = tail; + tail = PREV_SEC (item); + + /* Push on head. */ + NEXT_SEC (item) = head; + head = item; + } + + while (head != NULL) + { + asection *curr; + asection *next; + bfd_vma stub_group_start = head->output_offset; + bfd_vma end_of_next; + + curr = head; + while (NEXT_SEC (curr) != NULL) + { + next = NEXT_SEC (curr); + end_of_next = next->output_offset + next->size; + if (end_of_next - stub_group_start >= stub_group_size) + /* End of NEXT is too far from start, so stop. */ + break; + /* Add NEXT to the group. */ + curr = next; + } + + /* OK, the size from the start to the start of CURR is less + than stub_group_size and thus can be handled by one stub + section. (Or the head section is itself larger than + stub_group_size, in which case we may be toast.) + We should really be keeping track of the total size of + stubs added here, as stubs contribute to the final output + section size. */ + do + { + next = NEXT_SEC (head); + /* Set up this stub group. */ + htab->stub_group[head->id].link_sec = curr; + } + while (head != curr && (head = next) != NULL); + + /* But wait, there's more! Input sections up to stub_group_size + bytes after the stub section can be handled by it too. */ + if (!stubs_always_after_branch) + { + stub_group_start = curr->output_offset + curr->size; + + while (next != NULL) + { + end_of_next = next->output_offset + next->size; + if (end_of_next - stub_group_start >= stub_group_size) + /* End of NEXT is too far from stubs, so stop. */ + break; + /* Add NEXT to the stub group. */ + head = next; + next = NEXT_SEC (head); + htab->stub_group[head->id].link_sec = curr; + } + } + head = next; + } + } + while (list++ != htab->input_list + htab->top_index); + + free (htab->input_list); +} + +static void +_bfd_kvx_resize_stubs (struct elf_kvx_link_hash_table *htab) +{ + asection *section; + + /* OK, we've added some stubs. Find out the new size of the + stub sections. */ + for (section = htab->stub_bfd->sections; + section != NULL; section = section->next) + { + /* Ignore non-stub sections. */ + if (!strstr (section->name, STUB_SUFFIX)) + continue; + section->size = 0; + } + + bfd_hash_traverse (&htab->stub_hash_table, kvx_size_one_stub, htab); +} + +/* Satisfy the ELF linker by filling in some fields in our fake bfd. */ + +bool +kvx_elfNN_init_stub_bfd (struct bfd_link_info *info, + bfd *stub_bfd) +{ + struct elf_kvx_link_hash_table *htab; + + elf_elfheader (stub_bfd)->e_ident[EI_CLASS] = ELFCLASSNN; + +/* Always hook our dynamic sections into the first bfd, which is the + linker created stub bfd. This ensures that the GOT header is at + the start of the output TOC section. */ + htab = elf_kvx_hash_table (info); + if (htab == NULL) + return false; + + return true; +} + +/* Determine and set the size of the stub section for a final link. + + The basic idea here is to examine all the relocations looking for + PC-relative calls to a target that is unreachable with a 27bits + immediate (found in call and goto). */ + +bool +elfNN_kvx_size_stubs (bfd *output_bfd, + bfd *stub_bfd, + struct bfd_link_info *info, + bfd_signed_vma group_size, + asection * (*add_stub_section) (const char *, + asection *), + void (*layout_sections_again) (void)) +{ + bfd_size_type stub_group_size; + bool stubs_always_before_branch; + bool stub_changed = false; + struct elf_kvx_link_hash_table *htab = elf_kvx_hash_table (info); + + /* Propagate mach to stub bfd, because it may not have been + finalized when we created stub_bfd. */ + bfd_set_arch_mach (stub_bfd, bfd_get_arch (output_bfd), + bfd_get_mach (output_bfd)); + + /* Stash our params away. */ + htab->stub_bfd = stub_bfd; + htab->add_stub_section = add_stub_section; + htab->layout_sections_again = layout_sections_again; + stubs_always_before_branch = group_size < 0; + if (group_size < 0) + stub_group_size = -group_size; + else + stub_group_size = group_size; + + if (stub_group_size == 1) + { + /* Default values. */ + /* KVX branch range is +-256MB. The value used is 1MB less. */ + stub_group_size = 255 * 1024 * 1024; + } + + group_sections (htab, stub_group_size, stubs_always_before_branch); + + (*htab->layout_sections_again) (); + + while (1) + { + bfd *input_bfd; + + for (input_bfd = info->input_bfds; + input_bfd != NULL; input_bfd = input_bfd->link.next) + { + Elf_Internal_Shdr *symtab_hdr; + asection *section; + Elf_Internal_Sym *local_syms = NULL; + + if (!is_kvx_elf (input_bfd) + || (input_bfd->flags & BFD_LINKER_CREATED) != 0) + continue; + + /* We'll need the symbol table in a second. */ + symtab_hdr = &elf_tdata (input_bfd)->symtab_hdr; + if (symtab_hdr->sh_info == 0) + continue; + + /* Walk over each section attached to the input bfd. */ + for (section = input_bfd->sections; + section != NULL; section = section->next) + { + Elf_Internal_Rela *internal_relocs, *irelaend, *irela; + + /* If there aren't any relocs, then there's nothing more + to do. */ + if ((section->flags & SEC_RELOC) == 0 + || section->reloc_count == 0 + || (section->flags & SEC_CODE) == 0) + continue; + + /* If this section is a link-once section that will be + discarded, then don't create any stubs. */ + if (section->output_section == NULL + || section->output_section->owner != output_bfd) + continue; + + /* Get the relocs. */ + internal_relocs + = _bfd_elf_link_read_relocs (input_bfd, section, NULL, + NULL, info->keep_memory); + if (internal_relocs == NULL) + goto error_ret_free_local; + + /* Now examine each relocation. */ + irela = internal_relocs; + irelaend = irela + section->reloc_count; + for (; irela < irelaend; irela++) + { + unsigned int r_type, r_indx; + enum elf_kvx_stub_type stub_type; + struct elf_kvx_stub_hash_entry *stub_entry; + asection *sym_sec; + bfd_vma sym_value; + bfd_vma destination; + struct elf_kvx_link_hash_entry *hash; + const char *sym_name; + char *stub_name; + const asection *id_sec; + unsigned char st_type; + bfd_size_type len; + + r_type = ELFNN_R_TYPE (irela->r_info); + r_indx = ELFNN_R_SYM (irela->r_info); + + if (r_type >= (unsigned int) R_KVX_end) + { + bfd_set_error (bfd_error_bad_value); + error_ret_free_internal: + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + goto error_ret_free_local; + } + + /* Only look for stubs on unconditional branch and + branch and link instructions. */ + /* This catches CALL and GOTO insn */ + if (r_type != (unsigned int) R_KVX_PCREL27) + continue; + + /* Now determine the call target, its name, value, + section. */ + sym_sec = NULL; + sym_value = 0; + destination = 0; + hash = NULL; + sym_name = NULL; + if (r_indx < symtab_hdr->sh_info) + { + /* It's a local symbol. */ + Elf_Internal_Sym *sym; + Elf_Internal_Shdr *hdr; + + if (local_syms == NULL) + { + local_syms + = (Elf_Internal_Sym *) symtab_hdr->contents; + if (local_syms == NULL) + local_syms + = bfd_elf_get_elf_syms (input_bfd, symtab_hdr, + symtab_hdr->sh_info, 0, + NULL, NULL, NULL); + if (local_syms == NULL) + goto error_ret_free_internal; + } + + sym = local_syms + r_indx; + hdr = elf_elfsections (input_bfd)[sym->st_shndx]; + sym_sec = hdr->bfd_section; + if (!sym_sec) + /* This is an undefined symbol. It can never + be resolved. */ + continue; + + if (ELF_ST_TYPE (sym->st_info) != STT_SECTION) + sym_value = sym->st_value; + destination = (sym_value + irela->r_addend + + sym_sec->output_offset + + sym_sec->output_section->vma); + st_type = ELF_ST_TYPE (sym->st_info); + sym_name + = bfd_elf_string_from_elf_section (input_bfd, + symtab_hdr->sh_link, + sym->st_name); + } + else + { + int e_indx; + + e_indx = r_indx - symtab_hdr->sh_info; + hash = ((struct elf_kvx_link_hash_entry *) + elf_sym_hashes (input_bfd)[e_indx]); + + while (hash->root.root.type == bfd_link_hash_indirect + || hash->root.root.type == bfd_link_hash_warning) + hash = ((struct elf_kvx_link_hash_entry *) + hash->root.root.u.i.link); + + if (hash->root.root.type == bfd_link_hash_defined + || hash->root.root.type == bfd_link_hash_defweak) + { + struct elf_kvx_link_hash_table *globals = + elf_kvx_hash_table (info); + sym_sec = hash->root.root.u.def.section; + sym_value = hash->root.root.u.def.value; + /* For a destination in a shared library, + use the PLT stub as target address to + decide whether a branch stub is + needed. */ + if (globals->root.splt != NULL && hash != NULL + && hash->root.plt.offset != (bfd_vma) - 1) + { + sym_sec = globals->root.splt; + sym_value = hash->root.plt.offset; + if (sym_sec->output_section != NULL) + destination = (sym_value + + sym_sec->output_offset + + + sym_sec->output_section->vma); + } + else if (sym_sec->output_section != NULL) + destination = (sym_value + irela->r_addend + + sym_sec->output_offset + + sym_sec->output_section->vma); + } + else if (hash->root.root.type == bfd_link_hash_undefined + || (hash->root.root.type + == bfd_link_hash_undefweak)) + { + /* For a shared library, use the PLT stub as + target address to decide whether a long + branch stub is needed. + For absolute code, they cannot be handled. */ + struct elf_kvx_link_hash_table *globals = + elf_kvx_hash_table (info); + + if (globals->root.splt != NULL && hash != NULL + && hash->root.plt.offset != (bfd_vma) - 1) + { + sym_sec = globals->root.splt; + sym_value = hash->root.plt.offset; + if (sym_sec->output_section != NULL) + destination = (sym_value + + sym_sec->output_offset + + + sym_sec->output_section->vma); + } + else + continue; + } + else + { + bfd_set_error (bfd_error_bad_value); + goto error_ret_free_internal; + } + st_type = ELF_ST_TYPE (hash->root.type); + sym_name = hash->root.root.root.string; + } + + /* Determine what (if any) linker stub is needed. */ + stub_type = kvx_type_of_stub (section, irela, sym_sec, + st_type, destination); + if (stub_type == kvx_stub_none) + continue; + + /* Support for grouping stub sections. */ + id_sec = htab->stub_group[section->id].link_sec; + + /* Get the name of this stub. */ + stub_name = elfNN_kvx_stub_name (id_sec, sym_sec, hash, + irela); + if (!stub_name) + goto error_ret_free_internal; + + stub_entry = + kvx_stub_hash_lookup (&htab->stub_hash_table, + stub_name, false, false); + if (stub_entry != NULL) + { + /* The proper stub has already been created. */ + free (stub_name); + /* Always update this stub's target since it may have + changed after layout. */ + stub_entry->target_value = sym_value + irela->r_addend; + continue; + } + + stub_entry = _bfd_kvx_add_stub_entry_in_group + (stub_name, section, htab); + if (stub_entry == NULL) + { + free (stub_name); + goto error_ret_free_internal; + } + + stub_entry->target_value = sym_value + irela->r_addend; + stub_entry->target_section = sym_sec; + stub_entry->stub_type = stub_type; + stub_entry->h = hash; + stub_entry->st_type = st_type; + + if (sym_name == NULL) + sym_name = "unnamed"; + len = sizeof (STUB_ENTRY_NAME) + strlen (sym_name); + stub_entry->output_name = bfd_alloc (htab->stub_bfd, len); + if (stub_entry->output_name == NULL) + { + free (stub_name); + goto error_ret_free_internal; + } + + snprintf (stub_entry->output_name, len, STUB_ENTRY_NAME, + sym_name); + + stub_changed = true; + } + + /* We're done with the internal relocs, free them. */ + if (elf_section_data (section)->relocs == NULL) + free (internal_relocs); + } + } + + if (!stub_changed) + break; + + _bfd_kvx_resize_stubs (htab); + + /* Ask the linker to do its stuff. */ + (*htab->layout_sections_again) (); + stub_changed = false; + } + + return true; + +error_ret_free_local: + return false; + +} + +/* Build all the stubs associated with the current output file. The + stubs are kept in a hash table attached to the main linker hash + table. We also set up the .plt entries for statically linked PIC + functions here. This function is called via kvx_elf_finish in the + linker. */ + +bool +elfNN_kvx_build_stubs (struct bfd_link_info *info) +{ + asection *stub_sec; + struct bfd_hash_table *table; + struct elf_kvx_link_hash_table *htab; + + htab = elf_kvx_hash_table (info); + + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; stub_sec = stub_sec->next) + { + bfd_size_type size; + + /* Ignore non-stub sections. */ + if (!strstr (stub_sec->name, STUB_SUFFIX)) + continue; + + /* Allocate memory to hold the linker stubs. */ + size = stub_sec->size; + stub_sec->contents = bfd_zalloc (htab->stub_bfd, size); + if (stub_sec->contents == NULL && size != 0) + return false; + stub_sec->size = 0; + } + + /* Build the stubs as directed by the stub hash table. */ + table = &htab->stub_hash_table; + bfd_hash_traverse (table, kvx_build_one_stub, info); + + return true; +} + +static bfd_vma +kvx_calculate_got_entry_vma (struct elf_link_hash_entry *h, + struct elf_kvx_link_hash_table + *globals, struct bfd_link_info *info, + bfd_vma value, bfd *output_bfd, + bool *unresolved_reloc_p) +{ + bfd_vma off = (bfd_vma) - 1; + asection *basegot = globals->root.sgot; + bool dyn = globals->root.dynamic_sections_created; + + if (h != NULL) + { + BFD_ASSERT (basegot != NULL); + off = h->got.offset; + BFD_ASSERT (off != (bfd_vma) - 1); + if (!WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, bfd_link_pic (info), h) + || (bfd_link_pic (info) + && SYMBOL_REFERENCES_LOCAL (info, h)) + || (ELF_ST_VISIBILITY (h->other) + && h->root.type == bfd_link_hash_undefweak)) + { + /* This is actually a static link, or it is a -Bsymbolic link + and the symbol is defined locally. We must initialize this + entry in the global offset table. Since the offset must + always be a multiple of 8 (4 in the case of ILP32), we use + the least significant bit to record whether we have + initialized it already. + When doing a dynamic link, we create a .rel(a).got relocation + entry to initialize the value. This is done in the + finish_dynamic_symbol routine. */ + if ((off & 1) != 0) + off &= ~1; + else + { + bfd_put_NN (output_bfd, value, basegot->contents + off); + h->got.offset |= 1; + } + } + else + *unresolved_reloc_p = false; + } + + return off; +} + +static unsigned int +kvx_reloc_got_type (bfd_reloc_code_real_type r_type) +{ + switch (r_type) + { + /* Extracted with: + awk 'match ($0, /HOWTO.*R_(KVX.*_GOT(OFF)?(64)?_.*),/,ary) {print "case BFD_RELOC_" ary[1] ":";}' elfxx-kvxc.def + */ + case BFD_RELOC_KVX_S37_GOTOFF_LO10: + case BFD_RELOC_KVX_S37_GOTOFF_UP27: + + case BFD_RELOC_KVX_S37_GOT_LO10: + case BFD_RELOC_KVX_S37_GOT_UP27: + + case BFD_RELOC_KVX_S43_GOTOFF_LO10: + case BFD_RELOC_KVX_S43_GOTOFF_UP27: + case BFD_RELOC_KVX_S43_GOTOFF_EX6: + + case BFD_RELOC_KVX_S43_GOT_LO10: + case BFD_RELOC_KVX_S43_GOT_UP27: + case BFD_RELOC_KVX_S43_GOT_EX6: + return GOT_NORMAL; + + case BFD_RELOC_KVX_S37_TLS_GD_LO10: + case BFD_RELOC_KVX_S37_TLS_GD_UP27: + case BFD_RELOC_KVX_S43_TLS_GD_LO10: + case BFD_RELOC_KVX_S43_TLS_GD_UP27: + case BFD_RELOC_KVX_S43_TLS_GD_EX6: + return GOT_TLS_GD; + + case BFD_RELOC_KVX_S37_TLS_LD_LO10: + case BFD_RELOC_KVX_S37_TLS_LD_UP27: + case BFD_RELOC_KVX_S43_TLS_LD_LO10: + case BFD_RELOC_KVX_S43_TLS_LD_UP27: + case BFD_RELOC_KVX_S43_TLS_LD_EX6: + return GOT_TLS_LD; + + case BFD_RELOC_KVX_S37_TLS_IE_LO10: + case BFD_RELOC_KVX_S37_TLS_IE_UP27: + case BFD_RELOC_KVX_S43_TLS_IE_LO10: + case BFD_RELOC_KVX_S43_TLS_IE_UP27: + case BFD_RELOC_KVX_S43_TLS_IE_EX6: + return GOT_TLS_IE; + + default: + break; + } + return GOT_UNKNOWN; +} + +static bool +kvx_can_relax_tls (bfd *input_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info ATTRIBUTE_UNUSED, + bfd_reloc_code_real_type r_type ATTRIBUTE_UNUSED, + struct elf_link_hash_entry *h ATTRIBUTE_UNUSED, + unsigned long r_symndx ATTRIBUTE_UNUSED) +{ + if (! IS_KVX_TLS_RELAX_RELOC (r_type)) + return false; + + /* Relaxing hook. Disabled on KVX. */ + /* See elfnn-aarch64.c */ + return true; +} + +/* Given the relocation code R_TYPE, return the relaxed bfd reloc + enumerator. */ + +static bfd_reloc_code_real_type +kvx_tls_transition (bfd *input_bfd, + struct bfd_link_info *info, + unsigned int r_type, + struct elf_link_hash_entry *h, + unsigned long r_symndx) +{ + bfd_reloc_code_real_type bfd_r_type + = elfNN_kvx_bfd_reloc_from_type (input_bfd, r_type); + + if (! kvx_can_relax_tls (input_bfd, info, bfd_r_type, h, r_symndx)) + return bfd_r_type; + + return bfd_r_type; +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving R_KVX_*_TLS_GD_* and R_KVX_*_TLS_LD_* relocation. */ + +static bfd_vma +dtpoff_base (struct bfd_link_info *info) +{ + /* If tls_sec is NULL, we should have signalled an error already. */ + BFD_ASSERT (elf_hash_table (info)->tls_sec != NULL); + return elf_hash_table (info)->tls_sec->vma; +} + +/* Return the base VMA address which should be subtracted from real addresses + when resolving R_KVX_*_TLS_IE_* and R_KVX_*_TLS_LE_* relocations. */ + +static bfd_vma +tpoff_base (struct bfd_link_info *info) +{ + struct elf_link_hash_table *htab = elf_hash_table (info); + + /* If tls_sec is NULL, we should have signalled an error already. */ + BFD_ASSERT (htab->tls_sec != NULL); + + bfd_vma base = align_power ((bfd_vma) 0, + htab->tls_sec->alignment_power); + return htab->tls_sec->vma - base; +} + +static bfd_vma * +symbol_got_offset_ref (bfd *input_bfd, struct elf_link_hash_entry *h, + unsigned long r_symndx) +{ + /* Calculate the address of the GOT entry for symbol + referred to in h. */ + if (h != NULL) + return &h->got.offset; + else + { + /* local symbol */ + struct elf_kvx_local_symbol *l; + + l = elf_kvx_locals (input_bfd); + return &l[r_symndx].got_offset; + } +} + +static void +symbol_got_offset_mark (bfd *input_bfd, struct elf_link_hash_entry *h, + unsigned long r_symndx) +{ + bfd_vma *p; + p = symbol_got_offset_ref (input_bfd, h, r_symndx); + *p |= 1; +} + +static int +symbol_got_offset_mark_p (bfd *input_bfd, struct elf_link_hash_entry *h, + unsigned long r_symndx) +{ + bfd_vma value; + value = * symbol_got_offset_ref (input_bfd, h, r_symndx); + return value & 1; +} + +static bfd_vma +symbol_got_offset (bfd *input_bfd, struct elf_link_hash_entry *h, + unsigned long r_symndx) +{ + bfd_vma value; + value = * symbol_got_offset_ref (input_bfd, h, r_symndx); + value &= ~1; + return value; +} + +/* N_ONES produces N one bits, without overflowing machine arithmetic. */ +#define N_ONES(n) (((((bfd_vma) 1 << ((n) -1)) - 1) << 1) | 1) + +/* + * This is a copy/paste + modification from + * reloc.c:_bfd_relocate_contents. Relocations are applied to 32bits + * words, so all overflow checks will overflow for values above + * 32bits. + */ +static bfd_reloc_status_type +check_signed_overflow (enum complain_overflow complain_on_overflow, + bfd_reloc_code_real_type bfd_r_type, bfd *input_bfd, + bfd_vma relocation) +{ + bfd_reloc_status_type flag = bfd_reloc_ok; + bfd_vma addrmask, fieldmask, signmask, ss; + bfd_vma a, b, sum; + bfd_vma x = 0; + + /* These usually come from howto struct. As we don't check for + * values fitting in bitfields or in subpart of words, we set all + * these to values to check as if the field is starting from first + * bit. + */ + unsigned int rightshift = 0; + unsigned int bitpos = 0; + unsigned int bitsize = 0; + bfd_vma src_mask = -1; + + /* Only regular symbol relocations are checked here. Others + relocations (GOT, TLS) could be checked if the need is + confirmed. At the moment, we keep previous behavior + (ie. unchecked) for those. */ + switch (bfd_r_type) + { + case BFD_RELOC_KVX_S37_LO10: + case BFD_RELOC_KVX_S37_UP27: + bitsize = 37; + break; + + case BFD_RELOC_KVX_S32_LO5: + case BFD_RELOC_KVX_S32_UP27: + bitsize = 32; + break; + + case BFD_RELOC_KVX_S43_LO10: + case BFD_RELOC_KVX_S43_UP27: + case BFD_RELOC_KVX_S43_EX6: + bitsize = 43; + break; + + case BFD_RELOC_KVX_S64_LO10: + case BFD_RELOC_KVX_S64_UP27: + case BFD_RELOC_KVX_S64_EX27: + bitsize = 64; + break; + + default: + return bfd_reloc_ok; + } + + /* direct copy/paste from reloc.c below */ + + /* Get the values to be added together. For signed and unsigned + relocations, we assume that all values should be truncated to + the size of an address. For bitfields, all the bits matter. + See also bfd_check_overflow. */ + fieldmask = N_ONES (bitsize); + signmask = ~fieldmask; + addrmask = (N_ONES (bfd_arch_bits_per_address (input_bfd)) + | (fieldmask << rightshift)); + a = (relocation & addrmask) >> rightshift; + b = (x & src_mask & addrmask) >> bitpos; + addrmask >>= rightshift; + + switch (complain_on_overflow) + { + case complain_overflow_signed: + /* If any sign bits are set, all sign bits must be set. + That is, A must be a valid negative address after + shifting. */ + signmask = ~(fieldmask >> 1); + /* Fall thru */ + + case complain_overflow_bitfield: + /* Much like the signed check, but for a field one bit + wider. We allow a bitfield to represent numbers in the + range -2**n to 2**n-1, where n is the number of bits in the + field. Note that when bfd_vma is 32 bits, a 32-bit reloc + can't overflow, which is exactly what we want. */ + ss = a & signmask; + if (ss != 0 && ss != (addrmask & signmask)) + flag = bfd_reloc_overflow; + + /* We only need this next bit of code if the sign bit of B + is below the sign bit of A. This would only happen if + SRC_MASK had fewer bits than BITSIZE. Note that if + SRC_MASK has more bits than BITSIZE, we can get into + trouble; we would need to verify that B is in range, as + we do for A above. */ + ss = ((~src_mask) >> 1) & src_mask; + ss >>= bitpos; + + /* Set all the bits above the sign bit. */ + b = (b ^ ss) - ss; + + /* Now we can do the addition. */ + sum = a + b; + + /* See if the result has the correct sign. Bits above the + sign bit are junk now; ignore them. If the sum is + positive, make sure we did not have all negative inputs; + if the sum is negative, make sure we did not have all + positive inputs. The test below looks only at the sign + bits, and it really just + SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM) + + We mask with addrmask here to explicitly allow an address + wrap-around. The Linux kernel relies on it, and it is + the only way to write assembler code which can run when + loaded at a location 0x80000000 away from the location at + which it is linked. */ + if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask) + flag = bfd_reloc_overflow; + break; + + case complain_overflow_unsigned: + /* Checking for an unsigned overflow is relatively easy: + trim the addresses and add, and trim the result as well. + Overflow is normally indicated when the result does not + fit in the field. However, we also need to consider the + case when, e.g., fieldmask is 0x7fffffff or smaller, an + input is 0x80000000, and bfd_vma is only 32 bits; then we + will get sum == 0, but there is an overflow, since the + inputs did not fit in the field. Instead of doing a + separate test, we can check for this by or-ing in the + operands when testing for the sum overflowing its final + field. */ + sum = (a + b) & addrmask; + if ((a | b | sum) & signmask) + flag = bfd_reloc_overflow; + break; + + default: + abort (); + } + return flag; +} + +/* Perform a relocation as part of a final link. */ +static bfd_reloc_status_type +elfNN_kvx_final_link_relocate (reloc_howto_type *howto, + bfd *input_bfd, + bfd *output_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *rel, + bfd_vma value, + struct bfd_link_info *info, + asection *sym_sec, + struct elf_link_hash_entry *h, + bool *unresolved_reloc_p, + bool save_addend, + bfd_vma *saved_addend, + Elf_Internal_Sym *sym) +{ + Elf_Internal_Shdr *symtab_hdr; + unsigned int r_type = howto->type; + bfd_reloc_code_real_type bfd_r_type + = elfNN_kvx_bfd_reloc_from_howto (howto); + bfd_reloc_code_real_type new_bfd_r_type; + unsigned long r_symndx; + bfd_byte *hit_data = contents + rel->r_offset; + bfd_vma place, off; + bfd_signed_vma signed_addend; + struct elf_kvx_link_hash_table *globals; + bool weak_undef_p; + asection *base_got; + bfd_reloc_status_type rret = bfd_reloc_ok; + globals = elf_kvx_hash_table (info); + + symtab_hdr = &elf_symtab_hdr (input_bfd); + + BFD_ASSERT (is_kvx_elf (input_bfd)); + + r_symndx = ELFNN_R_SYM (rel->r_info); + + /* It is possible to have linker relaxations on some TLS access + models. Update our information here. */ + new_bfd_r_type = kvx_tls_transition (input_bfd, info, r_type, h, r_symndx); + if (new_bfd_r_type != bfd_r_type) + { + bfd_r_type = new_bfd_r_type; + howto = elfNN_kvx_howto_from_bfd_reloc (bfd_r_type); + BFD_ASSERT (howto != NULL); + r_type = howto->type; + } + + place = input_section->output_section->vma + + input_section->output_offset + rel->r_offset; + + /* Get addend, accumulating the addend for consecutive relocs + which refer to the same offset. */ + signed_addend = saved_addend ? *saved_addend : 0; + signed_addend += rel->r_addend; + + weak_undef_p = (h ? h->root.type == bfd_link_hash_undefweak + : bfd_is_und_section (sym_sec)); + + switch (bfd_r_type) + { + case BFD_RELOC_KVX_NN: +#if ARCH_SIZE == 64 + case BFD_RELOC_KVX_32: +#endif + case BFD_RELOC_KVX_S37_LO10: + case BFD_RELOC_KVX_S37_UP27: + + case BFD_RELOC_KVX_S32_LO5: + case BFD_RELOC_KVX_S32_UP27: + + case BFD_RELOC_KVX_S43_LO10: + case BFD_RELOC_KVX_S43_UP27: + case BFD_RELOC_KVX_S43_EX6: + + case BFD_RELOC_KVX_S64_LO10: + case BFD_RELOC_KVX_S64_UP27: + case BFD_RELOC_KVX_S64_EX27: + /* When generating a shared object or relocatable executable, these + relocations are copied into the output file to be resolved at + run time. */ + if (((bfd_link_pic (info) == true) + || globals->root.is_relocatable_executable) + && (input_section->flags & SEC_ALLOC) + && (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak)) + { + Elf_Internal_Rela outrel; + bfd_byte *loc; + bool skip, relocate; + asection *sreloc; + + *unresolved_reloc_p = false; + + skip = false; + relocate = false; + + outrel.r_addend = signed_addend; + outrel.r_offset = + _bfd_elf_section_offset (output_bfd, info, input_section, + rel->r_offset); + if (outrel.r_offset == (bfd_vma) - 1) + skip = true; + else if (outrel.r_offset == (bfd_vma) - 2) + { + skip = true; + relocate = true; + } + + outrel.r_offset += (input_section->output_section->vma + + input_section->output_offset); + + if (skip) + memset (&outrel, 0, sizeof outrel); + else if (h != NULL + && h->dynindx != -1 + && (!bfd_link_pic (info) || !info->symbolic || !h->def_regular)) + outrel.r_info = ELFNN_R_INFO (h->dynindx, r_type); + else if (bfd_r_type == BFD_RELOC_KVX_32 + || bfd_r_type == BFD_RELOC_KVX_64) + { + int symbol; + + /* On SVR4-ish systems, the dynamic loader cannot + relocate the text and data segments independently, + so the symbol does not matter. */ + symbol = 0; + outrel.r_info = ELFNN_R_INFO (symbol, R_KVX_RELATIVE); + outrel.r_addend += value; + } + else if (bfd_link_pic (info) && info->symbolic) + { + goto skip_because_pic; + } + else + { + /* We may endup here from bad input code trying to + insert relocation on symbols within code. We do not + want that currently, and such code should use GOT + + KVX_32/64 reloc that translate in KVX_RELATIVE + */ + const char *name; + if (h && h->root.root.string) + name = h->root.root.string; + else + name = bfd_elf_sym_name (input_bfd, symtab_hdr, sym, + NULL); + + (*_bfd_error_handler) + /* xgettext:c-format */ + (_("%pB(%pA+%#" PRIx64 "): " + "unresolvable %s relocation in section `%s'"), + input_bfd, input_section, (uint64_t) rel->r_offset, howto->name, + name); + return bfd_reloc_notsupported; + } + + sreloc = elf_section_data (input_section)->sreloc; + if (sreloc == NULL || sreloc->contents == NULL) + return bfd_reloc_notsupported; + + loc = sreloc->contents + sreloc->reloc_count++ * RELOC_SIZE (globals); + bfd_elfNN_swap_reloca_out (output_bfd, &outrel, loc); + + if (sreloc->reloc_count * RELOC_SIZE (globals) > sreloc->size) + { + /* Sanity to check that we have previously allocated + sufficient space in the relocation section for the + number of relocations we actually want to emit. */ + abort (); + } + + /* If this reloc is against an external symbol, we do not want to + fiddle with the addend. Otherwise, we need to include the symbol + value so that it becomes an addend for the dynamic reloc. */ + if (!relocate) + return bfd_reloc_ok; + + rret = check_signed_overflow (complain_overflow_signed, bfd_r_type, + input_bfd, value + signed_addend); + if (rret != bfd_reloc_ok) + return rret; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + } + + skip_because_pic: + rret = check_signed_overflow (complain_overflow_signed, bfd_r_type, + input_bfd, value + signed_addend); + if (rret != bfd_reloc_ok) + return rret; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + break; + + case BFD_RELOC_KVX_PCREL17: + case BFD_RELOC_KVX_PCREL27: + { + /* + * BCU insn are always first in a bundle, so there is no need + * to correct the address using offset within bundle + */ + + asection *splt = globals->root.splt; + bool via_plt_p = + splt != NULL && h != NULL && h->plt.offset != (bfd_vma) - 1; + + /* A call to an undefined weak symbol is converted to a jump to + the next instruction unless a PLT entry will be created. + The jump to the next instruction is optimized as a NOP. + Do the same for local undefined symbols. */ + if (weak_undef_p && ! via_plt_p) + { + bfd_putl32 (INSN_NOP, hit_data); + return bfd_reloc_ok; + } + + /* If the call goes through a PLT entry, make sure to + check distance to the right destination address. */ + if (via_plt_p) + value = (splt->output_section->vma + + splt->output_offset + h->plt.offset); + + /* Check if a stub has to be inserted because the destination + is too far away. */ + struct elf_kvx_stub_hash_entry *stub_entry = NULL; + + /* If the target symbol is global and marked as a function the + relocation applies a function call or a tail call. In this + situation we can veneer out of range branches. The veneers + use R16 and R17 hence cannot be used arbitrary out of range + branches that occur within the body of a function. */ + + /* Check if a stub has to be inserted because the destination + is too far away. */ + if (! kvx_valid_call_p (value, place)) + { + /* The target is out of reach, so redirect the branch to + the local stub for this function. */ + stub_entry = elfNN_kvx_get_stub_entry (input_section, + sym_sec, h, + rel, globals); + if (stub_entry != NULL) + value = (stub_entry->stub_offset + + stub_entry->stub_sec->output_offset + + stub_entry->stub_sec->output_section->vma); + /* We have redirected the destination to stub entry address, + so ignore any addend record in the original rela entry. */ + signed_addend = 0; + } + } + *unresolved_reloc_p = false; + + /* FALLTHROUGH */ + + /* PCREL 32 are used in dwarf2 table for exception handling */ + case BFD_RELOC_KVX_32_PCREL: + case BFD_RELOC_KVX_S64_PCREL_LO10: + case BFD_RELOC_KVX_S64_PCREL_UP27: + case BFD_RELOC_KVX_S64_PCREL_EX27: + case BFD_RELOC_KVX_S37_PCREL_LO10: + case BFD_RELOC_KVX_S37_PCREL_UP27: + case BFD_RELOC_KVX_S43_PCREL_LO10: + case BFD_RELOC_KVX_S43_PCREL_UP27: + case BFD_RELOC_KVX_S43_PCREL_EX6: + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + break; + + case BFD_RELOC_KVX_S37_TLS_LE_LO10: + case BFD_RELOC_KVX_S37_TLS_LE_UP27: + + case BFD_RELOC_KVX_S43_TLS_LE_LO10: + case BFD_RELOC_KVX_S43_TLS_LE_UP27: + case BFD_RELOC_KVX_S43_TLS_LE_EX6: + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value - tpoff_base (info), + signed_addend); + break; + + case BFD_RELOC_KVX_S37_TLS_DTPOFF_LO10: + case BFD_RELOC_KVX_S37_TLS_DTPOFF_UP27: + + case BFD_RELOC_KVX_S43_TLS_DTPOFF_LO10: + case BFD_RELOC_KVX_S43_TLS_DTPOFF_UP27: + case BFD_RELOC_KVX_S43_TLS_DTPOFF_EX6: + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value - dtpoff_base (info), + signed_addend); + + case BFD_RELOC_KVX_S37_TLS_GD_UP27: + case BFD_RELOC_KVX_S37_TLS_GD_LO10: + + case BFD_RELOC_KVX_S43_TLS_GD_UP27: + case BFD_RELOC_KVX_S43_TLS_GD_EX6: + case BFD_RELOC_KVX_S43_TLS_GD_LO10: + + case BFD_RELOC_KVX_S37_TLS_IE_UP27: + case BFD_RELOC_KVX_S37_TLS_IE_LO10: + + case BFD_RELOC_KVX_S43_TLS_IE_UP27: + case BFD_RELOC_KVX_S43_TLS_IE_EX6: + case BFD_RELOC_KVX_S43_TLS_IE_LO10: + + case BFD_RELOC_KVX_S37_TLS_LD_UP27: + case BFD_RELOC_KVX_S37_TLS_LD_LO10: + + case BFD_RELOC_KVX_S43_TLS_LD_UP27: + case BFD_RELOC_KVX_S43_TLS_LD_EX6: + case BFD_RELOC_KVX_S43_TLS_LD_LO10: + + if (globals->root.sgot == NULL) + return bfd_reloc_notsupported; + value = symbol_got_offset (input_bfd, h, r_symndx); + + _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + *unresolved_reloc_p = false; + break; + + case BFD_RELOC_KVX_S37_GOTADDR_UP27: + case BFD_RELOC_KVX_S37_GOTADDR_LO10: + + case BFD_RELOC_KVX_S43_GOTADDR_UP27: + case BFD_RELOC_KVX_S43_GOTADDR_EX6: + case BFD_RELOC_KVX_S43_GOTADDR_LO10: + + case BFD_RELOC_KVX_S64_GOTADDR_UP27: + case BFD_RELOC_KVX_S64_GOTADDR_EX27: + case BFD_RELOC_KVX_S64_GOTADDR_LO10: + { + if (globals->root.sgot == NULL) + BFD_ASSERT (h != NULL); + + value = globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + } + break; + + case BFD_RELOC_KVX_S37_GOTOFF_LO10: + case BFD_RELOC_KVX_S37_GOTOFF_UP27: + + case BFD_RELOC_KVX_32_GOTOFF: + case BFD_RELOC_KVX_64_GOTOFF: + + case BFD_RELOC_KVX_S43_GOTOFF_LO10: + case BFD_RELOC_KVX_S43_GOTOFF_UP27: + case BFD_RELOC_KVX_S43_GOTOFF_EX6: + + { + asection *basegot = globals->root.sgot; + /* BFD_ASSERT(h == NULL); */ + BFD_ASSERT(globals->root.sgot != NULL); + value -= basegot->output_section->vma + basegot->output_offset; + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + } + break; + + case BFD_RELOC_KVX_S37_GOT_LO10: + case BFD_RELOC_KVX_S37_GOT_UP27: + + case BFD_RELOC_KVX_32_GOT: + case BFD_RELOC_KVX_64_GOT: + + case BFD_RELOC_KVX_S43_GOT_LO10: + case BFD_RELOC_KVX_S43_GOT_UP27: + case BFD_RELOC_KVX_S43_GOT_EX6: + + if (globals->root.sgot == NULL) + BFD_ASSERT (h != NULL); + + if (h != NULL) + { + value = kvx_calculate_got_entry_vma (h, globals, info, value, + output_bfd, + unresolved_reloc_p); +#ifdef UGLY_DEBUG + printf("GOT_LO/HI for %s, value %x\n", h->root.root.string, value); +#endif + + /* value = _bfd_kvx_elf_resolve_relocation (bfd_r_type, place, value, */ + /* 0, weak_undef_p); */ + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, value, + signed_addend); + } + else + { +#ifdef UGLY_DEBUG + printf("GOT_LO/HI with h NULL, initial value %x\n", value); +#endif + + bfd_vma addend = 0; + struct elf_kvx_local_symbol *locals + = elf_kvx_locals (input_bfd); + + if (locals == NULL) + { + int howto_index = bfd_r_type - BFD_RELOC_KVX_RELOC_START; + _bfd_error_handler + /* xgettext:c-format */ + (_("%pB: local symbol descriptor table be NULL when applying " + "relocation %s against local symbol"), + input_bfd, elf_kvx_howto_table[howto_index].name); + abort (); + } + + off = symbol_got_offset (input_bfd, h, r_symndx); + base_got = globals->root.sgot; + bfd_vma got_entry_addr = (base_got->output_section->vma + + base_got->output_offset + off); + + if (!symbol_got_offset_mark_p (input_bfd, h, r_symndx)) + { + bfd_put_64 (output_bfd, value, base_got->contents + off); + + if (bfd_link_pic (info)) + { + asection *s; + Elf_Internal_Rela outrel; + + /* For local symbol, we have done absolute relocation in static + linking stageh. While for share library, we need to update + the content of GOT entry according to the share objects + loading base address. So we need to generate a + R_AARCH64_RELATIVE reloc for dynamic linker. */ + s = globals->root.srelgot; + if (s == NULL) + abort (); + + outrel.r_offset = got_entry_addr; + outrel.r_info = ELFNN_R_INFO (0, R_KVX_RELATIVE); + outrel.r_addend = value; + elf_append_rela (output_bfd, s, &outrel); + } + + symbol_got_offset_mark (input_bfd, h, r_symndx); + } + + /* Update the relocation value to GOT entry addr as we have transformed + the direct data access into indirect data access through GOT. */ + value = got_entry_addr; + + return _bfd_final_link_relocate (howto, input_bfd, input_section, + contents, rel->r_offset, off, + addend); + } + break; + + default: + return bfd_reloc_notsupported; + } + + if (saved_addend) + *saved_addend = value; + + /* Only apply the final relocation in a sequence. */ + if (save_addend) + return bfd_reloc_continue; + + return _bfd_kvx_elf_put_addend (input_bfd, hit_data, bfd_r_type, + howto, value); +} + + + +/* Relocate a KVX ELF section. */ + +static int +elfNN_kvx_relocate_section (bfd *output_bfd, + struct bfd_link_info *info, + bfd *input_bfd, + asection *input_section, + bfd_byte *contents, + Elf_Internal_Rela *relocs, + Elf_Internal_Sym *local_syms, + asection **local_sections) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + Elf_Internal_Rela *rel; + Elf_Internal_Rela *relend; + const char *name; + struct elf_kvx_link_hash_table *globals; + bool save_addend = false; + bfd_vma addend = 0; + + globals = elf_kvx_hash_table (info); + + symtab_hdr = &elf_symtab_hdr (input_bfd); + sym_hashes = elf_sym_hashes (input_bfd); + + rel = relocs; + relend = relocs + input_section->reloc_count; + for (; rel < relend; rel++) + { + unsigned int r_type; + bfd_reloc_code_real_type bfd_r_type; + reloc_howto_type *howto; + unsigned long r_symndx; + Elf_Internal_Sym *sym; + asection *sec; + struct elf_link_hash_entry *h; + bfd_vma relocation; + bfd_reloc_status_type r; + arelent bfd_reloc; + char sym_type; + bool unresolved_reloc = false; + char *error_message = NULL; + + r_symndx = ELFNN_R_SYM (rel->r_info); + r_type = ELFNN_R_TYPE (rel->r_info); + + bfd_reloc.howto = elfNN_kvx_howto_from_type (input_bfd, r_type); + howto = bfd_reloc.howto; + + if (howto == NULL) + return _bfd_unrecognized_reloc (input_bfd, input_section, r_type); + + bfd_r_type = elfNN_kvx_bfd_reloc_from_howto (howto); + + h = NULL; + sym = NULL; + sec = NULL; + + if (r_symndx < symtab_hdr->sh_info) /* A local symbol. */ + { + sym = local_syms + r_symndx; + sym_type = ELFNN_ST_TYPE (sym->st_info); + sec = local_sections[r_symndx]; + + /* An object file might have a reference to a local + undefined symbol. This is a draft object file, but we + should at least do something about it. */ + if (r_type != R_KVX_NONE + && r_type != R_KVX_S37_GOTADDR_LO10 + && r_type != R_KVX_S37_GOTADDR_UP27 + && r_type != R_KVX_S64_GOTADDR_LO10 + && r_type != R_KVX_S64_GOTADDR_UP27 + && r_type != R_KVX_S64_GOTADDR_EX27 + && r_type != R_KVX_S43_GOTADDR_LO10 + && r_type != R_KVX_S43_GOTADDR_UP27 + && r_type != R_KVX_S43_GOTADDR_EX6 + && bfd_is_und_section (sec) + && ELF_ST_BIND (sym->st_info) != STB_WEAK) + (*info->callbacks->undefined_symbol) + (info, bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name), + input_bfd, input_section, rel->r_offset, true); + + relocation = _bfd_elf_rela_local_sym (output_bfd, sym, &sec, rel); + } + else + { + bool warned, ignored; + + RELOC_FOR_GLOBAL_SYMBOL (info, input_bfd, input_section, rel, + r_symndx, symtab_hdr, sym_hashes, + h, sec, relocation, + unresolved_reloc, warned, ignored); + + sym_type = h->type; + } + + if (sec != NULL && discarded_section (sec)) + RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, + rel, 1, relend, howto, 0, contents); + + if (bfd_link_relocatable (info)) + continue; + + if (h != NULL) + name = h->root.root.string; + else + { + name = (bfd_elf_string_from_elf_section + (input_bfd, symtab_hdr->sh_link, sym->st_name)); + if (name == NULL || *name == '\0') + name = bfd_section_name (sec); + } + + if (r_symndx != 0 + && r_type != R_KVX_NONE + && (h == NULL + || h->root.type == bfd_link_hash_defined + || h->root.type == bfd_link_hash_defweak) + && IS_KVX_TLS_RELOC (bfd_r_type) != (sym_type == STT_TLS)) + { + (*_bfd_error_handler) + ((sym_type == STT_TLS + /* xgettext:c-format */ + ? _("%pB(%pA+%#" PRIx64 "): %s used with TLS symbol %s") + /* xgettext:c-format */ + : _("%pB(%pA+%#" PRIx64 "): %s used with non-TLS symbol %s")), + input_bfd, + input_section, (long) rel->r_offset, howto->name, name); + } + + /* Original aarch64 has relaxation handling for TLS here. */ + r = bfd_reloc_continue; + + /* There may be multiple consecutive relocations for the + same offset. In that case we are supposed to treat the + output of each relocation as the addend for the next. */ + if (rel + 1 < relend + && rel->r_offset == rel[1].r_offset + && ELFNN_R_TYPE (rel[1].r_info) != R_KVX_NONE) + + save_addend = true; + else + save_addend = false; + + if (r == bfd_reloc_continue) + r = elfNN_kvx_final_link_relocate (howto, input_bfd, output_bfd, + input_section, contents, rel, + relocation, info, sec, + h, &unresolved_reloc, + save_addend, &addend, sym); + + switch (elfNN_kvx_bfd_reloc_from_type (input_bfd, r_type)) + { + case BFD_RELOC_KVX_S37_TLS_GD_LO10: + case BFD_RELOC_KVX_S37_TLS_GD_UP27: + + case BFD_RELOC_KVX_S43_TLS_GD_LO10: + case BFD_RELOC_KVX_S43_TLS_GD_UP27: + case BFD_RELOC_KVX_S43_TLS_GD_EX6: + + case BFD_RELOC_KVX_S37_TLS_LD_LO10: + case BFD_RELOC_KVX_S37_TLS_LD_UP27: + + case BFD_RELOC_KVX_S43_TLS_LD_LO10: + case BFD_RELOC_KVX_S43_TLS_LD_UP27: + case BFD_RELOC_KVX_S43_TLS_LD_EX6: + + if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx)) + { + bool need_relocs = false; + bfd_byte *loc; + int indx; + bfd_vma off; + + off = symbol_got_offset (input_bfd, h, r_symndx); + indx = h && h->dynindx != -1 ? h->dynindx : 0; + + need_relocs = + (bfd_link_pic (info) || indx != 0) && + (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak); + + BFD_ASSERT (globals->root.srelgot != NULL); + + if (need_relocs) + { + Elf_Internal_Rela rela; + rela.r_info = ELFNN_R_INFO (indx, R_KVX_64_DTPMOD); + rela.r_addend = 0; + rela.r_offset = globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset + off; + + loc = globals->root.srelgot->contents; + loc += globals->root.srelgot->reloc_count++ + * RELOC_SIZE (htab); + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + + bfd_reloc_code_real_type real_type = + elfNN_kvx_bfd_reloc_from_type (input_bfd, r_type); + + if (real_type == BFD_RELOC_KVX_S37_TLS_LD_LO10 + || real_type == BFD_RELOC_KVX_S37_TLS_LD_UP27 + || real_type == BFD_RELOC_KVX_S43_TLS_LD_LO10 + || real_type == BFD_RELOC_KVX_S43_TLS_LD_UP27 + || real_type == BFD_RELOC_KVX_S43_TLS_LD_EX6) + { + /* For local dynamic, don't generate DTPOFF in any case. + Initialize the DTPOFF slot into zero, so we get module + base address when invoke runtime TLS resolver. */ + bfd_put_NN (output_bfd, 0, + globals->root.sgot->contents + off + + GOT_ENTRY_SIZE); + } + else if (indx == 0) + { + bfd_put_NN (output_bfd, + relocation - dtpoff_base (info), + globals->root.sgot->contents + off + + GOT_ENTRY_SIZE); + } + else + { + /* This TLS symbol is global. We emit a + relocation to fixup the tls offset at load + time. */ + rela.r_info = + ELFNN_R_INFO (indx, R_KVX_64_DTPOFF); + rela.r_addend = 0; + rela.r_offset = + (globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset + off + + GOT_ENTRY_SIZE); + + loc = globals->root.srelgot->contents; + loc += globals->root.srelgot->reloc_count++ + * RELOC_SIZE (globals); + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + bfd_put_NN (output_bfd, (bfd_vma) 0, + globals->root.sgot->contents + off + + GOT_ENTRY_SIZE); + } + } + else + { + bfd_put_NN (output_bfd, (bfd_vma) 1, + globals->root.sgot->contents + off); + bfd_put_NN (output_bfd, + relocation - dtpoff_base (info), + globals->root.sgot->contents + off + + GOT_ENTRY_SIZE); + } + + symbol_got_offset_mark (input_bfd, h, r_symndx); + } + break; + + case BFD_RELOC_KVX_S37_TLS_IE_LO10: + case BFD_RELOC_KVX_S37_TLS_IE_UP27: + + case BFD_RELOC_KVX_S43_TLS_IE_LO10: + case BFD_RELOC_KVX_S43_TLS_IE_UP27: + case BFD_RELOC_KVX_S43_TLS_IE_EX6: + if (! symbol_got_offset_mark_p (input_bfd, h, r_symndx)) + { + bool need_relocs = false; + bfd_byte *loc; + int indx; + bfd_vma off; + + off = symbol_got_offset (input_bfd, h, r_symndx); + + indx = h && h->dynindx != -1 ? h->dynindx : 0; + + need_relocs = + (bfd_link_pic (info) || indx != 0) && + (h == NULL + || ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak); + + BFD_ASSERT (globals->root.srelgot != NULL); + + if (need_relocs) + { + Elf_Internal_Rela rela; + + if (indx == 0) + rela.r_addend = relocation - dtpoff_base (info); + else + rela.r_addend = 0; + + rela.r_info = ELFNN_R_INFO (indx, R_KVX_64_TPOFF); + rela.r_offset = globals->root.sgot->output_section->vma + + globals->root.sgot->output_offset + off; + + loc = globals->root.srelgot->contents; + loc += globals->root.srelgot->reloc_count++ + * RELOC_SIZE (htab); + + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + + bfd_put_NN (output_bfd, rela.r_addend, + globals->root.sgot->contents + off); + } + else + bfd_put_NN (output_bfd, relocation - tpoff_base (info), + globals->root.sgot->contents + off); + + symbol_got_offset_mark (input_bfd, h, r_symndx); + } + break; + + default: + break; + } + + /* Dynamic relocs are not propagated for SEC_DEBUGGING sections + because such sections are not SEC_ALLOC and thus ld.so will + not process them. */ + if (unresolved_reloc + && !((input_section->flags & SEC_DEBUGGING) != 0 + && h->def_dynamic) + && _bfd_elf_section_offset (output_bfd, info, input_section, + +rel->r_offset) != (bfd_vma) - 1) + { + (*_bfd_error_handler) + /* xgettext:c-format */ + (_("%pB(%pA+%#" PRIx64 "): " + "unresolvable %s relocation against symbol `%s'"), + input_bfd, input_section, (uint64_t) rel->r_offset, howto->name, + h->root.root.string); + return false; + } + + if (r != bfd_reloc_ok && r != bfd_reloc_continue) + { + switch (r) + { + case bfd_reloc_overflow: + (*info->callbacks->reloc_overflow) + (info, (h ? &h->root : NULL), name, howto->name, (bfd_vma) 0, + input_bfd, input_section, rel->r_offset); + + /* Original aarch64 code had a check for alignement correctness */ + break; + + case bfd_reloc_undefined: + (*info->callbacks->undefined_symbol) + (info, name, input_bfd, input_section, rel->r_offset, true); + break; + + case bfd_reloc_outofrange: + error_message = _("out of range"); + goto common_error; + + case bfd_reloc_notsupported: + error_message = _("unsupported relocation"); + goto common_error; + + case bfd_reloc_dangerous: + /* error_message should already be set. */ + goto common_error; + + default: + error_message = _("unknown error"); + /* Fall through. */ + + common_error: + BFD_ASSERT (error_message != NULL); + (*info->callbacks->reloc_dangerous) + (info, error_message, input_bfd, input_section, rel->r_offset); + break; + } + } + + if (!save_addend) + addend = 0; + } + + return true; +} + +/* Set the right machine number. */ + +static bool +elfNN_kvx_object_p (bfd *abfd) +{ + /* must be coherent with default arch in cpu-kvx.c */ + int e_set = bfd_mach_kv3_1; + + if (elf_elfheader (abfd)->e_machine == EM_KVX) + { + int e_core = elf_elfheader (abfd)->e_flags & ELF_KVX_CORE_MASK; + switch(e_core) + { +#if ARCH_SIZE == 64 + case ELF_KVX_CORE_KV3_1 : e_set = bfd_mach_kv3_1_64; break; + case ELF_KVX_CORE_KV3_2 : e_set = bfd_mach_kv3_2_64; break; + case ELF_KVX_CORE_KV4_1 : e_set = bfd_mach_kv4_1_64; break; +#else + case ELF_KVX_CORE_KV3_1 : e_set = bfd_mach_kv3_1; break; + case ELF_KVX_CORE_KV3_2 : e_set = bfd_mach_kv3_2; break; + case ELF_KVX_CORE_KV4_1 : e_set = bfd_mach_kv4_1; break; +#endif + default: + (*_bfd_error_handler)(_("%s: Bad ELF id: `%d'"), + abfd->filename, e_core); + } + } + return bfd_default_set_arch_mach (abfd, bfd_arch_kvx, e_set); + +} + +/* Function to keep KVX specific flags in the ELF header. */ + +static bool +elfNN_kvx_set_private_flags (bfd *abfd, flagword flags) +{ + if (elf_flags_init (abfd) && elf_elfheader (abfd)->e_flags != flags) + { + } + else + { + elf_elfheader (abfd)->e_flags = flags; + elf_flags_init (abfd) = true; + } + + return true; +} + +/* Merge backend specific data from an object file to the output + object file when linking. */ + +static bool +elfNN_kvx_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info) +{ + bfd *obfd = info->output_bfd; + flagword out_flags; + flagword in_flags; + bool flags_compatible = true; + asection *sec; + + /* Check if we have the same endianess. */ + if (!_bfd_generic_verify_endian_match (ibfd, info)) + return false; + + if (!is_kvx_elf (ibfd) || !is_kvx_elf (obfd)) + return true; + + /* The input BFD must have had its flags initialised. */ + /* The following seems bogus to me -- The flags are initialized in + the assembler but I don't think an elf_flags_init field is + written into the object. */ + /* BFD_ASSERT (elf_flags_init (ibfd)); */ + + if (bfd_get_arch_size (ibfd) != bfd_get_arch_size (obfd)) + { + const char *msg; + + if (bfd_get_arch_size (ibfd) == 32 + && bfd_get_arch_size (obfd) == 64) + msg = _("%s: compiled as 32-bit object and %s is 64-bit"); + else if (bfd_get_arch_size (ibfd) == 64 + && bfd_get_arch_size (obfd) == 32) + msg = _("%s: compiled as 64-bit object and %s is 32-bit"); + else + msg = _("%s: object size does not match that of target %s"); + + (*_bfd_error_handler) (msg, bfd_get_filename (ibfd), + bfd_get_filename (obfd)); + bfd_set_error (bfd_error_wrong_format); + return false; + } + + in_flags = elf_elfheader (ibfd)->e_flags; + out_flags = elf_elfheader (obfd)->e_flags; + + if (!elf_flags_init (obfd)) + { + /* If the input is the default architecture and had the default + flags then do not bother setting the flags for the output + architecture, instead allow future merges to do this. If no + future merges ever set these flags then they will retain their + uninitialised values, which surprise surprise, correspond + to the default values. */ + if (bfd_get_arch_info (ibfd)->the_default + && elf_elfheader (ibfd)->e_flags == 0) + return true; + + elf_flags_init (obfd) = true; + elf_elfheader (obfd)->e_flags = in_flags; + + if (bfd_get_arch (obfd) == bfd_get_arch (ibfd) + && bfd_get_arch_info (obfd)->the_default) + return bfd_set_arch_mach (obfd, bfd_get_arch (ibfd), + bfd_get_mach (ibfd)); + + return true; + } + + /* Identical flags must be compatible. */ + if (in_flags == out_flags) + return true; + + /* Check to see if the input BFD actually contains any sections. If + not, its flags may not have been initialised either, but it + cannot actually cause any incompatiblity. Do not short-circuit + dynamic objects; their section list may be emptied by + elf_link_add_object_symbols. + + Also check to see if there are no code sections in the input. + In this case there is no need to check for code specific flags. + XXX - do we need to worry about floating-point format compatability + in data sections ? */ + if (!(ibfd->flags & DYNAMIC)) + { + bool null_input_bfd = true; + bool only_data_sections = true; + + for (sec = ibfd->sections; sec != NULL; sec = sec->next) + { + if ((bfd_section_flags (sec) + & (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) + == (SEC_LOAD | SEC_CODE | SEC_HAS_CONTENTS)) + only_data_sections = false; + + null_input_bfd = false; + break; + } + + if (null_input_bfd || only_data_sections) + return true; + } + return flags_compatible; +} + +/* Display the flags field. */ + +static bool +elfNN_kvx_print_private_bfd_data (bfd *abfd, void *ptr) +{ + FILE *file = (FILE *) ptr; + unsigned long flags; + + BFD_ASSERT (abfd != NULL && ptr != NULL); + + /* Print normal ELF private data. */ + _bfd_elf_print_private_bfd_data (abfd, ptr); + + flags = elf_elfheader (abfd)->e_flags; + /* Ignore init flag - it may not be set, despite the flags field + containing valid data. */ + + /* xgettext:c-format */ + fprintf (file, _("Private flags = 0x%lx : "), elf_elfheader (abfd)->e_flags); + if((flags & ELF_KVX_ABI_64B_ADDR_BIT) == ELF_KVX_ABI_64B_ADDR_BIT) + { + if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV3_1)) + fprintf (file, _("Coolidge (kv3) V1 64 bits")); + else if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV3_2)) + fprintf (file, _("Coolidge (kv3) V2 64 bits")); + else if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV4_1)) + fprintf (file, _("Coolidge (kv4) V1 64 bits")); + } + else + { + if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV3_1)) + fprintf (file, _("Coolidge (kv3) V1 32 bits")); + else if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV3_2)) + fprintf (file, _("Coolidge (kv3) V2 32 bits")); + else if (ELF_KVX_CHECK_CORE(flags,ELF_KVX_CORE_KV4_1)) + fprintf (file, _("Coolidge (kv4) V1 32 bits")); + } + + fputc ('\n', file); + + return true; +} + +/* Adjust a symbol defined by a dynamic object and referenced by a + regular object. The current definition is in some section of the + dynamic object, but we're not including those sections. We have to + change the definition to something the rest of the link can + understand. */ + +static bool +elfNN_kvx_adjust_dynamic_symbol (struct bfd_link_info *info, + struct elf_link_hash_entry *h) +{ + struct elf_kvx_link_hash_table *htab; + asection *s; + + /* If this is a function, put it in the procedure linkage table. We + will fill in the contents of the procedure linkage table later, + when we know the address of the .got section. */ + if (h->type == STT_FUNC || h->needs_plt) + { + if (h->plt.refcount <= 0 + || ((SYMBOL_CALLS_LOCAL (info, h) + || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT + && h->root.type == bfd_link_hash_undefweak)))) + { + /* This case can occur if we saw a CALL26 reloc in + an input file, but the symbol wasn't referred to + by a dynamic object or all references were + garbage collected. In which case we can end up + resolving. */ + h->plt.offset = (bfd_vma) - 1; + h->needs_plt = 0; + } + + return true; + } + else + /* Otherwise, reset to -1. */ + h->plt.offset = (bfd_vma) - 1; + + + /* If this is a weak symbol, and there is a real definition, the + processor independent code will have arranged for us to see the + real definition first, and we can just use the same value. */ + if (h->is_weakalias) + { + struct elf_link_hash_entry *def = weakdef (h); + BFD_ASSERT (def->root.type == bfd_link_hash_defined); + h->root.u.def.section = def->root.u.def.section; + h->root.u.def.value = def->root.u.def.value; + if (ELIMINATE_COPY_RELOCS || info->nocopyreloc) + h->non_got_ref = def->non_got_ref; + return true; + } + + /* If we are creating a shared library, we must presume that the + only references to the symbol are via the global offset table. + For such cases we need not do anything here; the relocations will + be handled correctly by relocate_section. */ + if (bfd_link_pic (info)) + return true; + + /* If there are no references to this symbol that do not use the + GOT, we don't need to generate a copy reloc. */ + if (!h->non_got_ref) + return true; + + /* If -z nocopyreloc was given, we won't generate them either. */ + if (info->nocopyreloc) + { + h->non_got_ref = 0; + return true; + } + + /* We must allocate the symbol in our .dynbss section, which will + become part of the .bss section of the executable. There will be + an entry for this symbol in the .dynsym section. The dynamic + object will contain position independent code, so all references + from the dynamic object to this symbol will go through the global + offset table. The dynamic linker will use the .dynsym entry to + determine the address it must put in the global offset table, so + both the dynamic object and the regular object will refer to the + same memory location for the variable. */ + + htab = elf_kvx_hash_table (info); + + /* We must generate a R_KVX_COPY reloc to tell the dynamic linker + to copy the initial value out of the dynamic object and into the + runtime process image. */ + if ((h->root.u.def.section->flags & SEC_ALLOC) != 0 && h->size != 0) + { + htab->srelbss->size += RELOC_SIZE (htab); + h->needs_copy = 1; + } + + s = htab->sdynbss; + + return _bfd_elf_adjust_dynamic_copy (info, h, s); + +} + +static bool +elfNN_kvx_allocate_local_symbols (bfd *abfd, unsigned number) +{ + struct elf_kvx_local_symbol *locals; + locals = elf_kvx_locals (abfd); + if (locals == NULL) + { + locals = (struct elf_kvx_local_symbol *) + bfd_zalloc (abfd, number * sizeof (struct elf_kvx_local_symbol)); + if (locals == NULL) + return false; + elf_kvx_locals (abfd) = locals; + } + return true; +} + +/* Create the .got section to hold the global offset table. */ + +static bool +kvx_elf_create_got_section (bfd *abfd, struct bfd_link_info *info) +{ + const struct elf_backend_data *bed = get_elf_backend_data (abfd); + flagword flags; + asection *s; + struct elf_link_hash_entry *h; + struct elf_link_hash_table *htab = elf_hash_table (info); + + /* This function may be called more than once. */ + s = bfd_get_linker_section (abfd, ".got"); + if (s != NULL) + return true; + + flags = bed->dynamic_sec_flags; + + s = bfd_make_section_anyway_with_flags (abfd, + (bed->rela_plts_and_copies_p + ? ".rela.got" : ".rel.got"), + (bed->dynamic_sec_flags + | SEC_READONLY)); + if (s == NULL + || !bfd_set_section_alignment (s, bed->s->log_file_align)) + + return false; + htab->srelgot = s; + + s = bfd_make_section_anyway_with_flags (abfd, ".got", flags); + if (s == NULL + || !bfd_set_section_alignment (s, bed->s->log_file_align)) + return false; + htab->sgot = s; + htab->sgot->size += GOT_ENTRY_SIZE; + + if (bed->want_got_sym) + { + /* Define the symbol _GLOBAL_OFFSET_TABLE_ at the start of the .got + (or .got.plt) section. We don't do this in the linker script + because we don't want to define the symbol if we are not creating + a global offset table. */ + h = _bfd_elf_define_linkage_sym (abfd, info, s, + "_GLOBAL_OFFSET_TABLE_"); + elf_hash_table (info)->hgot = h; + if (h == NULL) + return false; + } + + if (bed->want_got_plt) + { + s = bfd_make_section_anyway_with_flags (abfd, ".got.plt", flags); + if (s == NULL + || !bfd_set_section_alignment (s, + bed->s->log_file_align)) + return false; + htab->sgotplt = s; + } + + /* The first bit of the global offset table is the header. */ + s->size += bed->got_header_size; + + /* we still need to handle got content when doing static link with PIC */ + if (bfd_link_executable (info) && !bfd_link_pic (info)) { + htab->dynobj = abfd; + } + + return true; +} + +/* Look through the relocs for a section during the first phase. */ + +static bool +elfNN_kvx_check_relocs (bfd *abfd, struct bfd_link_info *info, + asection *sec, const Elf_Internal_Rela *relocs) +{ + Elf_Internal_Shdr *symtab_hdr; + struct elf_link_hash_entry **sym_hashes; + const Elf_Internal_Rela *rel; + const Elf_Internal_Rela *rel_end; + asection *sreloc; + + struct elf_kvx_link_hash_table *htab; + + if (bfd_link_relocatable (info)) + return true; + + BFD_ASSERT (is_kvx_elf (abfd)); + + htab = elf_kvx_hash_table (info); + sreloc = NULL; + + symtab_hdr = &elf_symtab_hdr (abfd); + sym_hashes = elf_sym_hashes (abfd); + + rel_end = relocs + sec->reloc_count; + for (rel = relocs; rel < rel_end; rel++) + { + struct elf_link_hash_entry *h; + unsigned int r_symndx; + unsigned int r_type; + bfd_reloc_code_real_type bfd_r_type; + Elf_Internal_Sym *isym; + + r_symndx = ELFNN_R_SYM (rel->r_info); + r_type = ELFNN_R_TYPE (rel->r_info); + + if (r_symndx >= NUM_SHDR_ENTRIES (symtab_hdr)) + { + /* xgettext:c-format */ + _bfd_error_handler (_("%pB: bad symbol index: %d"), abfd, r_symndx); + return false; + } + + if (r_symndx < symtab_hdr->sh_info) + { + /* A local symbol. */ + isym = bfd_sym_from_r_symndx (&htab->sym_cache, + abfd, r_symndx); + if (isym == NULL) + return false; + + h = NULL; + } + else + { + h = sym_hashes[r_symndx - symtab_hdr->sh_info]; + while (h->root.type == bfd_link_hash_indirect + || h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + } + + /* Could be done earlier, if h were already available. */ + bfd_r_type = kvx_tls_transition (abfd, info, r_type, h, r_symndx); + + if (h != NULL) + { + /* Create the ifunc sections for static executables. If we + never see an indirect function symbol nor we are building + a static executable, those sections will be empty and + won't appear in output. */ + switch (bfd_r_type) + { + default: + break; + } + + /* It is referenced by a non-shared object. */ + h->ref_regular = 1; + } + + switch (bfd_r_type) + { + + case BFD_RELOC_KVX_S43_LO10: + case BFD_RELOC_KVX_S43_UP27: + case BFD_RELOC_KVX_S43_EX6: + + case BFD_RELOC_KVX_S37_LO10: + case BFD_RELOC_KVX_S37_UP27: + + case BFD_RELOC_KVX_S64_LO10: + case BFD_RELOC_KVX_S64_UP27: + case BFD_RELOC_KVX_S64_EX27: + + case BFD_RELOC_KVX_32: + case BFD_RELOC_KVX_64: + + /* We don't need to handle relocs into sections not going into + the "real" output. */ + if ((sec->flags & SEC_ALLOC) == 0) + break; + + if (h != NULL) + { + if (!bfd_link_pic (info)) + h->non_got_ref = 1; + + h->plt.refcount += 1; + h->pointer_equality_needed = 1; + } + + /* No need to do anything if we're not creating a shared + object. */ + if (! bfd_link_pic (info)) + break; + + { + struct elf_dyn_relocs *p; + struct elf_dyn_relocs **head; + + /* We must copy these reloc types into the output file. + Create a reloc section in dynobj and make room for + this reloc. */ + if (sreloc == NULL) + { + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + + sreloc = _bfd_elf_make_dynamic_reloc_section + (sec, htab->root.dynobj, LOG_FILE_ALIGN, abfd, /*rela? */ true); + + if (sreloc == NULL) + return false; + } + + /* If this is a global symbol, we count the number of + relocations we need for this symbol. */ + if (h != NULL) + { + head = &h->dyn_relocs; + } + else + { + /* Track dynamic relocs needed for local syms too. + We really need local syms available to do this + easily. Oh well. */ + + asection *s; + void **vpp; + + isym = bfd_sym_from_r_symndx (&htab->sym_cache, + abfd, r_symndx); + if (isym == NULL) + return false; + + s = bfd_section_from_elf_index (abfd, isym->st_shndx); + if (s == NULL) + s = sec; + + /* Beware of type punned pointers vs strict aliasing + rules. */ + vpp = &(elf_section_data (s)->local_dynrel); + head = (struct elf_dyn_relocs **) vpp; + } + + p = *head; + if (p == NULL || p->sec != sec) + { + bfd_size_type amt = sizeof *p; + p = ((struct elf_dyn_relocs *) + bfd_zalloc (htab->root.dynobj, amt)); + if (p == NULL) + return false; + p->next = *head; + *head = p; + p->sec = sec; + } + + p->count += 1; + + } + break; + + case BFD_RELOC_KVX_S37_GOT_LO10: + case BFD_RELOC_KVX_S37_GOT_UP27: + + case BFD_RELOC_KVX_S37_GOTOFF_LO10: + case BFD_RELOC_KVX_S37_GOTOFF_UP27: + + case BFD_RELOC_KVX_S43_GOT_LO10: + case BFD_RELOC_KVX_S43_GOT_UP27: + case BFD_RELOC_KVX_S43_GOT_EX6: + + case BFD_RELOC_KVX_S43_GOTOFF_LO10: + case BFD_RELOC_KVX_S43_GOTOFF_UP27: + case BFD_RELOC_KVX_S43_GOTOFF_EX6: + + case BFD_RELOC_KVX_S37_TLS_GD_LO10: + case BFD_RELOC_KVX_S37_TLS_GD_UP27: + + case BFD_RELOC_KVX_S43_TLS_GD_LO10: + case BFD_RELOC_KVX_S43_TLS_GD_UP27: + case BFD_RELOC_KVX_S43_TLS_GD_EX6: + + case BFD_RELOC_KVX_S37_TLS_IE_LO10: + case BFD_RELOC_KVX_S37_TLS_IE_UP27: + + case BFD_RELOC_KVX_S43_TLS_IE_LO10: + case BFD_RELOC_KVX_S43_TLS_IE_UP27: + case BFD_RELOC_KVX_S43_TLS_IE_EX6: + + case BFD_RELOC_KVX_S37_TLS_LD_LO10: + case BFD_RELOC_KVX_S37_TLS_LD_UP27: + + case BFD_RELOC_KVX_S43_TLS_LD_LO10: + case BFD_RELOC_KVX_S43_TLS_LD_UP27: + case BFD_RELOC_KVX_S43_TLS_LD_EX6: + { + unsigned got_type; + unsigned old_got_type; + + got_type = kvx_reloc_got_type (bfd_r_type); + + if (h) + { + h->got.refcount += 1; + old_got_type = elf_kvx_hash_entry (h)->got_type; + } + else + { + struct elf_kvx_local_symbol *locals; + + if (!elfNN_kvx_allocate_local_symbols + (abfd, symtab_hdr->sh_info)) + return false; + + locals = elf_kvx_locals (abfd); + BFD_ASSERT (r_symndx < symtab_hdr->sh_info); + locals[r_symndx].got_refcount += 1; + old_got_type = locals[r_symndx].got_type; + } + + /* We will already have issued an error message if there + is a TLS/non-TLS mismatch, based on the symbol type. + So just combine any TLS types needed. */ + if (old_got_type != GOT_UNKNOWN && old_got_type != GOT_NORMAL + && got_type != GOT_NORMAL) + got_type |= old_got_type; + + /* If the symbol is accessed by both IE and GD methods, we + are able to relax. Turn off the GD flag, without + messing up with any other kind of TLS types that may be + involved. */ + /* Disabled untested and unused TLS */ + /* if ((got_type & GOT_TLS_IE) && GOT_TLS_GD_ANY_P (got_type)) */ + /* got_type &= ~ (GOT_TLSDESC_GD | GOT_TLS_GD); */ + + if (old_got_type != got_type) + { + if (h != NULL) + elf_kvx_hash_entry (h)->got_type = got_type; + else + { + struct elf_kvx_local_symbol *locals; + locals = elf_kvx_locals (abfd); + BFD_ASSERT (r_symndx < symtab_hdr->sh_info); + locals[r_symndx].got_type = got_type; + } + } + + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + if (! kvx_elf_create_got_section (htab->root.dynobj, info)) + return false; + break; + } + + case BFD_RELOC_KVX_S64_GOTADDR_LO10: + case BFD_RELOC_KVX_S64_GOTADDR_UP27: + case BFD_RELOC_KVX_S64_GOTADDR_EX27: + + case BFD_RELOC_KVX_S43_GOTADDR_LO10: + case BFD_RELOC_KVX_S43_GOTADDR_UP27: + case BFD_RELOC_KVX_S43_GOTADDR_EX6: + + case BFD_RELOC_KVX_S37_GOTADDR_LO10: + case BFD_RELOC_KVX_S37_GOTADDR_UP27: + + if (htab->root.dynobj == NULL) + htab->root.dynobj = abfd; + if (! kvx_elf_create_got_section (htab->root.dynobj, info)) + return false; + break; + + case BFD_RELOC_KVX_PCREL27: + case BFD_RELOC_KVX_PCREL17: + /* If this is a local symbol then we resolve it + directly without creating a PLT entry. */ + if (h == NULL) + continue; + + h->needs_plt = 1; + if (h->plt.refcount <= 0) + h->plt.refcount = 1; + else + h->plt.refcount += 1; + break; + + default: + break; + } + } + + return true; +} + +static bool +elfNN_kvx_init_file_header (bfd *abfd, struct bfd_link_info *link_info) +{ + Elf_Internal_Ehdr *i_ehdrp; /* ELF file header, internal form. */ + + if (!_bfd_elf_init_file_header (abfd, link_info)) + return false; + + i_ehdrp = elf_elfheader (abfd); + i_ehdrp->e_ident[EI_ABIVERSION] = KVX_ELF_ABI_VERSION; + return true; +} + +static enum elf_reloc_type_class +elfNN_kvx_reloc_type_class (const struct bfd_link_info *info ATTRIBUTE_UNUSED, + const asection *rel_sec ATTRIBUTE_UNUSED, + const Elf_Internal_Rela *rela) +{ + switch ((int) ELFNN_R_TYPE (rela->r_info)) + { + case R_KVX_RELATIVE: + return reloc_class_relative; + case R_KVX_JMP_SLOT: + return reloc_class_plt; + case R_KVX_COPY: + return reloc_class_copy; + default: + return reloc_class_normal; + } +} + +/* A structure used to record a list of sections, independently + of the next and prev fields in the asection structure. */ +typedef struct section_list +{ + asection *sec; + struct section_list *next; + struct section_list *prev; +} +section_list; + +typedef struct +{ + void *finfo; + struct bfd_link_info *info; + asection *sec; + int sec_shndx; + int (*func) (void *, const char *, Elf_Internal_Sym *, + asection *, struct elf_link_hash_entry *); +} output_arch_syminfo; + +/* Output a single local symbol for a generated stub. */ + +static bool +elfNN_kvx_output_stub_sym (output_arch_syminfo *osi, const char *name, + bfd_vma offset, bfd_vma size) +{ + Elf_Internal_Sym sym; + + sym.st_value = (osi->sec->output_section->vma + + osi->sec->output_offset + offset); + sym.st_size = size; + sym.st_other = 0; + sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FUNC); + sym.st_shndx = osi->sec_shndx; + return osi->func (osi->finfo, name, &sym, osi->sec, NULL) == 1; +} + +static bool +kvx_map_one_stub (struct bfd_hash_entry *gen_entry, void *in_arg) +{ + struct elf_kvx_stub_hash_entry *stub_entry; + asection *stub_sec; + bfd_vma addr; + char *stub_name; + output_arch_syminfo *osi; + + /* Massage our args to the form they really have. */ + stub_entry = (struct elf_kvx_stub_hash_entry *) gen_entry; + osi = (output_arch_syminfo *) in_arg; + + stub_sec = stub_entry->stub_sec; + + /* Ensure this stub is attached to the current section being + processed. */ + if (stub_sec != osi->sec) + return true; + + addr = (bfd_vma) stub_entry->stub_offset; + + stub_name = stub_entry->output_name; + + switch (stub_entry->stub_type) + { + case kvx_stub_long_branch: + if (!elfNN_kvx_output_stub_sym + (osi, stub_name, addr, sizeof (elfNN_kvx_long_branch_stub))) + return false; + break; + + default: + abort (); + } + + return true; +} + +/* Output mapping symbols for linker generated sections. */ + +static bool +elfNN_kvx_output_arch_local_syms (bfd *output_bfd, + struct bfd_link_info *info, + void *finfo, + int (*func) (void *, const char *, + Elf_Internal_Sym *, + asection *, + struct elf_link_hash_entry + *)) +{ + output_arch_syminfo osi; + struct elf_kvx_link_hash_table *htab; + + htab = elf_kvx_hash_table (info); + + osi.finfo = finfo; + osi.info = info; + osi.func = func; + + /* Long calls stubs. */ + if (htab->stub_bfd && htab->stub_bfd->sections) + { + asection *stub_sec; + + for (stub_sec = htab->stub_bfd->sections; + stub_sec != NULL; stub_sec = stub_sec->next) + { + /* Ignore non-stub sections. */ + if (!strstr (stub_sec->name, STUB_SUFFIX)) + continue; + + osi.sec = stub_sec; + + osi.sec_shndx = _bfd_elf_section_from_bfd_section + (output_bfd, osi.sec->output_section); + + bfd_hash_traverse (&htab->stub_hash_table, kvx_map_one_stub, + &osi); + } + } + + /* Finally, output mapping symbols for the PLT. */ + if (!htab->root.splt || htab->root.splt->size == 0) + return true; + + osi.sec_shndx = _bfd_elf_section_from_bfd_section + (output_bfd, htab->root.splt->output_section); + osi.sec = htab->root.splt; + + return true; + +} + +/* Allocate target specific section data. */ + +static bool +elfNN_kvx_new_section_hook (bfd *abfd, asection *sec) +{ + if (!sec->used_by_bfd) + { + _kvx_elf_section_data *sdata; + bfd_size_type amt = sizeof (*sdata); + + sdata = bfd_zalloc (abfd, amt); + if (sdata == NULL) + return false; + sec->used_by_bfd = sdata; + } + + return _bfd_elf_new_section_hook (abfd, sec); +} + +/* Create dynamic sections. This is different from the ARM backend in that + the got, plt, gotplt and their relocation sections are all created in the + standard part of the bfd elf backend. */ + +static bool +elfNN_kvx_create_dynamic_sections (bfd *dynobj, + struct bfd_link_info *info) +{ + struct elf_kvx_link_hash_table *htab; + + /* We need to create .got section. */ + if (!kvx_elf_create_got_section (dynobj, info)) + return false; + + if (!_bfd_elf_create_dynamic_sections (dynobj, info)) + return false; + + htab = elf_kvx_hash_table (info); + htab->sdynbss = bfd_get_linker_section (dynobj, ".dynbss"); + if (!bfd_link_pic (info)) + htab->srelbss = bfd_get_linker_section (dynobj, ".rela.bss"); + + if (!htab->sdynbss || (!bfd_link_pic (info) && !htab->srelbss)) + abort (); + + return true; +} + + +/* Allocate space in .plt, .got and associated reloc sections for + dynamic relocs. */ + +static bool +elfNN_kvx_allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf) +{ + struct bfd_link_info *info; + struct elf_kvx_link_hash_table *htab; + struct elf_dyn_relocs *p; + + /* An example of a bfd_link_hash_indirect symbol is versioned + symbol. For example: __gxx_personality_v0(bfd_link_hash_indirect) + -> __gxx_personality_v0(bfd_link_hash_defined) + + There is no need to process bfd_link_hash_indirect symbols here + because we will also be presented with the concrete instance of + the symbol and elfNN_kvx_copy_indirect_symbol () will have been + called to copy all relevant data from the generic to the concrete + symbol instance. + */ + if (h->root.type == bfd_link_hash_indirect) + return true; + + if (h->root.type == bfd_link_hash_warning) + h = (struct elf_link_hash_entry *) h->root.u.i.link; + + info = (struct bfd_link_info *) inf; + htab = elf_kvx_hash_table (info); + + if (htab->root.dynamic_sections_created && h->plt.refcount > 0) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 && !h->forced_local) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + } + + if (bfd_link_pic (info) || WILL_CALL_FINISH_DYNAMIC_SYMBOL (1, 0, h)) + { + asection *s = htab->root.splt; + + /* If this is the first .plt entry, make room for the special + first entry. */ + if (s->size == 0) + s->size += htab->plt_header_size; + + h->plt.offset = s->size; + + /* If this symbol is not defined in a regular file, and we are + not generating a shared library, then set the symbol to this + location in the .plt. This is required to make function + pointers compare as equal between the normal executable and + the shared library. */ + if (!bfd_link_pic (info) && !h->def_regular) + { + h->root.u.def.section = s; + h->root.u.def.value = h->plt.offset; + } + + /* Make room for this entry. For now we only create the + small model PLT entries. We later need to find a way + of relaxing into these from the large model PLT entries. */ + s->size += PLT_SMALL_ENTRY_SIZE; + + /* We also need to make an entry in the .got.plt section, which + will be placed in the .got section by the linker script. */ + htab->root.sgotplt->size += GOT_ENTRY_SIZE; + + /* We also need to make an entry in the .rela.plt section. */ + htab->root.srelplt->size += RELOC_SIZE (htab); + + /* We need to ensure that all GOT entries that serve the PLT + are consecutive with the special GOT slots [0] [1] and + [2]. Any addtional relocations must be placed after the + PLT related entries. We abuse the reloc_count such that + during sizing we adjust reloc_count to indicate the + number of PLT related reserved entries. In subsequent + phases when filling in the contents of the reloc entries, + PLT related entries are placed by computing their PLT + index (0 .. reloc_count). While other none PLT relocs are + placed at the slot indicated by reloc_count and + reloc_count is updated. */ + + htab->root.srelplt->reloc_count++; + } + else + { + h->plt.offset = (bfd_vma) - 1; + h->needs_plt = 0; + } + } + else + { + h->plt.offset = (bfd_vma) - 1; + h->needs_plt = 0; + } + + if (h->got.refcount > 0) + { + bool dyn; + unsigned got_type = elf_kvx_hash_entry (h)->got_type; + + h->got.offset = (bfd_vma) - 1; + + dyn = htab->root.dynamic_sections_created; + + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (dyn && h->dynindx == -1 && !h->forced_local) + { + if (!bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + } + + if (got_type == GOT_UNKNOWN) + { + (*_bfd_error_handler) + (_("relocation against `%s' has faulty GOT type "), + (h) ? h->root.root.string : "a local symbol"); + bfd_set_error (bfd_error_bad_value); + return false; + } + else if (got_type == GOT_NORMAL) + { + h->got.offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE; + if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (bfd_link_pic (info) + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) + { + htab->root.srelgot->size += RELOC_SIZE (htab); + } + } + else + { + int indx; + + /* Any of these will require 2 GOT slots because + * they use __tls_get_addr() */ + if (got_type & (GOT_TLS_GD | GOT_TLS_LD)) + { + h->got.offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE * 2; + } + + if (got_type & GOT_TLS_IE) + { + h->got.offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE; + } + + indx = h && h->dynindx != -1 ? h->dynindx : 0; + if ((ELF_ST_VISIBILITY (h->other) == STV_DEFAULT + || h->root.type != bfd_link_hash_undefweak) + && (bfd_link_pic (info) + || indx != 0 + || WILL_CALL_FINISH_DYNAMIC_SYMBOL (dyn, 0, h))) + { + /* Only the GD case requires 2 relocations. */ + if (got_type & GOT_TLS_GD) + htab->root.srelgot->size += RELOC_SIZE (htab) * 2; + + /* LD needs a DTPMOD reloc, IE needs a DTPOFF. */ + if (got_type & (GOT_TLS_LD | GOT_TLS_IE)) + htab->root.srelgot->size += RELOC_SIZE (htab); + } + } + } + else + { + h->got.offset = (bfd_vma) - 1; + } + + if (h->dyn_relocs == NULL) + return true; + + /* In the shared -Bsymbolic case, discard space allocated for + dynamic pc-relative relocs against symbols which turn out to be + defined in regular objects. For the normal shared case, discard + space for pc-relative relocs that have become local due to symbol + visibility changes. */ + + if (bfd_link_pic (info)) + { + /* Relocs that use pc_count are those that appear on a call + insn, or certain REL relocs that can generated via assembly. + We want calls to protected symbols to resolve directly to the + function rather than going via the plt. If people want + function pointer comparisons to work as expected then they + should avoid writing weird assembly. */ + if (SYMBOL_CALLS_LOCAL (info, h)) + { + struct elf_dyn_relocs **pp; + + for (pp = &h->dyn_relocs; (p = *pp) != NULL;) + { + p->count -= p->pc_count; + p->pc_count = 0; + if (p->count == 0) + *pp = p->next; + else + pp = &p->next; + } + } + + /* Also discard relocs on undefined weak syms with non-default + visibility. */ + if (h->dyn_relocs != NULL && h->root.type == bfd_link_hash_undefweak) + { + if (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT) + h->dyn_relocs = NULL; + + /* Make sure undefined weak symbols are output as a dynamic + symbol in PIEs. */ + else if (h->dynindx == -1 + && !h->forced_local + && !bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + } + + } + else if (ELIMINATE_COPY_RELOCS) + { + /* For the non-shared case, discard space for relocs against + symbols which turn out to need copy relocs or are not + dynamic. */ + + if (!h->non_got_ref + && ((h->def_dynamic + && !h->def_regular) + || (htab->root.dynamic_sections_created + && (h->root.type == bfd_link_hash_undefweak + || h->root.type == bfd_link_hash_undefined)))) + { + /* Make sure this symbol is output as a dynamic symbol. + Undefined weak syms won't yet be marked as dynamic. */ + if (h->dynindx == -1 + && !h->forced_local + && !bfd_elf_link_record_dynamic_symbol (info, h)) + return false; + + /* If that succeeded, we know we'll be keeping all the + relocs. */ + if (h->dynindx != -1) + goto keep; + } + + h->dyn_relocs = NULL; + + keep:; + } + + /* Finally, allocate space. */ + for (p = h->dyn_relocs; p != NULL; p = p->next) + { + asection *sreloc; + + sreloc = elf_section_data (p->sec)->sreloc; + + BFD_ASSERT (sreloc != NULL); + + sreloc->size += p->count * RELOC_SIZE (htab); + } + + return true; +} + +/* Find any dynamic relocs that apply to read-only sections. */ + +static bool +kvx_readonly_dynrelocs (struct elf_link_hash_entry * h, void * inf) +{ + struct elf_dyn_relocs * p; + + for (p = h->dyn_relocs; p != NULL; p = p->next) + { + asection *s = p->sec; + + if (s != NULL && (s->flags & SEC_READONLY) != 0) + { + struct bfd_link_info *info = (struct bfd_link_info *) inf; + + info->flags |= DF_TEXTREL; + + /* Not an error, just cut short the traversal. */ + return false; + } + } + return true; +} + +/* This is the most important function of all . Innocuosly named + though ! */ +static bool +elfNN_kvx_size_dynamic_sections (bfd *output_bfd ATTRIBUTE_UNUSED, + struct bfd_link_info *info) +{ + struct elf_kvx_link_hash_table *htab; + bfd *dynobj; + asection *s; + bool relocs; + bfd *ibfd; + + htab = elf_kvx_hash_table ((info)); + dynobj = htab->root.dynobj; + + BFD_ASSERT (dynobj != NULL); + + if (htab->root.dynamic_sections_created) + { + if (bfd_link_executable (info) && !info->nointerp) + { + s = bfd_get_linker_section (dynobj, ".interp"); + if (s == NULL) + abort (); + s->size = sizeof ELF_DYNAMIC_INTERPRETER; + s->contents = (unsigned char *) ELF_DYNAMIC_INTERPRETER; + } + } + + /* Set up .got offsets for local syms, and space for local dynamic + relocs. */ + for (ibfd = info->input_bfds; ibfd != NULL; ibfd = ibfd->link.next) + { + struct elf_kvx_local_symbol *locals = NULL; + Elf_Internal_Shdr *symtab_hdr; + asection *srel; + unsigned int i; + + if (!is_kvx_elf (ibfd)) + continue; + + for (s = ibfd->sections; s != NULL; s = s->next) + { + struct elf_dyn_relocs *p; + + for (p = (struct elf_dyn_relocs *) + (elf_section_data (s)->local_dynrel); p != NULL; p = p->next) + { + if (!bfd_is_abs_section (p->sec) + && bfd_is_abs_section (p->sec->output_section)) + { + /* Input section has been discarded, either because + it is a copy of a linkonce section or due to + linker script /DISCARD/, so we'll be discarding + the relocs too. */ + } + else if (p->count != 0) + { + srel = elf_section_data (p->sec)->sreloc; + srel->size += p->count * RELOC_SIZE (htab); + if ((p->sec->output_section->flags & SEC_READONLY) != 0) + info->flags |= DF_TEXTREL; + } + } + } + + locals = elf_kvx_locals (ibfd); + if (!locals) + continue; + + symtab_hdr = &elf_symtab_hdr (ibfd); + srel = htab->root.srelgot; + for (i = 0; i < symtab_hdr->sh_info; i++) + { + locals[i].got_offset = (bfd_vma) - 1; + if (locals[i].got_refcount > 0) + { + unsigned got_type = locals[i].got_type; + if (got_type & (GOT_TLS_GD | GOT_TLS_LD)) + { + locals[i].got_offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE * 2; + } + + if (got_type & (GOT_NORMAL | GOT_TLS_IE )) + { + locals[i].got_offset = htab->root.sgot->size; + htab->root.sgot->size += GOT_ENTRY_SIZE; + } + + if (got_type == GOT_UNKNOWN) + { + } + + if (bfd_link_pic (info)) + { + if (got_type & GOT_TLS_GD) + htab->root.srelgot->size += RELOC_SIZE (htab) * 2; + + if (got_type & GOT_TLS_IE + || got_type & GOT_TLS_LD + || got_type & GOT_NORMAL) + htab->root.srelgot->size += RELOC_SIZE (htab); + } + } + else + { + locals[i].got_refcount = (bfd_vma) - 1; + } + } + } + + + /* Allocate global sym .plt and .got entries, and space for global + sym dynamic relocs. */ + elf_link_hash_traverse (&htab->root, elfNN_kvx_allocate_dynrelocs, + info); + + /* For every jump slot reserved in the sgotplt, reloc_count is + incremented. However, when we reserve space for TLS descriptors, + it's not incremented, so in order to compute the space reserved + for them, it suffices to multiply the reloc count by the jump + slot size. */ + + if (htab->root.srelplt) + htab->sgotplt_jump_table_size = kvx_compute_jump_table_size (htab); + + /* We now have determined the sizes of the various dynamic sections. + Allocate memory for them. */ + relocs = false; + for (s = dynobj->sections; s != NULL; s = s->next) + { + if ((s->flags & SEC_LINKER_CREATED) == 0) + continue; + + if (s == htab->root.splt + || s == htab->root.sgot + || s == htab->root.sgotplt + || s == htab->root.iplt + || s == htab->root.igotplt || s == htab->sdynbss) + { + /* Strip this section if we don't need it; see the + comment below. */ + } + else if (startswith (bfd_section_name (s), ".rela")) + { + if (s->size != 0 && s != htab->root.srelplt) + relocs = true; + + /* We use the reloc_count field as a counter if we need + to copy relocs into the output file. */ + if (s != htab->root.srelplt) + s->reloc_count = 0; + } + else + { + /* It's not one of our sections, so don't allocate space. */ + continue; + } + + if (s->size == 0) + { + /* If we don't need this section, strip it from the + output file. This is mostly to handle .rela.bss and + .rela.plt. We must create both sections in + create_dynamic_sections, because they must be created + before the linker maps input sections to output + sections. The linker does that before + adjust_dynamic_symbol is called, and it is that + function which decides whether anything needs to go + into these sections. */ + + s->flags |= SEC_EXCLUDE; + continue; + } + + if ((s->flags & SEC_HAS_CONTENTS) == 0) + continue; + + /* Allocate memory for the section contents. We use bfd_zalloc + here in case unused entries are not reclaimed before the + section's contents are written out. This should not happen, + but this way if it does, we get a R_KVX_NONE reloc instead + of garbage. */ + s->contents = (bfd_byte *) bfd_zalloc (dynobj, s->size); + if (s->contents == NULL) + return false; + } + + if (htab->root.dynamic_sections_created) + { + /* Add some entries to the .dynamic section. We fill in the + values later, in elfNN_kvx_finish_dynamic_sections, but we + must add the entries now so that we get the correct size for + the .dynamic section. The DT_DEBUG entry is filled in by the + dynamic linker and used by the debugger. */ +#define add_dynamic_entry(TAG, VAL) \ + _bfd_elf_add_dynamic_entry (info, TAG, VAL) + + if (bfd_link_executable (info)) + { + if (!add_dynamic_entry (DT_DEBUG, 0)) + return false; + } + + if (htab->root.splt->size != 0) + { + if (!add_dynamic_entry (DT_PLTGOT, 0) + || !add_dynamic_entry (DT_PLTRELSZ, 0) + || !add_dynamic_entry (DT_PLTREL, DT_RELA) + || !add_dynamic_entry (DT_JMPREL, 0)) + return false; + } + + if (relocs) + { + if (!add_dynamic_entry (DT_RELA, 0) + || !add_dynamic_entry (DT_RELASZ, 0) + || !add_dynamic_entry (DT_RELAENT, RELOC_SIZE (htab))) + return false; + + /* If any dynamic relocs apply to a read-only section, + then we need a DT_TEXTREL entry. */ + if ((info->flags & DF_TEXTREL) == 0) + elf_link_hash_traverse (& htab->root, kvx_readonly_dynrelocs, + info); + + if ((info->flags & DF_TEXTREL) != 0) + { + if (!add_dynamic_entry (DT_TEXTREL, 0)) + return false; + } + } + } +#undef add_dynamic_entry + + return true; +} + +static inline void +elf_kvx_update_plt_entry (bfd *output_bfd, + bfd_reloc_code_real_type r_type, + bfd_byte *plt_entry, bfd_vma value) +{ + reloc_howto_type *howto = elfNN_kvx_howto_from_bfd_reloc (r_type); + BFD_ASSERT(howto != NULL); + _bfd_kvx_elf_put_addend (output_bfd, plt_entry, r_type, howto, value); +} + +static void +elfNN_kvx_create_small_pltn_entry (struct elf_link_hash_entry *h, + struct elf_kvx_link_hash_table + *htab, bfd *output_bfd) +{ + bfd_byte *plt_entry; + bfd_vma plt_index; + bfd_vma got_offset; + bfd_vma gotplt_entry_address; + bfd_vma plt_entry_address; + Elf_Internal_Rela rela; + bfd_byte *loc; + asection *plt, *gotplt, *relplt; + + plt = htab->root.splt; + gotplt = htab->root.sgotplt; + relplt = htab->root.srelplt; + + /* Get the index in the procedure linkage table which + corresponds to this symbol. This is the index of this symbol + in all the symbols for which we are making plt entries. The + first entry in the procedure linkage table is reserved. + + Get the offset into the .got table of the entry that + corresponds to this function. Each .got entry is GOT_ENTRY_SIZE + bytes. The first three are reserved for the dynamic linker. + + For static executables, we don't reserve anything. */ + + if (plt == htab->root.splt) + { + plt_index = (h->plt.offset - htab->plt_header_size) / htab->plt_entry_size; + got_offset = (plt_index + 3) * GOT_ENTRY_SIZE; + } + else + { + plt_index = h->plt.offset / htab->plt_entry_size; + got_offset = plt_index * GOT_ENTRY_SIZE; + } + + plt_entry = plt->contents + h->plt.offset; + plt_entry_address = plt->output_section->vma + + plt->output_offset + h->plt.offset; + gotplt_entry_address = gotplt->output_section->vma + + gotplt->output_offset + got_offset; + + /* Copy in the boiler-plate for the PLTn entry. */ + memcpy (plt_entry, elfNN_kvx_small_plt_entry, PLT_SMALL_ENTRY_SIZE); + + /* Patch the loading of the GOT entry, relative to the PLT entry + * address + */ + + /* Use 37bits offset for both 32 and 64bits mode */ + /* Fill the LO10 of of lw $r9 = 0[$r14] */ + elf_kvx_update_plt_entry(output_bfd, BFD_RELOC_KVX_S37_LO10, + plt_entry+4, + gotplt_entry_address - plt_entry_address); + + /* Fill the UP27 of of lw $r9 = 0[$r14] */ + elf_kvx_update_plt_entry(output_bfd, BFD_RELOC_KVX_S37_UP27, + plt_entry+8, + gotplt_entry_address - plt_entry_address); + + rela.r_offset = gotplt_entry_address; + + /* Fill in the entry in the .rela.plt section. */ + rela.r_info = ELFNN_R_INFO (h->dynindx, R_KVX_JMP_SLOT); + rela.r_addend = 0; + + /* Compute the relocation entry to used based on PLT index and do + not adjust reloc_count. The reloc_count has already been adjusted + to account for this entry. */ + loc = relplt->contents + plt_index * RELOC_SIZE (htab); + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); +} + +/* Size sections even though they're not dynamic. We use it to setup + _TLS_MODULE_BASE_, if needed. */ + +static bool +elfNN_kvx_always_size_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + asection *tls_sec; + + if (bfd_link_relocatable (info)) + return true; + + tls_sec = elf_hash_table (info)->tls_sec; + + if (tls_sec) + { + struct elf_link_hash_entry *tlsbase; + + tlsbase = elf_link_hash_lookup (elf_hash_table (info), + "_TLS_MODULE_BASE_", true, true, false); + + if (tlsbase) + { + struct bfd_link_hash_entry *h = NULL; + const struct elf_backend_data *bed = + get_elf_backend_data (output_bfd); + + if (!(_bfd_generic_link_add_one_symbol + (info, output_bfd, "_TLS_MODULE_BASE_", BSF_LOCAL, + tls_sec, 0, NULL, false, bed->collect, &h))) + return false; + + tlsbase->type = STT_TLS; + tlsbase = (struct elf_link_hash_entry *) h; + tlsbase->def_regular = 1; + tlsbase->other = STV_HIDDEN; + (*bed->elf_backend_hide_symbol) (info, tlsbase, true); + } + } + + return true; +} + +/* Finish up dynamic symbol handling. We set the contents of various + dynamic sections here. */ +static bool +elfNN_kvx_finish_dynamic_symbol (bfd *output_bfd, + struct bfd_link_info *info, + struct elf_link_hash_entry *h, + Elf_Internal_Sym *sym) +{ + struct elf_kvx_link_hash_table *htab; + htab = elf_kvx_hash_table (info); + + if (h->plt.offset != (bfd_vma) - 1) + { + asection *plt = NULL, *gotplt = NULL, *relplt = NULL; + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + + if (htab->root.splt != NULL) + { + plt = htab->root.splt; + gotplt = htab->root.sgotplt; + relplt = htab->root.srelplt; + } + + /* This symbol has an entry in the procedure linkage table. Set + it up. */ + if ((h->dynindx == -1 + && !((h->forced_local || bfd_link_executable (info)) + && h->def_regular + && h->type == STT_GNU_IFUNC)) + || plt == NULL + || gotplt == NULL + || relplt == NULL) + abort (); + + elfNN_kvx_create_small_pltn_entry (h, htab, output_bfd); + if (!h->def_regular) + { + /* Mark the symbol as undefined, rather than as defined in + the .plt section. */ + sym->st_shndx = SHN_UNDEF; + /* If the symbol is weak we need to clear the value. + Otherwise, the PLT entry would provide a definition for + the symbol even if the symbol wasn't defined anywhere, + and so the symbol would never be NULL. Leave the value if + there were any relocations where pointer equality matters + (this is a clue for the dynamic linker, to make function + pointer comparisons work between an application and shared + library). */ + if (!h->ref_regular_nonweak || !h->pointer_equality_needed) + sym->st_value = 0; + } + } + + if (h->got.offset != (bfd_vma) - 1 + && elf_kvx_hash_entry (h)->got_type == GOT_NORMAL) + { + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol has an entry in the global offset table. Set it + up. */ + if (htab->root.sgot == NULL || htab->root.srelgot == NULL) + abort (); + + rela.r_offset = (htab->root.sgot->output_section->vma + + htab->root.sgot->output_offset + + (h->got.offset & ~(bfd_vma) 1)); + +#ifdef UGLY_DEBUG + printf("setting rela at offset 0x%x(0x%x + 0x%x + 0x%x) for %s\n", + rela.r_offset, + htab->root.sgot->output_section->vma, + htab->root.sgot->output_offset, + h->got.offset, + h->root.root.string); +#endif + + if (bfd_link_pic (info) && SYMBOL_REFERENCES_LOCAL (info, h)) + { + if (!h->def_regular) + return false; + + /* in case of PLT related GOT entry, it is not clear who is + supposed to set the LSB of GOT entry... + kvx_calculate_got_entry_vma() would be a good candidate, + but it is not called currently + So we are commenting it ATM + */ + // BFD_ASSERT ((h->got.offset & 1) != 0); + rela.r_info = ELFNN_R_INFO (0, R_KVX_RELATIVE); + rela.r_addend = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + } + else + { + BFD_ASSERT ((h->got.offset & 1) == 0); + bfd_put_NN (output_bfd, (bfd_vma) 0, + htab->root.sgot->contents + h->got.offset); + rela.r_info = ELFNN_R_INFO (h->dynindx, R_KVX_GLOB_DAT); + rela.r_addend = 0; + } + + loc = htab->root.srelgot->contents; + loc += htab->root.srelgot->reloc_count++ * RELOC_SIZE (htab); + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + } + + if (h->needs_copy) + { + Elf_Internal_Rela rela; + bfd_byte *loc; + + /* This symbol needs a copy reloc. Set it up. */ + + if (h->dynindx == -1 + || (h->root.type != bfd_link_hash_defined + && h->root.type != bfd_link_hash_defweak) + || htab->srelbss == NULL) + abort (); + + rela.r_offset = (h->root.u.def.value + + h->root.u.def.section->output_section->vma + + h->root.u.def.section->output_offset); + rela.r_info = ELFNN_R_INFO (h->dynindx, R_KVX_COPY); + rela.r_addend = 0; + loc = htab->srelbss->contents; + loc += htab->srelbss->reloc_count++ * RELOC_SIZE (htab); + bfd_elfNN_swap_reloca_out (output_bfd, &rela, loc); + } + + /* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. SYM may + be NULL for local symbols. */ + if (sym != NULL + && (h == elf_hash_table (info)->hdynamic + || h == elf_hash_table (info)->hgot)) + sym->st_shndx = SHN_ABS; + + return true; +} + +static void +elfNN_kvx_init_small_plt0_entry (bfd *output_bfd ATTRIBUTE_UNUSED, + struct elf_kvx_link_hash_table + *htab) +{ + memcpy (htab->root.splt->contents, elfNN_kvx_small_plt0_entry, + PLT_ENTRY_SIZE); + elf_section_data (htab->root.splt->output_section)->this_hdr.sh_entsize = + PLT_ENTRY_SIZE; +} + +static bool +elfNN_kvx_finish_dynamic_sections (bfd *output_bfd, + struct bfd_link_info *info) +{ + struct elf_kvx_link_hash_table *htab; + bfd *dynobj; + asection *sdyn; + + htab = elf_kvx_hash_table (info); + dynobj = htab->root.dynobj; + sdyn = bfd_get_linker_section (dynobj, ".dynamic"); + + if (htab->root.dynamic_sections_created) + { + ElfNN_External_Dyn *dyncon, *dynconend; + + if (sdyn == NULL || htab->root.sgot == NULL) + abort (); + + dyncon = (ElfNN_External_Dyn *) sdyn->contents; + dynconend = (ElfNN_External_Dyn *) (sdyn->contents + sdyn->size); + for (; dyncon < dynconend; dyncon++) + { + Elf_Internal_Dyn dyn; + asection *s; + + bfd_elfNN_swap_dyn_in (dynobj, dyncon, &dyn); + + switch (dyn.d_tag) + { + default: + continue; + + case DT_PLTGOT: + s = htab->root.sgotplt; + dyn.d_un.d_ptr = s->output_section->vma + s->output_offset; + break; + + case DT_JMPREL: + dyn.d_un.d_ptr = htab->root.srelplt->output_section->vma; + break; + + case DT_PLTRELSZ: + s = htab->root.srelplt; + dyn.d_un.d_val = s->size; + break; + + case DT_RELASZ: + /* The procedure linkage table relocs (DT_JMPREL) should + not be included in the overall relocs (DT_RELA). + Therefore, we override the DT_RELASZ entry here to + make it not include the JMPREL relocs. Since the + linker script arranges for .rela.plt to follow all + other relocation sections, we don't have to worry + about changing the DT_RELA entry. */ + if (htab->root.srelplt != NULL) + { + s = htab->root.srelplt; + dyn.d_un.d_val -= s->size; + } + break; + } + + bfd_elfNN_swap_dyn_out (output_bfd, &dyn, dyncon); + } + + } + + /* Fill in the special first entry in the procedure linkage table. */ + if (htab->root.splt && htab->root.splt->size > 0) + { + elfNN_kvx_init_small_plt0_entry (output_bfd, htab); + + elf_section_data (htab->root.splt->output_section)-> + this_hdr.sh_entsize = htab->plt_entry_size; + } + + if (htab->root.sgotplt) + { + if (bfd_is_abs_section (htab->root.sgotplt->output_section)) + { + (*_bfd_error_handler) + (_("discarded output section: `%pA'"), htab->root.sgotplt); + return false; + } + + /* Fill in the first three entries in the global offset table. */ + if (htab->root.sgotplt->size > 0) + { + bfd_put_NN (output_bfd, (bfd_vma) 0, htab->root.sgotplt->contents); + + /* Write GOT[1] and GOT[2], needed for the dynamic linker. */ + bfd_put_NN (output_bfd, + (bfd_vma) 0, + htab->root.sgotplt->contents + GOT_ENTRY_SIZE); + bfd_put_NN (output_bfd, + (bfd_vma) 0, + htab->root.sgotplt->contents + GOT_ENTRY_SIZE * 2); + } + + if (htab->root.sgot) + { + if (htab->root.sgot->size > 0) + { + bfd_vma addr = + sdyn ? sdyn->output_section->vma + sdyn->output_offset : 0; + bfd_put_NN (output_bfd, addr, htab->root.sgot->contents); + } + } + + elf_section_data (htab->root.sgotplt->output_section)-> + this_hdr.sh_entsize = GOT_ENTRY_SIZE; + } + + if (htab->root.sgot && htab->root.sgot->size > 0) + elf_section_data (htab->root.sgot->output_section)->this_hdr.sh_entsize + = GOT_ENTRY_SIZE; + + return true; +} + +/* Return address for Ith PLT stub in section PLT, for relocation REL + or (bfd_vma) -1 if it should not be included. */ + +static bfd_vma +elfNN_kvx_plt_sym_val (bfd_vma i, const asection *plt, + const arelent *rel ATTRIBUTE_UNUSED) +{ + return plt->vma + PLT_ENTRY_SIZE + i * PLT_SMALL_ENTRY_SIZE; +} + +#define ELF_ARCH bfd_arch_kvx +#define ELF_MACHINE_CODE EM_KVX +#define ELF_MAXPAGESIZE 0x10000 +#define ELF_MINPAGESIZE 0x1000 +#define ELF_COMMONPAGESIZE 0x1000 + +#define bfd_elfNN_bfd_link_hash_table_create \ + elfNN_kvx_link_hash_table_create + +#define bfd_elfNN_bfd_merge_private_bfd_data \ + elfNN_kvx_merge_private_bfd_data + +#define bfd_elfNN_bfd_print_private_bfd_data \ + elfNN_kvx_print_private_bfd_data + +#define bfd_elfNN_bfd_reloc_type_lookup \ + elfNN_kvx_reloc_type_lookup + +#define bfd_elfNN_bfd_reloc_name_lookup \ + elfNN_kvx_reloc_name_lookup + +#define bfd_elfNN_bfd_set_private_flags \ + elfNN_kvx_set_private_flags + +#define bfd_elfNN_mkobject \ + elfNN_kvx_mkobject + +#define bfd_elfNN_new_section_hook \ + elfNN_kvx_new_section_hook + +#define elf_backend_adjust_dynamic_symbol \ + elfNN_kvx_adjust_dynamic_symbol + +#define elf_backend_always_size_sections \ + elfNN_kvx_always_size_sections + +#define elf_backend_check_relocs \ + elfNN_kvx_check_relocs + +#define elf_backend_copy_indirect_symbol \ + elfNN_kvx_copy_indirect_symbol + +/* Create .dynbss, and .rela.bss sections in DYNOBJ, and set up shortcuts + to them in our hash. */ +#define elf_backend_create_dynamic_sections \ + elfNN_kvx_create_dynamic_sections + +#define elf_backend_init_index_section \ + _bfd_elf_init_2_index_sections + +#define elf_backend_finish_dynamic_sections \ + elfNN_kvx_finish_dynamic_sections + +#define elf_backend_finish_dynamic_symbol \ + elfNN_kvx_finish_dynamic_symbol + +#define elf_backend_object_p \ + elfNN_kvx_object_p + +#define elf_backend_output_arch_local_syms \ + elfNN_kvx_output_arch_local_syms + +#define elf_backend_plt_sym_val \ + elfNN_kvx_plt_sym_val + +#define elf_backend_init_file_header \ + elfNN_kvx_init_file_header + +#define elf_backend_init_process_headers \ + elfNN_kvx_init_process_headers + +#define elf_backend_relocate_section \ + elfNN_kvx_relocate_section + +#define elf_backend_reloc_type_class \ + elfNN_kvx_reloc_type_class + +#define elf_backend_size_dynamic_sections \ + elfNN_kvx_size_dynamic_sections + +#define elf_backend_can_refcount 1 +#define elf_backend_can_gc_sections 1 +#define elf_backend_plt_readonly 1 +#define elf_backend_want_got_plt 1 +#define elf_backend_want_plt_sym 0 +#define elf_backend_may_use_rel_p 0 +#define elf_backend_may_use_rela_p 1 +#define elf_backend_default_use_rela_p 1 +#define elf_backend_rela_normal 1 +#define elf_backend_got_header_size (GOT_ENTRY_SIZE * 3) +#define elf_backend_default_execstack 0 +#define elf_backend_extern_protected_data 1 +#define elf_backend_hash_symbol elf_kvx_hash_symbol + +#include "elfNN-target.h" diff --git a/bfd/elfxx-kvx-relocs.h b/bfd/elfxx-kvx-relocs.h new file mode 100644 index 00000000000..7cfd0ff952c --- /dev/null +++ b/bfd/elfxx-kvx-relocs.h @@ -0,0 +1,1105 @@ +/* KVX-specific relocations table. + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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 of the License, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#ifdef KVX_KV3_V1_KV3_V2_KV4_V1 +static reloc_howto_type elf_kvx_howto_table[] = +{ + HOWTO (R_KVX_NONE, /* type */ + 0, /* rightshift */ + 0, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_bitfield, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_NONE", /* name */ + false, /* partial_inplace */ + 0, /* src_mask */ + 0, /* dst_mask */ + false), /* pcrel_offset */ + HOWTO (R_KVX_16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_16", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_32, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_32", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_64, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S16_PCREL, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 16, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S16_PCREL", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_PCREL17, /* type */ + 2, /* rightshift */ + 3, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 17, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_PCREL17", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7fffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_PCREL27, /* type */ + 2, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_PCREL27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_32_PCREL, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_32_PCREL", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S37_PCREL_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_PCREL_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S37_PCREL_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_PCREL_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_PCREL_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_PCREL_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_PCREL_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_PCREL_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_PCREL_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_PCREL_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_PCREL_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_PCREL_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_PCREL_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_PCREL_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_PCREL_EX27, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_PCREL_EX27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_64_PCREL, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_PCREL", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S16, /* type */ + 0, /* rightshift */ + 2, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 16, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_signed, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S16", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S32_LO5, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 5, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S32_LO5", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7c0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S32_UP27, /* type */ + 5, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S32_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_GOTOFF_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOTOFF_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_GOTOFF_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOTOFF_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOTOFF_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTOFF_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOTOFF_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTOFF_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOTOFF_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTOFF_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_32_GOTOFF, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_32_GOTOFF", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_64_GOTOFF, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_GOTOFF", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_32_GOT, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_32_GOT", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_GOT_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOT_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_GOT_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOT_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOT_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOT_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOT_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOT_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_GOT_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOT_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_64_GOT, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_GOT", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_GLOB_DAT, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_GLOB_DAT", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_COPY, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_COPY", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_JMP_SLOT, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_JMP_SLOT", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_RELATIVE, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 32, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_RELATIVE", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S64_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S64_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S64_EX27, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_EX27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_GOTADDR_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOTADDR_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S37_GOTADDR_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_GOTADDR_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_GOTADDR_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTADDR_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_GOTADDR_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTADDR_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S43_GOTADDR_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_GOTADDR_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_GOTADDR_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + true, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_GOTADDR_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_GOTADDR_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_GOTADDR_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_S64_GOTADDR_EX27, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + true, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S64_GOTADDR_EX27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + true), /* pc_offset */ + HOWTO (R_KVX_64_DTPMOD, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_DTPMOD", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_64_DTPOFF, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_DTPOFF", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_DTPOFF_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_DTPOFF_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_DTPOFF_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_DTPOFF_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_DTPOFF_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_DTPOFF_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_DTPOFF_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_DTPOFF_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_DTPOFF_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_DTPOFF_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_GD_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_GD_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_GD_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_GD_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_GD_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_GD_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_GD_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_GD_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_GD_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_GD_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_LD_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_LD_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_LD_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_LD_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LD_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LD_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LD_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LD_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LD_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LD_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_64_TPOFF, /* type */ + 0, /* rightshift */ + 8, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 64, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_64_TPOFF", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffffffffffffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_IE_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_IE_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_IE_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_IE_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_IE_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_IE_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_IE_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_IE_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_IE_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_IE_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_LE_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_LE_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S37_TLS_LE_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S37_TLS_LE_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LE_LO10, /* type */ + 0, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 10, /* bitsize */ + false, /* pc_relative */ + 6, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LE_LO10", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xffc0, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LE_UP27, /* type */ + 10, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 27, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LE_UP27", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x7ffffff, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_S43_TLS_LE_EX6, /* type */ + 37, /* rightshift */ + 4, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 6, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_dont, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_S43_TLS_LE_EX6", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0x3f, /* dst_mask */ + false), /* pc_offset */ + HOWTO (R_KVX_8, /* type */ + 0, /* rightshift */ + 1, /* size (0 = byte, 1 = short, 2 = long, 3 = invalid, 4 = 64bits, 8 = 128bits) */ + 8, /* bitsize */ + false, /* pc_relative */ + 0, /* bitpos (bit field offset) */ + complain_overflow_unsigned, /* complain_on_overflow */ + bfd_elf_generic_reloc, /* special_function */ + "R_KVX_8", /* name */ + false, /* partial_inplace */ + 0x0, /* src_mask */ + 0xff, /* dst_mask */ + false), /* pc_offset */ +}; + +#endif /* KVX_KV3_V1_KV3_V2_KV4_V1 */ diff --git a/bfd/elfxx-kvx.c b/bfd/elfxx-kvx.c new file mode 100644 index 00000000000..fec2d88c152 --- /dev/null +++ b/bfd/elfxx-kvx.c @@ -0,0 +1,218 @@ +/* KVX-specific support for ELF. + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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 of the License, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#include "sysdep.h" +#include "elfxx-kvx.h" +#include +#include + +/* Return non-zero if the indicated VALUE has overflowed the maximum + range expressible by a unsigned number with the indicated number of + BITS. */ + +static bfd_reloc_status_type +kvx_unsigned_overflow (bfd_vma value, unsigned int bits) +{ + bfd_vma lim; + if (bits >= sizeof (bfd_vma) * 8) + return bfd_reloc_ok; + lim = (bfd_vma) 1 << bits; + if (value >= lim) + return bfd_reloc_overflow; + return bfd_reloc_ok; +} + +/* Return non-zero if the indicated VALUE has overflowed the maximum + range expressible by an signed number with the indicated number of + BITS. */ + +static bfd_reloc_status_type +kvx_signed_overflow (bfd_vma value, unsigned int bits) +{ + bfd_signed_vma svalue = (bfd_signed_vma) value; + bfd_signed_vma lim; + + if (bits >= sizeof (bfd_vma) * 8) + return bfd_reloc_ok; + lim = (bfd_signed_vma) 1 << (bits - 1); + if (svalue < -lim || svalue >= lim) + return bfd_reloc_overflow; + return bfd_reloc_ok; +} + +/* Insert the addend/value into the instruction or data object being + relocated. */ +bfd_reloc_status_type +_bfd_kvx_elf_put_addend (bfd *abfd, + bfd_byte *address, bfd_reloc_code_real_type r_type ATTRIBUTE_UNUSED, + reloc_howto_type *howto, bfd_signed_vma addend) +{ + bfd_reloc_status_type status = bfd_reloc_ok; + bfd_vma contents; + int size; + + size = bfd_get_reloc_size (howto); + switch (size) + { + case 2: + contents = bfd_get_16 (abfd, address); + break; + case 4: + if (howto->src_mask != 0xffffffff) + /* Must be 32-bit instruction, always little-endian. */ + contents = bfd_getl32 (address); + else + /* Must be 32-bit data (endianness dependent). */ + contents = bfd_get_32 (abfd, address); + break; + case 8: + contents = bfd_get_64 (abfd, address); + break; + default: + abort (); + } + + switch (howto->complain_on_overflow) + { + case complain_overflow_dont: + break; + case complain_overflow_signed: + status = kvx_signed_overflow (addend, + howto->bitsize + howto->rightshift); + break; + case complain_overflow_unsigned: + status = kvx_unsigned_overflow (addend, + howto->bitsize + howto->rightshift); + break; + case complain_overflow_bitfield: + default: + abort (); + } + + addend >>= howto->rightshift; + + /* FIXME KVX : AARCH64 is "redoing" what the link_relocate bfd + * function does ie. extract bitfields and apply then to the + * existing content (insn) (howto's job) Not sure exactly + * why. Maybe because we need this even when not applying reloc + * against a input_bfd (eg. when doing PLT). On KVX, we have not + * reached a point where we would need to write similar + * functions for each insn. So we'll simply enrich the default + * case for handling a bit more than "right aligned bitfields" + * + * Beware that this won't be able to apply generic howto ! + */ + + /* if (howto->dst_mask & (howto->dst_mask + 1)) */ + /* return bfd_reloc_notsupported; */ + addend <<= howto->bitpos; + contents = ((contents & ~howto->dst_mask) | (addend & howto->dst_mask)); + + switch (size) + { + case 2: + bfd_put_16 (abfd, contents, address); + break; + case 4: + if (howto->dst_mask != 0xffffffff) + /* must be 32-bit instruction, always little-endian */ + bfd_putl32 (contents, address); + else + /* must be 32-bit data (endianness dependent) */ + bfd_put_32 (abfd, contents, address); + break; + case 8: + bfd_put_64 (abfd, contents, address); + break; + default: + abort (); + } + + return status; +} + +bfd_vma +_bfd_kvx_elf_resolve_relocation (bfd_reloc_code_real_type r_type ATTRIBUTE_UNUSED, + bfd_vma place ATTRIBUTE_UNUSED, bfd_vma value, + bfd_vma addend ATTRIBUTE_UNUSED, bool weak_undef_p ATTRIBUTE_UNUSED) +{ + return value; +} + +bool +_bfd_kvx_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) +{ + int offset; + size_t size; + + switch (note->descsz) + { + case 680: /* sizeof(struct elf_prstatus) on Linux/kvx. */ + /* pr_cursig */ + elf_tdata (abfd)->core->signal = bfd_get_16 (abfd, note->descdata + 12); + + /* pr_pid */ + elf_tdata (abfd)->core->lwpid = bfd_get_32 (abfd, note->descdata + 32); + + /* pr_reg */ + offset = 112; + size = 560; + break; + + default: + return false; + } + + /* Make a ".reg/999" section. */ + return _bfd_elfcore_make_pseudosection (abfd, ".reg", size, + note->descpos + offset); +} + +bool +_bfd_kvx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note) +{ + switch (note->descsz) + { + case 136: /* This is sizeof(struct elf_prpsinfo) on Linux/kvx. */ + elf_tdata (abfd)->core->pid = bfd_get_32 (abfd, note->descdata + 24); + elf_tdata (abfd)->core->program + = _bfd_elfcore_strndup (abfd, note->descdata + 40, 16); + elf_tdata (abfd)->core->command + = _bfd_elfcore_strndup (abfd, note->descdata + 56, 80); + break; + + default: + return false; + } + + /* Note that for some reason, a spurious space is tacked + onto the end of the args in some (at least one anyway) + implementations, so strip it off if it exists. */ + + { + char *command = elf_tdata (abfd)->core->command; + int n = strlen (command); + + if (n > 0 && command[n - 1] == ' ') + command[n - 1] = 0; + } + + return true; +} diff --git a/bfd/elfxx-kvx.h b/bfd/elfxx-kvx.h new file mode 100644 index 00000000000..06ddc3c8616 --- /dev/null +++ b/bfd/elfxx-kvx.h @@ -0,0 +1,71 @@ +/* KVX-specific backend routines. + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of BFD, the Binary File Descriptor library. + + This program 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 of the License, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#include "bfd.h" +#include "elf-bfd.h" +#include "stdint.h" + + +/* KVX stub generation support for ELF64. Called from the linker. */ +extern int elf64_kvx_setup_section_lists + (bfd *, struct bfd_link_info *); +extern void elf64_kvx_next_input_section + (struct bfd_link_info *, struct bfd_section *); +extern bool elf64_kvx_size_stubs + (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, + struct bfd_section * (*) (const char *, struct bfd_section *), + void (*) (void)); +extern bool elf64_kvx_build_stubs + (struct bfd_link_info *); +/* Kvx stub generation support for ELF32. Called from the linker. */ +extern int elf32_kvx_setup_section_lists + (bfd *, struct bfd_link_info *); +extern void elf32_kvx_next_input_section + (struct bfd_link_info *, struct bfd_section *); +extern bool elf32_kvx_size_stubs + (bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma, + struct bfd_section * (*) (const char *, struct bfd_section *), + void (*) (void)); +extern bool elf32_kvx_build_stubs + (struct bfd_link_info *); + + +extern bfd_reloc_status_type +_bfd_kvx_elf_put_addend (bfd *, bfd_byte *, bfd_reloc_code_real_type, + reloc_howto_type *, bfd_signed_vma); + +bfd_vma +_bfd_kvx_elf_resolve_relocation (bfd_reloc_code_real_type r_type, + bfd_vma place, bfd_vma value, + bfd_vma addend, bool weak_undef_p); + +bool +kvx_elf32_init_stub_bfd (struct bfd_link_info *info, + bfd *stub_bfd); +bool +kvx_elf64_init_stub_bfd (struct bfd_link_info *info, + bfd *stub_bfd); + +bool _bfd_kvx_elf_grok_prstatus (bfd *abfd, Elf_Internal_Note *note); + +bool _bfd_kvx_elf_grok_psinfo (bfd *abfd, Elf_Internal_Note *note); + +#define elf_backend_grok_prstatus _bfd_kvx_elf_grok_prstatus +#define elf_backend_grok_psinfo _bfd_kvx_elf_grok_psinfo diff --git a/bfd/libbfd.h b/bfd/libbfd.h index d4fb3107597..32dc1a0c477 100644 --- a/bfd/libbfd.h +++ b/bfd/libbfd.h @@ -3031,6 +3031,91 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@", "BFD_RELOC_MICROBLAZE_64_TLSTPREL", "BFD_RELOC_MICROBLAZE_64_TEXTPCREL", "BFD_RELOC_MICROBLAZE_64_TEXTREL", + "BFD_RELOC_KVX_RELOC_START", + "BFD_RELOC_KVX_NONE", + "BFD_RELOC_KVX_16", + "BFD_RELOC_KVX_32", + "BFD_RELOC_KVX_64", + "BFD_RELOC_KVX_S16_PCREL", + "BFD_RELOC_KVX_PCREL17", + "BFD_RELOC_KVX_PCREL27", + "BFD_RELOC_KVX_32_PCREL", + "BFD_RELOC_KVX_S37_PCREL_LO10", + "BFD_RELOC_KVX_S37_PCREL_UP27", + "BFD_RELOC_KVX_S43_PCREL_LO10", + "BFD_RELOC_KVX_S43_PCREL_UP27", + "BFD_RELOC_KVX_S43_PCREL_EX6", + "BFD_RELOC_KVX_S64_PCREL_LO10", + "BFD_RELOC_KVX_S64_PCREL_UP27", + "BFD_RELOC_KVX_S64_PCREL_EX27", + "BFD_RELOC_KVX_64_PCREL", + "BFD_RELOC_KVX_S16", + "BFD_RELOC_KVX_S32_LO5", + "BFD_RELOC_KVX_S32_UP27", + "BFD_RELOC_KVX_S37_LO10", + "BFD_RELOC_KVX_S37_UP27", + "BFD_RELOC_KVX_S37_GOTOFF_LO10", + "BFD_RELOC_KVX_S37_GOTOFF_UP27", + "BFD_RELOC_KVX_S43_GOTOFF_LO10", + "BFD_RELOC_KVX_S43_GOTOFF_UP27", + "BFD_RELOC_KVX_S43_GOTOFF_EX6", + "BFD_RELOC_KVX_32_GOTOFF", + "BFD_RELOC_KVX_64_GOTOFF", + "BFD_RELOC_KVX_32_GOT", + "BFD_RELOC_KVX_S37_GOT_LO10", + "BFD_RELOC_KVX_S37_GOT_UP27", + "BFD_RELOC_KVX_S43_GOT_LO10", + "BFD_RELOC_KVX_S43_GOT_UP27", + "BFD_RELOC_KVX_S43_GOT_EX6", + "BFD_RELOC_KVX_64_GOT", + "BFD_RELOC_KVX_GLOB_DAT", + "BFD_RELOC_KVX_COPY", + "BFD_RELOC_KVX_JMP_SLOT", + "BFD_RELOC_KVX_RELATIVE", + "BFD_RELOC_KVX_S43_LO10", + "BFD_RELOC_KVX_S43_UP27", + "BFD_RELOC_KVX_S43_EX6", + "BFD_RELOC_KVX_S64_LO10", + "BFD_RELOC_KVX_S64_UP27", + "BFD_RELOC_KVX_S64_EX27", + "BFD_RELOC_KVX_S37_GOTADDR_LO10", + "BFD_RELOC_KVX_S37_GOTADDR_UP27", + "BFD_RELOC_KVX_S43_GOTADDR_LO10", + "BFD_RELOC_KVX_S43_GOTADDR_UP27", + "BFD_RELOC_KVX_S43_GOTADDR_EX6", + "BFD_RELOC_KVX_S64_GOTADDR_LO10", + "BFD_RELOC_KVX_S64_GOTADDR_UP27", + "BFD_RELOC_KVX_S64_GOTADDR_EX27", + "BFD_RELOC_KVX_64_DTPMOD", + "BFD_RELOC_KVX_64_DTPOFF", + "BFD_RELOC_KVX_S37_TLS_DTPOFF_LO10", + "BFD_RELOC_KVX_S37_TLS_DTPOFF_UP27", + "BFD_RELOC_KVX_S43_TLS_DTPOFF_LO10", + "BFD_RELOC_KVX_S43_TLS_DTPOFF_UP27", + "BFD_RELOC_KVX_S43_TLS_DTPOFF_EX6", + "BFD_RELOC_KVX_S37_TLS_GD_LO10", + "BFD_RELOC_KVX_S37_TLS_GD_UP27", + "BFD_RELOC_KVX_S43_TLS_GD_LO10", + "BFD_RELOC_KVX_S43_TLS_GD_UP27", + "BFD_RELOC_KVX_S43_TLS_GD_EX6", + "BFD_RELOC_KVX_S37_TLS_LD_LO10", + "BFD_RELOC_KVX_S37_TLS_LD_UP27", + "BFD_RELOC_KVX_S43_TLS_LD_LO10", + "BFD_RELOC_KVX_S43_TLS_LD_UP27", + "BFD_RELOC_KVX_S43_TLS_LD_EX6", + "BFD_RELOC_KVX_64_TPOFF", + "BFD_RELOC_KVX_S37_TLS_IE_LO10", + "BFD_RELOC_KVX_S37_TLS_IE_UP27", + "BFD_RELOC_KVX_S43_TLS_IE_LO10", + "BFD_RELOC_KVX_S43_TLS_IE_UP27", + "BFD_RELOC_KVX_S43_TLS_IE_EX6", + "BFD_RELOC_KVX_S37_TLS_LE_LO10", + "BFD_RELOC_KVX_S37_TLS_LE_UP27", + "BFD_RELOC_KVX_S43_TLS_LE_LO10", + "BFD_RELOC_KVX_S43_TLS_LE_UP27", + "BFD_RELOC_KVX_S43_TLS_LE_EX6", + "BFD_RELOC_KVX_8", + "BFD_RELOC_KVX_RELOC_END", "BFD_RELOC_AARCH64_RELOC_START", "BFD_RELOC_AARCH64_NULL", "BFD_RELOC_AARCH64_NONE", diff --git a/bfd/po/BLD-POTFILES.in b/bfd/po/BLD-POTFILES.in index 73b5cb86912..497c89f8f57 100644 --- a/bfd/po/BLD-POTFILES.in +++ b/bfd/po/BLD-POTFILES.in @@ -1,11 +1,13 @@ bfdver.h elf32-aarch64.c elf32-ia64.c +elf32-kvx.c elf32-loongarch.c elf32-riscv.c elf32-target.h elf64-aarch64.c elf64-ia64.c +elf64-kvx.c elf64-loongarch.c elf64-riscv.c elf64-target.h diff --git a/bfd/po/SRC-POTFILES.in b/bfd/po/SRC-POTFILES.in index a127ac0904c..c259931dc5b 100644 --- a/bfd/po/SRC-POTFILES.in +++ b/bfd/po/SRC-POTFILES.in @@ -69,6 +69,7 @@ cpu-ia64.c cpu-iamcu.c cpu-ip2k.c cpu-iq2000.c +cpu-kvx.c cpu-lm32.c cpu-loongarch.c cpu-m10200.c @@ -261,6 +262,7 @@ elfxx-aarch64.c elfxx-aarch64.h elfxx-ia64.c elfxx-ia64.h +elfxx-kvx.c elfxx-loongarch.c elfxx-loongarch.h elfxx-mips.c diff --git a/bfd/reloc.c b/bfd/reloc.c index fbc67ac7280..e9d0082b0e4 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -6786,7 +6786,191 @@ ENUMDOC This is a 64 bit reloc that stores the 32 bit offset value in two words (with an imm instruction). The relocation is relative offset from start of TEXT. - +ENUM + BFD_RELOC_KVX_RELOC_START +ENUMDOC + KVX pseudo relocation code to mark the start of the KVX + relocation enumerators. N.B. the order of the enumerators is + important as several tables in the KVX bfd backend are indexed + by these enumerators; make sure they are all synced."; +ENUM + BFD_RELOC_KVX_NONE +ENUMDOC + KVX null relocation code. +ENUM +BFD_RELOC_KVX_16 +ENUMX +BFD_RELOC_KVX_32 +ENUMX +BFD_RELOC_KVX_64 +ENUMX +BFD_RELOC_KVX_S16_PCREL +ENUMX +BFD_RELOC_KVX_PCREL17 +ENUMX +BFD_RELOC_KVX_PCREL27 +ENUMX +BFD_RELOC_KVX_32_PCREL +ENUMX +BFD_RELOC_KVX_S37_PCREL_LO10 +ENUMX +BFD_RELOC_KVX_S37_PCREL_UP27 +ENUMX +BFD_RELOC_KVX_S43_PCREL_LO10 +ENUMX +BFD_RELOC_KVX_S43_PCREL_UP27 +ENUMX +BFD_RELOC_KVX_S43_PCREL_EX6 +ENUMX +BFD_RELOC_KVX_S64_PCREL_LO10 +ENUMX +BFD_RELOC_KVX_S64_PCREL_UP27 +ENUMX +BFD_RELOC_KVX_S64_PCREL_EX27 +ENUMX +BFD_RELOC_KVX_64_PCREL +ENUMX +BFD_RELOC_KVX_S16 +ENUMX +BFD_RELOC_KVX_S32_LO5 +ENUMX +BFD_RELOC_KVX_S32_UP27 +ENUMX +BFD_RELOC_KVX_S37_LO10 +ENUMX +BFD_RELOC_KVX_S37_UP27 +ENUMX +BFD_RELOC_KVX_S37_GOTOFF_LO10 +ENUMX +BFD_RELOC_KVX_S37_GOTOFF_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOTOFF_LO10 +ENUMX +BFD_RELOC_KVX_S43_GOTOFF_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOTOFF_EX6 +ENUMX +BFD_RELOC_KVX_32_GOTOFF +ENUMX +BFD_RELOC_KVX_64_GOTOFF +ENUMX +BFD_RELOC_KVX_32_GOT +ENUMX +BFD_RELOC_KVX_S37_GOT_LO10 +ENUMX +BFD_RELOC_KVX_S37_GOT_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOT_LO10 +ENUMX +BFD_RELOC_KVX_S43_GOT_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOT_EX6 +ENUMX +BFD_RELOC_KVX_64_GOT +ENUMX +BFD_RELOC_KVX_GLOB_DAT +ENUMX +BFD_RELOC_KVX_COPY +ENUMX +BFD_RELOC_KVX_JMP_SLOT +ENUMX +BFD_RELOC_KVX_RELATIVE +ENUMX +BFD_RELOC_KVX_S43_LO10 +ENUMX +BFD_RELOC_KVX_S43_UP27 +ENUMX +BFD_RELOC_KVX_S43_EX6 +ENUMX +BFD_RELOC_KVX_S64_LO10 +ENUMX +BFD_RELOC_KVX_S64_UP27 +ENUMX +BFD_RELOC_KVX_S64_EX27 +ENUMX +BFD_RELOC_KVX_S37_GOTADDR_LO10 +ENUMX +BFD_RELOC_KVX_S37_GOTADDR_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOTADDR_LO10 +ENUMX +BFD_RELOC_KVX_S43_GOTADDR_UP27 +ENUMX +BFD_RELOC_KVX_S43_GOTADDR_EX6 +ENUMX +BFD_RELOC_KVX_S64_GOTADDR_LO10 +ENUMX +BFD_RELOC_KVX_S64_GOTADDR_UP27 +ENUMX +BFD_RELOC_KVX_S64_GOTADDR_EX27 +ENUMX +BFD_RELOC_KVX_64_DTPMOD +ENUMX +BFD_RELOC_KVX_64_DTPOFF +ENUMX +BFD_RELOC_KVX_S37_TLS_DTPOFF_LO10 +ENUMX +BFD_RELOC_KVX_S37_TLS_DTPOFF_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_DTPOFF_LO10 +ENUMX +BFD_RELOC_KVX_S43_TLS_DTPOFF_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_DTPOFF_EX6 +ENUMX +BFD_RELOC_KVX_S37_TLS_GD_LO10 +ENUMX +BFD_RELOC_KVX_S37_TLS_GD_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_GD_LO10 +ENUMX +BFD_RELOC_KVX_S43_TLS_GD_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_GD_EX6 +ENUMX +BFD_RELOC_KVX_S37_TLS_LD_LO10 +ENUMX +BFD_RELOC_KVX_S37_TLS_LD_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_LD_LO10 +ENUMX +BFD_RELOC_KVX_S43_TLS_LD_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_LD_EX6 +ENUMX +BFD_RELOC_KVX_64_TPOFF +ENUMX +BFD_RELOC_KVX_S37_TLS_IE_LO10 +ENUMX +BFD_RELOC_KVX_S37_TLS_IE_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_IE_LO10 +ENUMX +BFD_RELOC_KVX_S43_TLS_IE_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_IE_EX6 +ENUMX +BFD_RELOC_KVX_S37_TLS_LE_LO10 +ENUMX +BFD_RELOC_KVX_S37_TLS_LE_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_LE_LO10 +ENUMX +BFD_RELOC_KVX_S43_TLS_LE_UP27 +ENUMX +BFD_RELOC_KVX_S43_TLS_LE_EX6 +ENUMX +BFD_RELOC_KVX_8 +ENUMDOC + KVX Relocations. +ENUM + BFD_RELOC_KVX_RELOC_END +ENUMDOC + KVX pseudo relocation code to mark the end of the KVX + relocation enumerators that have direct mapping to ELF reloc codes. + There are a few more enumerators after this one; those are mainly + used by the KVX assembler for the internal fixup or to select + one of the above enumerators. ENUM BFD_RELOC_AARCH64_RELOC_START ENUMDOC diff --git a/bfd/targets.c b/bfd/targets.c index 3dbcd088966..b966685c2f0 100644 --- a/bfd/targets.c +++ b/bfd/targets.c @@ -769,6 +769,9 @@ extern const bfd_target ia64_elf64_vms_vec; extern const bfd_target ia64_pei_vec; extern const bfd_target ip2k_elf32_vec; extern const bfd_target iq2000_elf32_vec; +extern const bfd_target kvx_elf32_vec; +extern const bfd_target kvx_elf64_vec; +extern const bfd_target kvx_elf64_linux_vec; extern const bfd_target lm32_elf32_vec; extern const bfd_target lm32_elf32_fdpic_vec; extern const bfd_target loongarch_elf64_vec; @@ -1128,6 +1131,13 @@ static const bfd_target * const _bfd_target_vector[] = &ip2k_elf32_vec, &iq2000_elf32_vec, + &kvx_elf32_vec, + +#ifdef BFD64 + &kvx_elf64_vec, + &kvx_elf64_linux_vec, +#endif + &lm32_elf32_vec, &m32c_elf32_vec, From patchwork Fri Jul 21 07:49:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Iannetta X-Patchwork-Id: 123627 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp37300vqg; Fri, 21 Jul 2023 00:50:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlFeh0psGdoVyNNDKLi7fmBoU37ZI43mV6z5whCh2qXUSGEVOMcFYTmoWUE4qIOms/tUry8N X-Received: by 2002:a05:6402:1293:b0:51e:4e7:b2fc with SMTP id w19-20020a056402129300b0051e04e7b2fcmr834956edv.28.1689925829261; Fri, 21 Jul 2023 00:50:29 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id d20-20020aa7c1d4000000b0051a200c2d2bsi2037081edp.395.2023.07.21.00.50.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 00:50:29 -0700 (PDT) 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=XQiZsYW3; 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 76CCE385DC02 for ; Fri, 21 Jul 2023 07:50:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 76CCE385DC02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689925826; bh=QgGcV1cGqXvZcjV6PY8aENSLXRugb2SCPMxb92/9egI=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=XQiZsYW3S8ozUduJKqCxH01o+A5zZI+tm5A4tJK+myvZg/5m9KWITRfiAn4CWTzFR GWhztMgFGa3EYpX5KfSmnKndpL2Qty7XG6L1KzzGlHfahCDWxYN48cd0xBAf8QNqE8 XyWjsNihXjlgEc0aNWA43GQiw0UGXRjyXuK+vQ0Y= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id CCCCA385C6DB for ; Fri, 21 Jul 2023 07:50:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCCCA385C6DB Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id DB48B3495DB for ; Fri, 21 Jul 2023 09:50:07 +0200 (CEST) Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id A5209349554 for ; Fri, 21 Jul 2023 09:50:07 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01lp0101.outbound.protection.outlook.com [104.47.25.101]) by fx409.security-mail.net (Postfix) with ESMTPS id CFCC53495B1 for ; Fri, 21 Jul 2023 09:50:06 +0200 (CEST) Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) by MR1P264MB1731.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 07:50:09 +0000 Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d]) by MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d%7]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 07:50:09 +0000 X-Virus-Scanned: E-securemail Secumail-id: <122ac.64ba38ae.a98a.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Bm0vZN0KYMnwbq48wqau3Z3fztbPmBHSbrqKXeV/NK2ujVu62BynbrgI1zolSTwQ/u9Vd9PGwENKHz5GiSFoDqKt+b3sqQeK5Q095Td7WFVUe/gwlx0cDBCnP0ryUdHBDFrE41sUzVg6cz9r8wuO3XgblKQleNRetAjC4oVRyr4GAwF0CcC7WICrV7rVE4vAiISFp+eCP/RInwX6HK3jTplS3TpAxxmeG2vg49OLm/7lFfl+wEM0BraD8Bhh5RNk21LeYAv2dobKplynRMhvKAXt1wRahEvkbX9ia+7Ky/nFCXRqteVCULWkew8ZswbUeJLa98a/EUOfvBJAswRvxw== 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=QgGcV1cGqXvZcjV6PY8aENSLXRugb2SCPMxb92/9egI=; b=gcArgLfq1MSOz0XTa07HRLWZ69U2OvUgVF5j8T4f7g5Ll5XIrP3mh+hVmkdH98lUrRxe9n4sRQ3s8gT0Rmaqufb3GG67f4aD4y0Wpzrsp6qfjoCkl1B1vMwR5c4jCQr1NGK2Jw0zAZYJk3gihORDIPlqvLBfik1JPBveCQHLrwbNhIXzrwjZ3QFs6B/tazWqAFtLP38nsB7b/JdaWJw2uKsupL00yAbisrRu6eeBneh4OAcU6TWrfnI7Z41V4sOX7uHa8KY3NKeki56OLd8zZFZpOvHN07CVVeqeoRWpbvEiD6ie1R2KMdLaXrP4chLxzh+KsAN2ta41TgqLLV/+mg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none To: binutils@sourceware.org Cc: Paul Iannetta Subject: [PATCH 2/7] kvx: Add binutils files. Date: Fri, 21 Jul 2023 09:49:51 +0200 Message-ID: <20230721074956.7188-3-piannetta@kalrayinc.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230721074956.7188-1-piannetta@kalrayinc.com> References: <20230721074956.7188-1-piannetta@kalrayinc.com> X-ClientProxiedBy: LO4P265CA0043.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ac::22) To MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2482:EE_|MR1P264MB1731:EE_ X-MS-Office365-Filtering-Correlation-Id: ec69635e-993e-49de-b11a-08db89bf1b32 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h+uZEXaz+ClGOHW1e7xyTaUUWlVsZbJEZAkjzgnOGW7qw+viQnQ+pEsaDPEM77iMIr+4WWclJ7NC28n1UmuQWGNeJwxPVJIw519FCLsvInWY1yr78ElqXjnmGC+iT6haY8mKlPR5yqW3o+w3czSGSbRYUC8mI1EE5pTzELAiu+NvDiklKGg7u0qW3iiiKB+hrNXRLe6gw4OKe2z5TZEQpZMverqwrjBnCaOWpFvNlo2WuWtWRl2wihoCpkXnjyRfZ9rneI3q18UlHfrvZtTZ2vRoxP1NrpUredscX/j5ogM7/EKP59Ms8m+ZancMDIKVzJrDU7cAne0uu1VDmNUtTWxOuXV3WNQze+2OD6G6Nkilcj7dYC4bNAds+5Tx6TXQO1UnvQa6bDwxiqpuyHqj+JKicHKiXnVvGRrZnTT2Klkrlk9HiJhYhi9kGkvYNU3LdAW/cDJpWv6f3cRbY7F0dqCuTlwhWvw6Lajzm/VYOB4KAln9BMs7rWuPOZSqaQcwQRQ3NkEfodUIfHrtp4IvjulOcExi1M11IzTrWsWT75F2YBy9iWSWOsq2aAuiL6WQv5SOUzr3LRNU0pPP3IT1GA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(39850400004)(346002)(376002)(451199021)(6666004)(6486002)(478600001)(83380400001)(6916009)(26005)(6506007)(1076003)(107886003)(6512007)(4326008)(38100700002)(66556008)(66476007)(66946007)(186003)(2616005)(5660300002)(8676002)(30864003)(8936002)(2906002)(41300700001)(316002)(86362001)(36756003)(2004002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qOaDwXbgZbE0Dfl46HEi6dNIfUeVfgmScfgAXxNNimlmZFlkiPm7pZrA3Eios9yrBCcH/fDqOPEZW2HZ5DmVb5QcJkMIuoqVsrEYTvk/Yf2bEs6F0RV6Zfqq9GHpNAgrDDX7DoZm0KRxMRzLSVnsNgK8oeZgQsavq8c4kYKJkUENzkodTwwxagv5ATW1ZPoGYjiyvLE0910Lwh+UTr43RJfh0Zi54dAJgwPg6dcjmo+jRl+wcIwvb04AmuAEEMPjT/X9J4kAmk5ARmwTBZgXMeUyyWZSWTPZqsJVwjxoOc+R/k1lcGrEGno5Tlzlk6mTMar0DNVFaI7N9EuKaRowa6QCm5rfIryaWek0Lwg3ARKn37WdEpedajtMna7nB1GF6PmO8Pdnb8r4/353rCraEGw3HNs4uPD7p88HpioLKKkNYju/u+u157QqhzekRX33zM2ni5cDBbVR0USoiX2TmUMOdJSDlk7bF7xMXYOIJ/6ZfjO0lHCD+3+8I/6r9RvSfskmc1oDa4ugD5EkMqkgFGJbp8cY6FxIIJ3s4ZBUfAztgvnpavVKvUoJp5EGKZwyvWHVlhE1zoudCkvLD2oRH1w/tgEmwjm8Wv5MK7XtruTyJxFu1sZ+TlXxWv7gJhAeUfIoDqG28xIV/wIBt9oeuhue3twROt+0yBtawI5FGmq7GUZt1lAtfbTmcxQCFIFM/5Af1CBR+GaXw9tRlndJQ9k31mHRVIzDXw2gJdlH4OKqiJ7V/Z970Q9Vbhr8yBhXjKhTnlwdYXCiKNX9iHNNpd4uaYo53AbfIBFT6R/PgFkAtS3U6i9MVuRMaVo3VejzxDyNQqKmaw2s/SILg8z7zuu4UHQhQz3v8CpIb0tqs8uLvxtjxJTb3fxmObhZXUBRLY89OIIKPztaTI4azBICykNausd4BlHCQYbvBamifDUDpRRHRW1H60zEvZEpVwAC hiNRSIGw50X+wxFdpImP2XLzBZ4m8zOv/k9nu85Swe6Tc38icw+PKOKcAvNrqBerqWPdoa2h/Sq674puswGa2Jx6JwUGycz9M7P71V5iZBku/tl5HhCCAxoD5TDdrtCTFXKSz+XoffUf2xVzBhfU6gpwLQtgMDWZgRlx+wu4x0xPOPsw8KWtsi685uTw14HKYmN1y8ALksDNlEShA6pB6dl9QVCQL4/oQTbqmU6E0hfaoX8co6TpXFXGiWfNQcUhE6dRyBmpXgv7HyoK8Z1iVxPFp6wEy9YgWg8T2y6S6FF7fNZfVrF7HVdAIvC/XRlaIEIH5zI4FdtdRypwTOo0kajuBoBqx8KpuuZHxblJP+eub0IOd3STctGduMVzfTfDUeF2MxwyvxOhxUUK6my1VCTdsiZVhBMEJOuurYBabCtVMWIZX2SOH2ZVV/cMlKM4SIvNZfcV7HakShmMCqSr9oNBFUKuKbBxL0FUrOVaiHPwWaHqHqVedgBK+D3yzvLVEil9C5x5agw0MrllO0hc4WL4pFKKOGF02pbK1kFXR6UhM19oj55gX0ZhVzkifHWDWsHHy2rkzo7v19sDCUaGHRAy6Rk2l6+EiORXonRKssKbn/QcahNyZL/U/ofBpZqc016QgGcme0COYPFiGe9/KQ== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec69635e-993e-49de-b11a-08db89bf1b32 X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 07:50:09.2263 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bVu53dMsiKJaugb0ejHFY8A+j6TcuT+6R8G0dXCOIQwmh30uf8fjSjZyYRi86wh9pgfObJ7u+RXx0cairMYlZg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1731 X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Paul Iannetta via Binutils From: Paul Iannetta Reply-To: Paul Iannetta Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772015666475554945 X-GMAIL-MSGID: 1772015666475554945 binutils/ChangeLog: 2023-07-20 Paul Iannetta * readelf.c (guess_is_rela): Add EM_KVX. (dump_relocations): Likewise. (get_machine_flags): Likewise. (is_32bit_abs_reloc): Likewise. (is_32bit_pcrel_reloc): Likewise. (is_64bit_abs_reloc): Likewise. (is_16bit_abs_reloc): Likewise. (is_none_reloc): Likewise. * testsuite/binutils-all/dw2-decodedline-2.S: New test. * testsuite/binutils-all/kvx/kvx.exp: New file. * testsuite/binutils-all/kvx/pcrel_bundle.d: New test. * testsuite/binutils-all/kvx/pcrel_bundle.s: New test. * testsuite/binutils-all/kvx/pcrel_bundle32bits.d: New test. * testsuite/binutils-all/kvx/pcrel_bundle32bits.s: New test. * testsuite/binutils-all/objcopy.exp: * testsuite/binutils-all/objdump.exp: * testsuite/lib/binutils-common.exp: --- binutils/readelf.c | 26 +++++++++++++ .../binutils-all/dw2-decodedline-2.S | 18 +++++++++ binutils/testsuite/binutils-all/kvx/kvx.exp | 37 +++++++++++++++++++ .../testsuite/binutils-all/kvx/pcrel_bundle.d | 33 +++++++++++++++++ .../testsuite/binutils-all/kvx/pcrel_bundle.s | 25 +++++++++++++ .../binutils-all/kvx/pcrel_bundle32bits.d | 33 +++++++++++++++++ .../binutils-all/kvx/pcrel_bundle32bits.s | 25 +++++++++++++ binutils/testsuite/binutils-all/objcopy.exp | 1 + binutils/testsuite/binutils-all/objdump.exp | 2 + binutils/testsuite/lib/binutils-common.exp | 6 +++ 10 files changed, 206 insertions(+) create mode 100644 binutils/testsuite/binutils-all/dw2-decodedline-2.S create mode 100644 binutils/testsuite/binutils-all/kvx/kvx.exp create mode 100644 binutils/testsuite/binutils-all/kvx/pcrel_bundle.d create mode 100644 binutils/testsuite/binutils-all/kvx/pcrel_bundle.s create mode 100644 binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.d create mode 100644 binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.s diff --git a/binutils/readelf.c b/binutils/readelf.c index bb488ef2a5e..d675440eddd 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -121,6 +121,7 @@ #include "elf/i960.h" #include "elf/ia64.h" #include "elf/ip2k.h" +#include "elf/kvx.h" #include "elf/lm32.h" #include "elf/iq2000.h" #include "elf/m32c.h" @@ -1083,6 +1084,7 @@ guess_is_rela (unsigned int e_machine) case EM_IP2K: case EM_IP2K_OLD: case EM_IQ2000: + case EM_KVX: case EM_LATTICEMICO32: case EM_M32C_OLD: case EM_M32C: @@ -1767,6 +1769,10 @@ dump_relocations (Filedata *filedata, rtype = elf_ia64_reloc_type (type); break; + case EM_KVX: + rtype = elf_kvx_reloc_type (type); + break; + case EM_CRIS: rtype = elf_cris_reloc_type (type); break; @@ -4351,6 +4357,17 @@ get_machine_flags (Filedata * filedata, unsigned e_flags, unsigned e_machine) strcat (buf, ", relocatable module"); break; + case EM_KVX: + if ((e_flags & (ELF_KVX_CORE_MAJOR_MASK | ELF_KVX_CORE_MINOR_MASK)) == ELF_KVX_CORE_KV3_1) + strcat (buf, ", Kalray VLIW kv3-1"); + else if ((e_flags & (ELF_KVX_CORE_MAJOR_MASK | ELF_KVX_CORE_MINOR_MASK)) == ELF_KVX_CORE_KV3_2) + strcat (buf, ", Kalray VLIW kv3-2"); + else if ((e_flags & (ELF_KVX_CORE_MAJOR_MASK | ELF_KVX_CORE_MINOR_MASK)) == ELF_KVX_CORE_KV4_1) + strcat (buf, ", Kalray VLIW kv4-1"); + else + strcat (buf, ", unknown KVX MPPA"); + break; + case EM_MSP430: strcat (buf, _(": architecture variant: ")); switch (e_flags & EF_MSP430_MACH) @@ -14385,6 +14402,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 2; /* R_IP2K_32. */ case EM_IQ2000: return reloc_type == 2; /* R_IQ2000_32. */ + case EM_KVX: + return reloc_type == 2; /* R_KVX_32. */ case EM_LATTICEMICO32: return reloc_type == 3; /* R_LM32_32. */ case EM_LOONGARCH: @@ -14582,6 +14601,8 @@ is_32bit_pcrel_reloc (Filedata * filedata, unsigned int reloc_type) case EM_XTENSA_OLD: case EM_XTENSA: return reloc_type == 14; /* R_XTENSA_32_PCREL. */ + case EM_KVX: + return reloc_type == 7; /* R_KVX_32_PCREL */ default: /* Do not abort or issue an error message here. Not all targets use pc-relative 32-bit relocs in their DWARF debug information and we @@ -14633,6 +14654,8 @@ is_64bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) return reloc_type == 1; /* R_TILEGX_64. */ case EM_MIPS: return reloc_type == 18; /* R_MIPS_64. */ + case EM_KVX: + return reloc_type == 3; /* R_KVX_64 */ default: return false; } @@ -14736,6 +14759,8 @@ is_16bit_abs_reloc (Filedata * filedata, unsigned int reloc_type) case EM_CYGNUS_MN10300: case EM_MN10300: return reloc_type == 2; /* R_MN10300_16. */ + case EM_KVX: + return reloc_type == 1; /* R_KVX_16 */ case EM_MSP430: if (uses_msp430x_relocs (filedata)) return reloc_type == 2; /* R_MSP430_ABS16. */ @@ -14998,6 +15023,7 @@ is_none_reloc (Filedata * filedata, unsigned int reloc_type) case EM_FT32: /* R_FT32_NONE. */ case EM_IA_64: /* R_IA64_NONE. */ case EM_K1OM: /* R_X86_64_NONE. */ + case EM_KVX: /* R_KVX_NONE. */ case EM_L1OM: /* R_X86_64_NONE. */ case EM_M32R: /* R_M32R_NONE. */ case EM_MIPS: /* R_MIPS_NONE. */ diff --git a/binutils/testsuite/binutils-all/dw2-decodedline-2.S b/binutils/testsuite/binutils-all/dw2-decodedline-2.S new file mode 100644 index 00000000000..333cd3626a6 --- /dev/null +++ b/binutils/testsuite/binutils-all/dw2-decodedline-2.S @@ -0,0 +1,18 @@ + .file "dw2-decodedline.c" + .file 1 "dw2-decodedline.c" + .file 2 "directory/file1.c" + .text + .globl f1 + .type f1, %function +f1: + .loc 2 1 0 + nop + ;; + .size f1, .-f1 + .globl main + .type main, %function +main: + .loc 1 2 0 + nop + ;; + .size main, .-main diff --git a/binutils/testsuite/binutils-all/kvx/kvx.exp b/binutils/testsuite/binutils-all/kvx/kvx.exp new file mode 100644 index 00000000000..e096bebb65a --- /dev/null +++ b/binutils/testsuite/binutils-all/kvx/kvx.exp @@ -0,0 +1,37 @@ +# Copyright (C) 2009-2023 Free Software Foundation, Inc. +# Contributed by Kalray SA. + +# This program 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 of the License, or +# (at your option) any later version. + +# This program 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; see the file COPYING3. If not, +# see . */ + +if {!([istarget "kvx*-*-*"]) + || ![is_elf_format] + || [is_remote host]} then { + return +} + +global tempfile +global copyfile +set tempfile tmpdir/kvxtemp.o +set copyfile tmpdir/kvxcopy + +## binutils test framework does not support the 'dump' EXTRA args to +## simply share a single .s for 32 and 64bits test. +# So we duplicate the source .s + +# 32bits test +run_dump_test "pcrel_bundle32bits" + +# 64bits test +run_dump_test "pcrel_bundle" diff --git a/binutils/testsuite/binutils-all/kvx/pcrel_bundle.d b/binutils/testsuite/binutils-all/kvx/pcrel_bundle.d new file mode 100644 index 00000000000..ff8df45bb0e --- /dev/null +++ b/binutils/testsuite/binutils-all/kvx/pcrel_bundle.d @@ -0,0 +1,33 @@ +#name: pcrel_bundle +#source: pcrel_bundle.s +#PROG: objcopy +#as: +#objdump: -dr +#... + +Disassembly of section .text: + +0000000000000000 : + 0: 00 0e 00 f0 00 00 00 80 00 00 00 00 pcrel \$r0 = 56 \(0x38\);; + + c: 0d 00 00 98 call 40 + 10: 00 0b 00 f0 00 00 00 80 00 00 00 00 pcrel \$r0 = 44 \(0x2c\);; + + 1c: 09 00 00 98 call 40 + 20: 00 07 00 f0 00 00 00 b8 00 00 00 80 pcrel \$r0 = 28 \(0x1c\) + 2c: 00 00 00 00 ld \$r0 = 0 \(0x0\)\[\$r0\];; + + 30: 00 f0 03 7f nop;; + + 34: 00 f0 03 7f nop;; + + +0000000000000038 <.table>: + 38: 00 f0 03 7f nop;; + + 3c: 00 f0 03 7f nop;; + + +0000000000000040 : + 40: 00 f0 03 7f nop;; + diff --git a/binutils/testsuite/binutils-all/kvx/pcrel_bundle.s b/binutils/testsuite/binutils-all/kvx/pcrel_bundle.s new file mode 100644 index 00000000000..feaa581ce8f --- /dev/null +++ b/binutils/testsuite/binutils-all/kvx/pcrel_bundle.s @@ -0,0 +1,25 @@ +foo: + pcrel $r0 = @pcrel(.table) + ;; + call bar + pcrel $r0 = @pcrel(.table) + ;; + call bar + ld $r0 = 0[$r0] + pcrel $r0 = @pcrel(.table) + ;; + nop + ;; + nop + ;; +.table: + nop + ;; + nop + ;; +bar: + nop + ;; + + + diff --git a/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.d b/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.d new file mode 100644 index 00000000000..732b3c50507 --- /dev/null +++ b/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.d @@ -0,0 +1,33 @@ +#name: pcrel_bundle +#source: pcrel_bundle.s +#PROG: objcopy +#as: -m32 +#objdump: -dr +#... + +Disassembly of section .text: + +00000000 : + 0: 00 0b 00 f0 00 00 00 00 pcrel \$r0 = 44 \(0x2c\);; + + 8: 0b 00 00 98 call 34 + c: 00 09 00 f0 00 00 00 00 pcrel \$r0 = 36 \(0x24\);; + + 14: 08 00 00 98 call 34 + 18: 00 06 00 f0 00 00 00 b8 pcrel \$r0 = 24 \(0x18\) + 20: 00 00 00 00 ld \$r0 = 0 \(0x0\)\[\$r0\];; + + 24: 00 f0 03 7f nop;; + + 28: 00 f0 03 7f nop;; + + +0000002c <.table>: + 2c: 00 f0 03 7f nop;; + + 30: 00 f0 03 7f nop;; + + +00000034 : + 34: 00 f0 03 7f nop;; + diff --git a/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.s b/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.s new file mode 100644 index 00000000000..feaa581ce8f --- /dev/null +++ b/binutils/testsuite/binutils-all/kvx/pcrel_bundle32bits.s @@ -0,0 +1,25 @@ +foo: + pcrel $r0 = @pcrel(.table) + ;; + call bar + pcrel $r0 = @pcrel(.table) + ;; + call bar + ld $r0 = 0[$r0] + pcrel $r0 = @pcrel(.table) + ;; + nop + ;; + nop + ;; +.table: + nop + ;; + nop + ;; +bar: + nop + ;; + + + diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp index 41add0fecda..16d9c8dad59 100644 --- a/binutils/testsuite/binutils-all/objcopy.exp +++ b/binutils/testsuite/binutils-all/objcopy.exp @@ -693,6 +693,7 @@ proc copy_setup { } { } if { [istarget *-*-linux*] + || [istarget kvx-*-*] || [istarget *-*-gnu*] } { foreach i $gcc_gas_flag { set flags "additional_flags=$i $flags" diff --git a/binutils/testsuite/binutils-all/objdump.exp b/binutils/testsuite/binutils-all/objdump.exp index 28a7ad671cd..4fe9e499d49 100644 --- a/binutils/testsuite/binutils-all/objdump.exp +++ b/binutils/testsuite/binutils-all/objdump.exp @@ -482,6 +482,8 @@ if { ![is_elf_format] } else { if { [istarget "or1k*-*-*"] } then { set decodedline_testsrc $srcdir/$subdir/dw2-decodedline-1.S + } elseif { [istarget "kvx*-*-*"] } { + set decodedline_testsrc $srcdir/$subdir/dw2-decodedline-2.S } else { set decodedline_testsrc $srcdir/$subdir/dw2-decodedline.S } diff --git a/binutils/testsuite/lib/binutils-common.exp b/binutils/testsuite/lib/binutils-common.exp index 7e6bf16ee6e..0dd9bae98fc 100644 --- a/binutils/testsuite/lib/binutils-common.exp +++ b/binutils/testsuite/lib/binutils-common.exp @@ -41,6 +41,7 @@ proc is_elf_format {} { && ![istarget *-*-irix5*] && ![istarget *-*-irix6*] && ![istarget *-*-kaos*] + && ![istarget kvx-*-*] && ![istarget *-*-*linux*] && ![istarget *-*-lynxos*] && ![istarget *-*-nacl*] @@ -371,6 +372,11 @@ proc check_pie_support { } { global pie_available_saved global ld + ## kvx-*-cos does support -shared but not PIE. + if { [istarget "kvx-*-cos"] } { + set pie_available_saved 0 + } + if {![info exists pie_available_saved]} { set ld_output [remote_exec host $ld "-pie"] if { [ string first "not supported" $ld_output ] >= 0 } { From patchwork Fri Jul 21 07:49:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Iannetta X-Patchwork-Id: 123629 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp37493vqg; Fri, 21 Jul 2023 00:51:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9hJ8hXOeaGCfZa/ByfqhjROD0l/oZKPWMymP6OVmDBhIoTLo0sLV5DlCloPCGi4uoOw5l X-Received: by 2002:a05:6512:ac5:b0:4f8:5886:186d with SMTP id n5-20020a0565120ac500b004f85886186dmr957246lfu.9.1689925863043; Fri, 21 Jul 2023 00:51:03 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id b13-20020a170906490d00b00992b75dedafsi1742826ejq.507.2023.07.21.00.51.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 00:51:03 -0700 (PDT) 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=EbcI6ePB; 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 D0FD23850426 for ; Fri, 21 Jul 2023 07:50:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0FD23850426 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689925841; bh=9u2FyLy0B+uQGiqBrFzYgzm3ANo7f2wDR1fS1ZDpcFs=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=EbcI6ePBke8HaL6rwUi4yS5fteYt4JNTblJhNP98Mr2ew5q+o+1vNWZANpndfLnoU JzA/7h8/sNAN95L9xyP7iELROm3MXE2H/itZxSn50+TEzcSQnRqOYc+5WmtxdSrbuI eD6S69UlqbYBPhDlWKnWm3rVlnJF6/ksu4BPML04= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id D6AB7385C6D5 for ; Fri, 21 Jul 2023 07:50:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D6AB7385C6D5 Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 3454D3493AA for ; Fri, 21 Jul 2023 09:50:17 +0200 (CEST) Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id ECB05349720 for ; Fri, 21 Jul 2023 09:50:14 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01lp0108.outbound.protection.outlook.com [104.47.25.108]) by fx409.security-mail.net (Postfix) with ESMTPS id 9FE52349681 for ; Fri, 21 Jul 2023 09:50:10 +0200 (CEST) Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) by MR1P264MB1731.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 07:50:12 +0000 Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d]) by MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d%7]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 07:50:12 +0000 X-Virus-Scanned: E-securemail Secumail-id: <12564.64ba38b2.9bc9f.0> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IpmEuHXv23CG5myD3DKajuhW3mvbQ6oTK5fhAHDiti3GlDftLcFF6rlFo9Dvr/HfESmbm+Cs8OFwL4KSNWFjkg4VqMQilsSKiggr7IGsxF78/8IgW97fh8SkLePkyK/dfTl2U9IUTOWuoXQwsO/xeTjT3ZPOB8y7Kd/npFK9paVgfKjPAIW+a2DiqQSBEOWQf+cVI7UgmYuHjd62iL2LXHDnHJPIXgar9DsdOyTpLccm3NDatVTM8vevg6qegtkpSkQYMDgepLd9ENqEGu5DyQjU9dnzyN4gbvaK3HidPG79C2hMUSxLvOcCSa0GYE8WnRZGLUyv4Xch19ZkW3zTRw== 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=9u2FyLy0B+uQGiqBrFzYgzm3ANo7f2wDR1fS1ZDpcFs=; b=hQCsI14xe2oC5Q4L2zN1rHIdTc3M2KDUxliI7N7iHWpLwMh8P4R2s41H9wWQPvJX+AnJFF3WeeY+4xtRB3AAFKTYul3GR6lYkwHoeoDxXg+V0SLXMpPvYaOEob06EouOI58qNdA5krLp5tgQMV0+/yOiIlqhu2Rw+DO8O0jIF3KNiBKW/f6M19Ix6o5rYxFrhw9NOaJZeICyTPdZ/SRnYVfPnmYZY8exdpqC9oiFs4Cr4xVqPCT6jm0iZJ7blJvppwjgxOTTOnwW7m33ircEuwlCje5Hgn2PbUeZKMGp/8yesJBlzDyFnrr5TIPMvOFQDFGHo1+afHuQ6gq6Yqy+uQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none To: binutils@sourceware.org Cc: Paul Iannetta Subject: [PATCH 4/7] kvx: Add ld files. Date: Fri, 21 Jul 2023 09:49:53 +0200 Message-ID: <20230721074956.7188-5-piannetta@kalrayinc.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230721074956.7188-1-piannetta@kalrayinc.com> References: <20230721074956.7188-1-piannetta@kalrayinc.com> X-ClientProxiedBy: LO4P123CA0103.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:191::18) To MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2482:EE_|MR1P264MB1731:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c938df0-2165-4ef9-c472-08db89bf1cdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wWYDf+P30PzP82kCiZpZtg9oxp5fL09+v2ybrf2fAPYCC/w0urHv9JPUzZ1pSPVjoZVv0I8jbjqp1f1lEj7r/aPHOfgn6ePwbvnsFvX5XA5+AWQM1n2OwMt5QV7QegaYLH0EVXlYlmtswiqsf0nZSbVWQdUX5ckZLYQyczvUYJCo8BFhkh4ZMkdV+w45icxg6TW4m9R6Fl7dIhZJysv7A/OknWTHOmTTYxCEdUZcqbE3/qgJU3DGhzK5a9W/XvPYM3jYz1rCtwUNum7/Ms9I+8lmq2a9GCq/qIh2m+f7tD0hmjORMB2tdrPY3xEpa5IaD4Vxi/8UxGr/+ZHDz3PWOXrb6nlKJWz5XaRiMzDgs4GClQLdq7YacraLrgtWZb5MhRqRC99v/gkhS8co6Ve37eG/8nxgTbOT+9HS8CvI/bcoNR+4fDagVxTPx/biwERDmq7hOsLlscmNgRXolrKmPvGQXC5yWfiAG5mwFatlOmX3wNqzT0pdjkkEFx27zSABiSOd5rxfY+qziTKz0QzA/gkRyTGpSHNphrjS3gFQrsJ1yGF+fIzR/Z17zCSVXhdBOjtMIjXNuCr8h578d2rT8JoZE4Doc9OYCjQSJ5F15mE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(39850400004)(346002)(376002)(451199021)(6666004)(6486002)(478600001)(83380400001)(6916009)(26005)(6506007)(1076003)(107886003)(6512007)(4326008)(38100700002)(66556008)(66476007)(66946007)(186003)(2616005)(5660300002)(8676002)(30864003)(8936002)(2906002)(41300700001)(316002)(86362001)(36756003)(2004002)(579004)(559001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +KixT+elDyfjODhKCzH14x66vTTjiQTok2cgr6KPZgyM+xgqvJNSZcpZhcKLjq0msn3FTQrn6u3OsOsg9QJ+ls/jz3XAiwXwdvx+ziLOZyGQV8Mf6cqckaozwXSjJyW44oQS74lj5WCLp3ZMkg9CXjCGOuEhPI8rzOzSbjQzibgJCoIE18swGll6QSjPx7rZ4bTK7sDNZAMnedMxR6osm8kjaUXqjI3/I7knkDS/Gu/8JKT4Qk5Qow6xLshgundm2SMuwZO8j/Q/joPz9zN6QNoswrWlpiOg2gOrUBROvbEGsrNuoLbVqkOVCKvBiAtLY8nZVfIwRcRDRlf89gRLzGULseoXYesiZ/IITNn+i9Wsp8dxfiD4zbCv8DvkmyUcJr70L+ifkw6SRa8zA2rjM0ce8/s5FHfnPwKvhz0sy0RM7k7YrKkpjK91uHY5vszp9feh3aZ1+87PBkrUejJ5ak8Za5PHWAxA9NKRtdJam4ENqi0UyjyQz8iYJD/ne5vLz6Cexa8QEfJAg0zkPxoFM3ddDu/Ah+AKBbpjnPhhZxhA+V6071W4lsnEplz+FESd7FOpHzFqH8VzSZt2jZfD2Bca9Q8zdqwOxq0kciugSRlLRBQYbncwu1L/1NQPAO1tDQU0er4Ez4mWzjIHZXwVAIrALye2R7NnEd18Ac0Gd51xBycKaU8NCr61//gITNNBKRc9KymVAlhTVcyJycRLUKKJrtLKdYt+BbRVoPXHqcYORTr8IU1pNgmoeg7hD0db7R7MItXtwytyFEKYj9u1+CkXz26uj1L1t6TnBXacAc7zKW+AWn6b3UB/THDeZc9fEFIuO3SiGP3DXSwuTL1k+RTFf2szfxDCBWEUMxK6IWey05uSMgHQHxdlYz2O79eZLYCQaT6JWVF5sgNh9Z+TPbnq/MzouzYkCzzZjPUpbpUR0YeovCIHuQBZ4s29Jf9a 4MlH6i+vMlkmSIbQJb+W5dX95Y52YUpWWOrrYkIwv8/kzeWfcfofhvYf8K9yGti64zOzqOi04lDM1BIDt/yFmlmHH0Q+rvRqPY4wBQwjpuToes3ccETK5Fh6NxOLOxY06D/riiFRl4jsqayDWjFC6fKgfh7TNQnmnV7NeGrS7zEpgRindhcEiafBC43Mx/8Bl1uFy0uMgWK9WjQ6xlQwvQY58wx4bctL8yDfme8z1UE5meRmTj/J+mSTHGRK618aBReiu5QO0/+BjI1H/bRDQ9xnjmKsEvEMpvS+nTJdGGpC7GuE/Hvd/KSG0mxAadSzZ55NKSBkl9wXkaA6ElRhe+IYX5Z8hJw2T35W1EoKn2duP1IW9vix14IkPFCtqDn1650MWEsyxcaV3/KDN1rYxe7g1vej26CFAjkkMVqsWjJtkLbiDNP4upk05+Cpri464qCSbGv15vA+q4D5IrSwSLyeIOIayfyqCMnVj51CV/l41UIuuxZmwRT6uLuRn3D60apTS7yVl+bPq3IWYTzJoDYTlypZgS4fLclpz/e3ozc/Y4b7b2dlIngGIe4os+yj+LVnnbuwHIFh7ChZSPpesrDedvighs7r5RIWHGviUaSFkfaSX4+vb23zG/Sfn/58AMOdNC7YBtEzwsQr3f4hhA== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1c938df0-2165-4ef9-c472-08db89bf1cdf X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 07:50:12.0756 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jmfrwYaUmm7DG8izRHaqGs86fQj6ECR3xC7n2mro2GF5rAAIMsB3Lx+zTp5Ejs4YIwIm8LQ+TCPipOwhmRb4zQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1731 X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Paul Iannetta via Binutils From: Paul Iannetta Reply-To: Paul Iannetta Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772015701876985179 X-GMAIL-MSGID: 1772015701876985179 ld/ChangeLog: 2023-07-20 Paul Iannetta * Makefile.am (ALL_EMULATION_SOURCES): Add eelf32kvx.c. (ALL_64_EMULATION_SOURCES) Add eelf64kvx.c and eelf64kvx_linux.c. * Makefile.in: Regenerate. * configure: Regenerate. * configure.tgt: Add kvx-*-linux* and kvx-*-*. * emulparams/elf32kvx.sh: New file. * emulparams/elf64kvx.sh: New file. * emulparams/elf64kvx_linux.sh: New file. * emultempl/kvxelf.em: New file. * po/BLD-POTFILES.in: Add eelf32kvx.c, eelf64kvx.c and eelf64kvx_linux.c. * testsuite/ld-elf/shared.exp: Add kvx. * testsuite/ld-kvx/farcall-back.d: New test. * testsuite/ld-kvx/farcall-back.s: New test. * testsuite/ld-kvx/farcall-call-defsym.d: New test. * testsuite/ld-kvx/farcall-call-defsym.s: New test. * testsuite/ld-kvx/farcall-call-none-function.d: New test. * testsuite/ld-kvx/farcall-call-none-function.s: New test. * testsuite/ld-kvx/farcall-call-plt-32bits.d: New test. * testsuite/ld-kvx/farcall-call-plt.d: New test. * testsuite/ld-kvx/farcall-call-plt.s: New test. * testsuite/ld-kvx/farcall-call-section.d: New test. * testsuite/ld-kvx/farcall-call-section.s: New test. * testsuite/ld-kvx/farcall-call.d: New test. * testsuite/ld-kvx/farcall-call.s: New test. * testsuite/ld-kvx/farcall-goto-defsym.d: New test. * testsuite/ld-kvx/farcall-goto-defsym.s: New test. * testsuite/ld-kvx/farcall-goto-gsym.d: New test. * testsuite/ld-kvx/farcall-goto-gsym.s: New test. * testsuite/ld-kvx/farcall-goto-none-function.d: New test. * testsuite/ld-kvx/farcall-goto-none-function.s: New test. * testsuite/ld-kvx/farcall-goto-plt-32bits.d: New test. * testsuite/ld-kvx/farcall-goto-plt.d: New test. * testsuite/ld-kvx/farcall-goto-plt.s: New test. * testsuite/ld-kvx/farcall-goto-section.d: New test. * testsuite/ld-kvx/farcall-goto-section.s: New test. * testsuite/ld-kvx/farcall-goto.d: New test. * testsuite/ld-kvx/farcall-goto.s: New test. * testsuite/ld-kvx/kvx-elf.exp: New file. * testsuite/ld-kvx/kvx.ld: New test. * testsuite/ld-kvx/limit-call.d: New test. * testsuite/ld-kvx/limit-call.s: New test. * testsuite/ld-kvx/limit-goto.d: New test. * testsuite/ld-kvx/limit-goto.s: New test. * testsuite/ld-kvx/pcrel-reloc-32bits.d: New test. * testsuite/ld-kvx/pcrel-reloc.d: New test. * testsuite/ld-kvx/pcrel-reloc.s: New test. --- ld/Makefile.am | 6 + ld/Makefile.in | 9 + ld/configure | 4 +- ld/configure.tgt | 5 + ld/emulparams/elf32kvx.sh | 32 ++ ld/emulparams/elf64kvx.sh | 39 +++ ld/emulparams/elf64kvx_linux.sh | 41 +++ ld/emultempl/kvxelf.em | 310 ++++++++++++++++++ ld/po/BLD-POTFILES.in | 3 + ld/testsuite/ld-elf/shared.exp | 1 + ld/testsuite/ld-kvx/farcall-back.d | 79 +++++ ld/testsuite/ld-kvx/farcall-back.s | 54 +++ ld/testsuite/ld-kvx/farcall-call-defsym.d | 14 + ld/testsuite/ld-kvx/farcall-call-defsym.s | 12 + .../ld-kvx/farcall-call-none-function.d | 24 ++ .../ld-kvx/farcall-call-none-function.s | 19 ++ ld/testsuite/ld-kvx/farcall-call-plt-32bits.d | 31 ++ ld/testsuite/ld-kvx/farcall-call-plt.d | 34 ++ ld/testsuite/ld-kvx/farcall-call-plt.s | 14 + ld/testsuite/ld-kvx/farcall-call-section.d | 34 ++ ld/testsuite/ld-kvx/farcall-call-section.s | 25 ++ ld/testsuite/ld-kvx/farcall-call.d | 25 ++ ld/testsuite/ld-kvx/farcall-call.s | 20 ++ ld/testsuite/ld-kvx/farcall-goto-defsym.d | 14 + ld/testsuite/ld-kvx/farcall-goto-defsym.s | 12 + ld/testsuite/ld-kvx/farcall-goto-gsym.d | 5 + ld/testsuite/ld-kvx/farcall-goto-gsym.s | 20 ++ .../ld-kvx/farcall-goto-none-function.d | 26 ++ .../ld-kvx/farcall-goto-none-function.s | 19 ++ ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d | 31 ++ ld/testsuite/ld-kvx/farcall-goto-plt.d | 34 ++ ld/testsuite/ld-kvx/farcall-goto-plt.s | 13 + ld/testsuite/ld-kvx/farcall-goto-section.d | 36 ++ ld/testsuite/ld-kvx/farcall-goto-section.s | 25 ++ ld/testsuite/ld-kvx/farcall-goto.d | 25 ++ ld/testsuite/ld-kvx/farcall-goto.s | 20 ++ ld/testsuite/ld-kvx/kvx-elf.exp | 70 ++++ ld/testsuite/ld-kvx/kvx.ld | 18 + ld/testsuite/ld-kvx/limit-call.d | 20 ++ ld/testsuite/ld-kvx/limit-call.s | 22 ++ ld/testsuite/ld-kvx/limit-goto.d | 20 ++ ld/testsuite/ld-kvx/limit-goto.s | 22 ++ ld/testsuite/ld-kvx/pcrel-reloc-32bits.d | 8 + ld/testsuite/ld-kvx/pcrel-reloc.d | 14 + ld/testsuite/ld-kvx/pcrel-reloc.s | 10 + 45 files changed, 1317 insertions(+), 2 deletions(-) create mode 100755 ld/emulparams/elf32kvx.sh create mode 100644 ld/emulparams/elf64kvx.sh create mode 100644 ld/emulparams/elf64kvx_linux.sh create mode 100644 ld/emultempl/kvxelf.em create mode 100644 ld/testsuite/ld-kvx/farcall-back.d create mode 100644 ld/testsuite/ld-kvx/farcall-back.s create mode 100644 ld/testsuite/ld-kvx/farcall-call-defsym.d create mode 100644 ld/testsuite/ld-kvx/farcall-call-defsym.s create mode 100644 ld/testsuite/ld-kvx/farcall-call-none-function.d create mode 100644 ld/testsuite/ld-kvx/farcall-call-none-function.s create mode 100644 ld/testsuite/ld-kvx/farcall-call-plt-32bits.d create mode 100644 ld/testsuite/ld-kvx/farcall-call-plt.d create mode 100644 ld/testsuite/ld-kvx/farcall-call-plt.s create mode 100644 ld/testsuite/ld-kvx/farcall-call-section.d create mode 100644 ld/testsuite/ld-kvx/farcall-call-section.s create mode 100644 ld/testsuite/ld-kvx/farcall-call.d create mode 100644 ld/testsuite/ld-kvx/farcall-call.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto-defsym.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-defsym.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto-gsym.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-gsym.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto-none-function.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-none-function.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-plt.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-plt.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto-section.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto-section.s create mode 100644 ld/testsuite/ld-kvx/farcall-goto.d create mode 100644 ld/testsuite/ld-kvx/farcall-goto.s create mode 100644 ld/testsuite/ld-kvx/kvx-elf.exp create mode 100644 ld/testsuite/ld-kvx/kvx.ld create mode 100644 ld/testsuite/ld-kvx/limit-call.d create mode 100644 ld/testsuite/ld-kvx/limit-call.s create mode 100644 ld/testsuite/ld-kvx/limit-goto.d create mode 100644 ld/testsuite/ld-kvx/limit-goto.s create mode 100644 ld/testsuite/ld-kvx/pcrel-reloc-32bits.d create mode 100644 ld/testsuite/ld-kvx/pcrel-reloc.d create mode 100644 ld/testsuite/ld-kvx/pcrel-reloc.s diff --git a/ld/Makefile.am b/ld/Makefile.am index c3adbb0ccad..8b7d3170a03 100644 --- a/ld/Makefile.am +++ b/ld/Makefile.am @@ -237,6 +237,7 @@ ALL_EMULATION_SOURCES = \ eelf32ip2k.c \ eelf32iq10.c \ eelf32iq2000.c \ + eelf32kvx.c \ eelf32lm32.c \ eelf32lm32fd.c \ eelf32lppc.c \ @@ -448,6 +449,8 @@ ALL_64_EMULATION_SOURCES = \ eelf64lriscv_lp64f.c \ eelf64ltsmip.c \ eelf64ltsmip_fbsd.c \ + eelf64kvx.c \ + eelf64kvx_linux.c \ eelf64mmix.c \ eelf64ppc.c \ eelf64ppc_fbsd.c \ @@ -735,6 +738,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ip2k.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq10.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq2000.Pc@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32kvx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32fd.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppc.Pc@am__quote@ @@ -937,6 +941,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Pc@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx_linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@ diff --git a/ld/Makefile.in b/ld/Makefile.in index d1a56026437..4d16e6b08d7 100644 --- a/ld/Makefile.in +++ b/ld/Makefile.in @@ -738,6 +738,7 @@ ALL_EMULATION_SOURCES = \ eelf32ip2k.c \ eelf32iq10.c \ eelf32iq2000.c \ + eelf32kvx.c \ eelf32lm32.c \ eelf32lm32fd.c \ eelf32lppc.c \ @@ -948,6 +949,8 @@ ALL_64_EMULATION_SOURCES = \ eelf64lriscv_lp64f.c \ eelf64ltsmip.c \ eelf64ltsmip_fbsd.c \ + eelf64kvx.c \ + eelf64kvx_linux.c \ eelf64mmix.c \ eelf64ppc.c \ eelf64ppc_fbsd.c \ @@ -1373,6 +1376,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ip2k.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq10.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32iq2000.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32kvx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32l4300.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lm32fd.Po@am__quote@ @@ -1443,6 +1447,8 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx_linux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Po@am__quote@ @@ -2619,6 +2625,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32ebmipvxworks.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmip.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32elmipvxworks.Pc@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32kvx.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32l4300.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32loongarch.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lmip.Pc@am__quote@ @@ -2652,6 +2659,8 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS) @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Pc@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx_linux.Pc@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64kvx.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc_fbsd.Pc@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64loongarch.Pc@am__quote@ diff --git a/ld/configure b/ld/configure index cab1c04d264..5de334b2004 100755 --- a/ld/configure +++ b/ld/configure @@ -11625,7 +11625,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11628 "configure" +#line 11633 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11731,7 +11731,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11734 "configure" +#line 11739 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/ld/configure.tgt b/ld/configure.tgt index 4a71f679e29..6030b3f9878 100644 --- a/ld/configure.tgt +++ b/ld/configure.tgt @@ -473,6 +473,11 @@ lm32-*-*linux*) targ_emul=elf32lm32fd lm32-*-*) targ_emul=elf32lm32 targ_extra_emuls="elf32lm32fd" ;; +kvx-*-linux*) targ_emul=elf64kvx_linux + targ_extra_emuls="elf64kvx" + ;; +kvx-*-*) targ_emul=elf64kvx; targ_extra_emuls="elf64kvx_linux elf32kvx" + ;; m32c-*-elf) targ_emul=elf32m32c ;; diff --git a/ld/emulparams/elf32kvx.sh b/ld/emulparams/elf32kvx.sh new file mode 100755 index 00000000000..b589c911614 --- /dev/null +++ b/ld/emulparams/elf32kvx.sh @@ -0,0 +1,32 @@ +# Copyright (C) 2009-2023 Free Software Foundation, Inc. +# Contributed by Kalray SA. + +# This program 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 of the License, or +# (at your option) any later version. + +# This program 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; see the file COPYING3. If not, +# see . */ + +ARCH=kvx +MACHINE= +SCRIPT_NAME=elf + +# bundle with 1 nop insn +NOP=0x00f0037f + +TEMPLATE_NAME=elf +EXTRA_EM_FILE=kvxelf + +OUTPUT_FORMAT="elf32-kvx" +TEXT_START_ADDR=0x0 +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" +WRITABLE_RODATA= +GENERATE_SHLIB_SCRIPT=yes diff --git a/ld/emulparams/elf64kvx.sh b/ld/emulparams/elf64kvx.sh new file mode 100644 index 00000000000..ad8ba0748bd --- /dev/null +++ b/ld/emulparams/elf64kvx.sh @@ -0,0 +1,39 @@ +# Copyright (C) 2009-2023 Free Software Foundation, Inc. +# Contributed by Kalray SA. + +# This program 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 of the License, or +# (at your option) any later version. + +# This program 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; see the file COPYING3. If not, +# see . */ + +ARCH=kvx +MACHINE= + +# bundle with 1 nop insn +NOP=0x00f0037f + +SCRIPT_NAME=elf +ELFSIZE=64 +OUTPUT_FORMAT="elf64-kvx" +NO_REL_RELOCS=yes + +TEMPLATE_NAME=elf +EXTRA_EM_FILE=kvxelf +EMBEDDED=yes +TEXT_START_ADDR=0x0 + +# No support for .s* sections. +NO_SMALL_DATA=yes + +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" + +GENERATE_SHLIB_SCRIPT=yes diff --git a/ld/emulparams/elf64kvx_linux.sh b/ld/emulparams/elf64kvx_linux.sh new file mode 100644 index 00000000000..0bab70ab7e8 --- /dev/null +++ b/ld/emulparams/elf64kvx_linux.sh @@ -0,0 +1,41 @@ +# Copyright (C) 2009-2023 Free Software Foundation, Inc. +# Contributed by Kalray SA. + +# This program 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 of the License, or +# (at your option) any later version. + +# This program 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; see the file COPYING3. If not, +# see . */ + +ARCH=kvx +MACHINE= + +# bundle with 1 nop insn +NOP=0x00f0037f + +SCRIPT_NAME=elf +ELFSIZE=64 +OUTPUT_FORMAT="elf64-kvx" +NO_REL_RELOCS=yes + +TEMPLATE_NAME=elf + +# first user page at 64K. +TEXT_START_ADDR=0x10000 + +# No support for .s* sections. +NO_SMALL_DATA=yes + +MAXPAGESIZE="CONSTANT (MAXPAGESIZE)" + +GENERATE_SHLIB_SCRIPT=yes +GENERATE_PIE_SCRIPT=yes + diff --git a/ld/emultempl/kvxelf.em b/ld/emultempl/kvxelf.em new file mode 100644 index 00000000000..0b909eba999 --- /dev/null +++ b/ld/emultempl/kvxelf.em @@ -0,0 +1,310 @@ +# This shell script emits a C file. -*- C -*- +# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# Contributed by Kalray SA. +# +# This file is part of the GNU Binutils. +# +# This program 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 of the license, or +# (at your option) any later version. +# +# This program 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; see the file COPYING3. If not, +# see . +# + +# This file is sourced from elf32.em, and defines extra kvx-elf +# specific routines. +# +fragment <header.next) + { + switch (l->header.type) + { + case lang_constructors_statement_enum: + ret = hook_in_stub (info, &constructor_list.head); + if (ret) + return ret; + break; + + case lang_output_section_statement_enum: + ret = hook_in_stub (info, + &l->output_section_statement.children.head); + + if (ret) + return ret; + break; + + case lang_wild_statement_enum: + ret = hook_in_stub (info, &l->wild_statement.children.head); + if (ret) + return ret; + break; + + case lang_group_statement_enum: + ret = hook_in_stub (info, &l->group_statement.children.head); + if (ret) + return ret; + break; + + case lang_input_section_enum: + if (l->input_section.section == info->input_section) + { + /* We've found our section. Insert the stub immediately + after its associated input section. */ + *(info->add.tail) = l->header.next; + l->header.next = info->add.head; + return true; + } + + break; + + case lang_data_statement_enum: + case lang_reloc_statement_enum: + case lang_object_symbols_statement_enum: + case lang_output_statement_enum: + case lang_target_statement_enum: + case lang_input_statement_enum: + case lang_assignment_statement_enum: + case lang_padding_statement_enum: + case lang_address_statement_enum: + case lang_fill_statement_enum: + break; + + default: + FAIL (); + break; + } + } + return false; +} + + +/* Call-back for elf${ELFSIZE}_kvx_size_stubs. */ + +/* Create a new stub section, and arrange for it to be linked + immediately after INPUT_SECTION. */ + +static asection * +elf${ELFSIZE}_kvx_add_stub_section (const char *stub_sec_name, + asection *input_section) +{ + asection *stub_sec; + flagword flags; + asection *output_section; + lang_output_section_statement_type *os; + struct hook_stub_info info; + + flags = (SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE + | SEC_HAS_CONTENTS | SEC_RELOC | SEC_IN_MEMORY | SEC_KEEP); + stub_sec = bfd_make_section_anyway_with_flags (stub_file->the_bfd, + stub_sec_name, flags); + if (stub_sec == NULL) + goto err_ret; + + bfd_set_section_alignment (stub_sec, 2); + + output_section = input_section->output_section; + os = lang_output_section_get (output_section); + + info.input_section = input_section; + lang_list_init (&info.add); + lang_add_section (&info.add, stub_sec, NULL, NULL, os); + + if (info.add.head == NULL) + goto err_ret; + + if (hook_in_stub (&info, &os->children.head)) + return stub_sec; + + err_ret: + einfo ("%X%P: can not make stub section: %E\n"); + return NULL; +} + +/* Another call-back for elf${ELFSIZE}_kvx_size_stubs. */ + +static void +gldkvx_layout_sections_again (void) +{ + /* If we have changed sizes of the stub sections, then we need + to recalculate all the section offsets. This may mean we need to + add even more stubs. */ + ldelf_map_segments (true); + need_laying_out = -1; +} + +static void +build_section_lists (lang_statement_union_type *statement) +{ + if (statement->header.type == lang_input_section_enum) + { + asection *i = statement->input_section.section; + + if (!((lang_input_statement_type *) i->owner->usrdata)->flags.just_syms + && (i->flags & SEC_EXCLUDE) == 0 + && i->output_section != NULL + && i->output_section->owner == link_info.output_bfd) + elf${ELFSIZE}_kvx_next_input_section (& link_info, i); + } +} + +static void +gld${EMULATION_NAME}_after_allocation (void) +{ + int ret; + + /* bfd_elf32_discard_info just plays with debugging sections, + ie. doesn't affect any code, so we can delay resizing the + sections. It's likely we'll resize everything in the process of + adding stubs. */ + ret = bfd_elf_discard_info (link_info.output_bfd, & link_info); + if (ret < 0) + { + einfo ("%X%P: .eh_frame/.stab edit: %E\n"); + return; + } + else if (ret > 0) + need_laying_out = 1; + + /* If generating a relocatable output file, then we don't + have to examine the relocs. */ + if (stub_file != NULL && !bfd_link_relocatable (&link_info)) + { + ret = elf${ELFSIZE}_kvx_setup_section_lists (link_info.output_bfd, + &link_info); + if (ret != 0) + { + if (ret < 0) + { + einfo ("%X%P: could not compute sections lists for stub generation: %E\n"); + return; + } + + lang_for_each_statement (build_section_lists); + + /* Call into the BFD backend to do the real work. */ + if (! elf${ELFSIZE}_kvx_size_stubs (link_info.output_bfd, + stub_file->the_bfd, + & link_info, + group_size, + & elf${ELFSIZE}_kvx_add_stub_section, + & gldkvx_layout_sections_again)) + { + einfo ("%X%P: cannot size stub section: %E\n"); + return; + } + } + } + + if (need_laying_out != -1) + ldelf_map_segments (need_laying_out); +} + +static void +gld${EMULATION_NAME}_finish (void) +{ + if (!bfd_link_relocatable (&link_info)) + { + /* Now build the linker stubs. */ + if (stub_file != NULL + && stub_file->the_bfd->sections != NULL) + { + if (! elf${ELFSIZE}_kvx_build_stubs (& link_info)) + einfo ("%X%P: can not build stubs: %E\n"); + } + } + + finish_default (); +} + +/* This is a convenient point to tell BFD about target specific flags. + After the output has been created, but before inputs are read. */ +static void +kvx_elf_create_output_section_statements (void) +{ + if (!(bfd_get_flavour (link_info.output_bfd) == bfd_target_elf_flavour + && elf_object_id (link_info.output_bfd) == KVX_ELF_DATA)) + return; + + stub_file = lang_add_input_file ("linker stubs", + lang_input_file_is_fake_enum, + NULL); + stub_file->the_bfd = bfd_create ("linker stubs", link_info.output_bfd); + if (stub_file->the_bfd == NULL + || ! bfd_set_arch_mach (stub_file->the_bfd, + bfd_get_arch (link_info.output_bfd), + bfd_get_mach (link_info.output_bfd))) + { + einfo ("%X%P: can not create BFD %E\n"); + return; + } + + stub_file->the_bfd->flags |= BFD_LINKER_CREATED; + ldlang_add_file (stub_file); + + if (!kvx_elf${ELFSIZE}_init_stub_bfd (&link_info, stub_file->the_bfd)) + einfo ("%F%P: can not init BFD: %E\n"); +} + + +#define lang_for_each_input_file kvx_lang_for_each_input_file + +EOF + +LDEMUL_BEFORE_ALLOCATION=elf${ELFSIZE}_kvx_before_allocation +LDEMUL_AFTER_ALLOCATION=gld${EMULATION_NAME}_after_allocation +LDEMUL_CREATE_OUTPUT_SECTION_STATEMENTS=kvx_elf_create_output_section_statements + +# Call the extra arm-elf function +LDEMUL_FINISH=gld${EMULATION_NAME}_finish diff --git a/ld/po/BLD-POTFILES.in b/ld/po/BLD-POTFILES.in index 1fb352a1dfa..54de42b6511 100644 --- a/ld/po/BLD-POTFILES.in +++ b/ld/po/BLD-POTFILES.in @@ -115,6 +115,7 @@ eelf32ft32.c eelf32ip2k.c eelf32iq10.c eelf32iq2000.c +eelf32kvx.c eelf32l4300.c eelf32lm32.c eelf32lm32fd.c @@ -185,6 +186,8 @@ eelf64briscv_lp64f.c eelf64btsmip.c eelf64btsmip_fbsd.c eelf64hppa.c +eelf64kvx.c +eelf64kvx_linux.c eelf64loongarch.c eelf64lppc.c eelf64lppc_fbsd.c diff --git a/ld/testsuite/ld-elf/shared.exp b/ld/testsuite/ld-elf/shared.exp index cf010e5b0e5..bcb69ebfc49 100644 --- a/ld/testsuite/ld-elf/shared.exp +++ b/ld/testsuite/ld-elf/shared.exp @@ -515,6 +515,7 @@ run_ld_link_tests { } if { [istarget *-*-linux*] + || [istarget kvx-*-*] || [istarget *-*-nacl*] || [istarget *-*-gnu*] } { run_ld_link_tests { diff --git a/ld/testsuite/ld-kvx/farcall-back.d b/ld/testsuite/ld-kvx/farcall-back.d new file mode 100644 index 00000000000..c17dda71834 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-back.d @@ -0,0 +1,79 @@ +#name: kvx-farcall-back +#source: farcall-back.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x80001000 +#objdump: -dr + +#... + +Disassembly of section .text: + +.* <_start>: + .*: .. .. .. .. call .* <__bar1_veneer>;; + + .*: .. .. .. .. goto .* <__bar1_veneer>;; + + .*: .. .. .. .. call .* <__bar2_veneer>;; + + .*: .. .. .. .. goto .* <__bar2_veneer>;; + + .*: .. .. .. .. call .* <__bar3_veneer>;; + + .*: .. .. .. .. goto .* <__bar3_veneer>;; + + .*: 00 00 d0 0f ret;; + + ... + +.* <_back>: + .*: 00 00 d0 0f ret;; + +.* <__bar3_veneer>: + .*: 00 .. 40 e0 0c 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + +.* <__bar2_veneer>: + .*: 00 .. 40 e0 08 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + +.* <__bar1_veneer>: + .*: 00 .. 40 e0 04 00 20 00 make \$r16 = .* \(0x.*\);; + + .*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___start_veneer>;; + + ... + +.* : +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___start_veneer>;; + + ... + +.* : +.*: 00 00 d0 0f ret;; + +.*: .. .. .. .. goto .* <___back_veneer>;; + + +.* <___start_veneer>: +.*: 00 .. 40 e0 04 00 00 00 make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___back_veneer>: +.*: 00 .. 40 e0 08 00 00 00 make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + diff --git a/ld/testsuite/ld-kvx/farcall-back.s b/ld/testsuite/ld-kvx/farcall-back.s new file mode 100644 index 00000000000..582d39d3d82 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-back.s @@ -0,0 +1,54 @@ + .global _start + .global _back + .global bar1 + .global bar2 + .global bar3 + +# We will place the section .text at 0x1000. + + .text + + .type _start, @function +_start: + call bar1 + ;; + goto bar1 + ;; + call bar2 + ;; + goto bar2 + ;; + call bar3 + ;; + goto bar3 + ;; + ret + ;; + .space 0x1000 + .type _back, @function +_back: ret + ;; + +# We will place the section .foo at 0x80001000. + + .section .foo, "xa" + .type bar1, @function +bar1: + ret + ;; + goto _start + ;; + .space 0x1000 + .type bar2, @function +bar2: + ret + ;; + goto _start + ;; + .space 0x1000 + .type bar3, @function +bar3: + ret + ;; + goto _back + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-defsym.d b/ld/testsuite/ld-kvx/farcall-call-defsym.d new file mode 100644 index 00000000000..71dcebcc555 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-defsym.d @@ -0,0 +1,14 @@ +#name: kvx-farcall-call-defsym +#source: farcall-call-defsym.s +#as: +#ld: -Ttext 0x1000 --defsym=bar=0x8001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 1000: 00 00 00 1a call 8001000 ;; + + 1004: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-defsym.s b/ld/testsuite/ld-kvx/farcall-call-defsym.s new file mode 100644 index 00000000000..2072b53960a --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-defsym.s @@ -0,0 +1,12 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-none-function.d b/ld/testsuite/ld-kvx/farcall-call-none-function.d new file mode 100644 index 00000000000..3ef4131e327 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-none-function.d @@ -0,0 +1,24 @@ +#name: kvx-farcall-call-none-function +#source: farcall-call-none-function.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. call .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-none-function.s b/ld/testsuite/ld-kvx/farcall-call-none-function.s new file mode 100644 index 00000000000..85eeca5616f --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-none-function.s @@ -0,0 +1,19 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x10001000. + + .section .foo, "xa" +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d b/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d new file mode 100644 index 00000000000..a097e28ccfc --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt-32bits.d @@ -0,0 +1,31 @@ + +tmpdir/dump: file format elf32-kvx + + +Disassembly of section .plt: + +.* : + ... + +.* : + .*: 10 00 c4 0f get \$r16 = \$pc;; + + .*: .. .. 40 b0 .. .. .. 18 lwz \$r16 = [0-9]* \(0x[0-9a-f]*\)\[\$r16\];; + + .*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. 00 18 call .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = .* \(0x[0-9a-f]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-plt.d b/ld/testsuite/ld-kvx/farcall-call-plt.d new file mode 100644 index 00000000000..ab431b0e3c4 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-call-plt +#source: farcall-call-plt.s +#as: +#ld: -shared +#objdump: -dr +#... + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* : +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. 18 l[wzd]* \$r16 = [0-9]* \(0x[0-9a-f]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. 00 18 call .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = .* \(0x[0-9a-f]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-plt.s b/ld/testsuite/ld-kvx/farcall-call-plt.s new file mode 100644 index 00000000000..e1b1bbc6bea --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-plt.s @@ -0,0 +1,14 @@ + .global _start + .global foo + .type foo, @function + .text + +_start: + # ((1 << 26) - 1) << 2 + # PCREL27 relocation out of range to plt stub, + # we need long branch veneer. + .skip 268435452, 0 + call foo + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call-section.d b/ld/testsuite/ld-kvx/farcall-call-section.d new file mode 100644 index 00000000000..86f3f035caf --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-section.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-call-section +#source: farcall-call-section.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. call .* <___veneer>;; + +.*: .. .. .. .. call .* <___veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <___veneer>: +.*: .. 00 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___veneer>: +.*: .. 01 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call-section.s b/ld/testsuite/ld-kvx/farcall-call-section.s new file mode 100644 index 00000000000..3b22fc66a8a --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call-section.s @@ -0,0 +1,25 @@ + .global _start + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + call bar2 + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; + .type bar2, @function +bar2: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-call.d b/ld/testsuite/ld-kvx/farcall-call.d new file mode 100644 index 00000000000..6db1f168f74 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call.d @@ -0,0 +1,25 @@ +#name: kvx-farcall-call +#source: farcall-call.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + + +.* <_start>: +.*: .. .. .. 18 call .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-call.s b/ld/testsuite/ld-kvx/farcall-call.s new file mode 100644 index 00000000000..7319ae40f94 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-call.s @@ -0,0 +1,20 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-defsym.d b/ld/testsuite/ld-kvx/farcall-goto-defsym.d new file mode 100644 index 00000000000..27ba7be1eaf --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-defsym.d @@ -0,0 +1,14 @@ +#name: kvx-farcall-goto-defsym +#source: farcall-goto-defsym.s +#as: +#ld: -Ttext 0x1000 --defsym=bar=0x8001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 1000: 00 00 00 12 goto 8001000 ;; + + 1004: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-defsym.s b/ld/testsuite/ld-kvx/farcall-goto-defsym.s new file mode 100644 index 00000000000..f2e1da61d48 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-defsym.s @@ -0,0 +1,12 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-gsym.d b/ld/testsuite/ld-kvx/farcall-goto-gsym.d new file mode 100644 index 00000000000..9874d415daa --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-gsym.d @@ -0,0 +1,5 @@ +#name: kvx-farcall-goto-gsym +#source: farcall-goto-gsym.s +#as: +#ld: -Ttext 0x1000 +#error: .*\(.text\+0x0\): relocation truncated to fit: R_KVX_PCREL27 against symbol `bar_gsym'.* diff --git a/ld/testsuite/ld-kvx/farcall-goto-gsym.s b/ld/testsuite/ld-kvx/farcall-goto-gsym.s new file mode 100644 index 00000000000..2cb7b19b6f0 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-gsym.s @@ -0,0 +1,20 @@ + .global _start + .global bar_gsym + +# We will place the section .text at 0x1000. + + .text + +_start: +# for long jump (goto) to global symbol, we shouldn't insert veneer +# as the veneer will clobber r16/r17 which is caller saved, gcc only +# reserve them for function call relocation (call). + goto bar_gsym + ;; + # ((1 << 26) - 1) << 2 + .skip 268435452, 0 +bar_gsym: + nop + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-none-function.d b/ld/testsuite/ld-kvx/farcall-goto-none-function.d new file mode 100644 index 00000000000..88b7a277d41 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-none-function.d @@ -0,0 +1,26 @@ +#name: kvx-farcall-goto-none-function +#source: farcall-goto-none-function.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + + +.* <_start>: +.*: .. .. .. .. goto .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-none-function.s b/ld/testsuite/ld-kvx/farcall-goto-none-function.s new file mode 100644 index 00000000000..1223bc315b1 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-none-function.s @@ -0,0 +1,19 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d b/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d new file mode 100644 index 00000000000..04b43802fdd --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt-32bits.d @@ -0,0 +1,31 @@ + +tmpdir/dump: file format elf32-kvx + + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* : +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. .. l[wzd]* \$r16 = [0-9]* \(0x[0-9a-b]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. .. 10 goto .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = [0-9]* \(0x[0-9a-b]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt.d b/ld/testsuite/ld-kvx/farcall-goto-plt.d new file mode 100644 index 00000000000..e1e20e6ab06 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt.d @@ -0,0 +1,34 @@ +#name: kvx-farcall-goto-plt +#source: farcall-goto-plt.s +#as: +#ld: -shared +#objdump: -dr +#... + +Disassembly of section .plt: + +.* <.plt>: + ... + +.* : +.*: 10 00 c4 0f get \$r16 = \$pc;; + +.*: .. .. 40 .. .. .. .. .. l[wzd]* \$r16 = [0-9]* \(0x[0-9a-b]*\)\[\$r16\];; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .text: + +.* <_start>: + ... +.*: .. .. .. 10 goto .* <__foo_veneer>;; + +.*: 00 00 d0 0f ret;; + + +.* <__foo_veneer>: +.*: .. .. 40 e0 00 00 00 00 make \$r16 = [0-9]* \(0x[0-9a-b]*\);; + +.*: 10 00 d8 0f igoto \$r16;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-plt.s b/ld/testsuite/ld-kvx/farcall-goto-plt.s new file mode 100644 index 00000000000..f912d9f2cdd --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-plt.s @@ -0,0 +1,13 @@ + .global _start + .global foo + .type foo, @function + .text +_start: + # ((1 << 26) - 1) << 2 + # PCREL27 relocation out of range to plt stub, + # we need long branch veneer. + .skip 268435452, 0 + goto foo + ;; + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto-section.d b/ld/testsuite/ld-kvx/farcall-goto-section.d new file mode 100644 index 00000000000..059979586b0 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-section.d @@ -0,0 +1,36 @@ +#name: kvx-farcall-goto-section +#source: farcall-goto-section.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. goto .* <___veneer>;; + +.*: .. .. .. .. goto .* <___veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <___veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + +.* <___veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto-section.s b/ld/testsuite/ld-kvx/farcall-goto-section.s new file mode 100644 index 00000000000..d6287d1d57e --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto-section.s @@ -0,0 +1,25 @@ +.global _start + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + goto bar2 + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; + .type bar2, @function +bar2: + ret + ;; diff --git a/ld/testsuite/ld-kvx/farcall-goto.d b/ld/testsuite/ld-kvx/farcall-goto.d new file mode 100644 index 00000000000..7e34eeb5cb8 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto.d @@ -0,0 +1,25 @@ +#name: kvx-farcall-goto +#source: farcall-goto.s +#as: +#ld: -Ttext 0x1000 --section-start .foo=0x20001000 +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: +.*: .. .. .. .. goto .* <__bar_veneer>;; + +.*: 00 00 d0 0f ret;; + +.* <__bar_veneer>: +.*: .. .. 40 e0 .. .. .. .. make \$r16 = .* \(0x.*\);; + +.*: 10 00 d8 0f igoto \$r16;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/farcall-goto.s b/ld/testsuite/ld-kvx/farcall-goto.s new file mode 100644 index 00000000000..114bc56bc45 --- /dev/null +++ b/ld/testsuite/ld-kvx/farcall-goto.s @@ -0,0 +1,20 @@ + .global _start + .global bar + +# We will place the section .text at 0x1000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x20001000. + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/kvx-elf.exp b/ld/testsuite/ld-kvx/kvx-elf.exp new file mode 100644 index 00000000000..b5a0833078a --- /dev/null +++ b/ld/testsuite/ld-kvx/kvx-elf.exp @@ -0,0 +1,70 @@ +# Expect script for various KVX ELF tests. +# Copyright (C) 2009-2016 Free Software Foundation, Inc. +# +# Copyright (C) 2019 Kalray +# +# This file is part of the GNU Binutils. +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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. + +# Exclude non-kvx-ELF targets. +if { ![istarget "kvx-*-*"] } { + return +} + +# List contains test-items with 3 items followed by 2 lists: +# 0:name 1:ld early options 2:ld late options 3:assembler options +# 4:filenames of assembler files 5: action and options. 6: name of output file + +# Actions: +# objdump: Apply objdump options on result. Compare with regex (last arg). +# nm: Apply nm options on result. Compare with regex (last arg). +# readelf: Apply readelf options on result. Compare with regex (last arg). + +# 64bits tests +run_dump_test "limit-call" +run_dump_test "limit-goto" +run_dump_test "farcall-back" +run_dump_test "farcall-goto-defsym" +run_dump_test "farcall-call-defsym" +run_dump_test "farcall-goto-gsym" +run_dump_test "farcall-goto-plt" +run_dump_test "farcall-call-plt" +run_dump_test "farcall-call" +run_dump_test "farcall-goto" +run_dump_test "farcall-goto-none-function" +run_dump_test "farcall-call-none-function" +run_dump_test "farcall-goto-section" +run_dump_test "farcall-call-section" +run_dump_test "pcrel-reloc" + +## 32bits tests +set extra_32bits [list [list as -m32] [list ld -melf32kvx]] +run_dump_test "limit-call" $extra_32bits +run_dump_test "limit-goto" $extra_32bits +run_dump_test "farcall-back" $extra_32bits +run_dump_test "farcall-goto-defsym" $extra_32bits +run_dump_test "farcall-call-defsym" $extra_32bits +run_dump_test "farcall-goto-gsym" $extra_32bits +run_dump_test "farcall-goto-plt" $extra_32bits +run_dump_test "farcall-call-plt" $extra_32bits +run_dump_test "farcall-call" $extra_32bits +run_dump_test "farcall-goto" $extra_32bits +run_dump_test "farcall-goto-none-function" $extra_32bits +run_dump_test "farcall-call-none-function" $extra_32bits +run_dump_test "farcall-goto-section" $extra_32bits +run_dump_test "farcall-call-section" $extra_32bits +run_dump_test "pcrel-reloc" [list [list as -m32] [list ld -melf32kvx] [list dump pcrel-reloc-32bits.d]] diff --git a/ld/testsuite/ld-kvx/kvx.ld b/ld/testsuite/ld-kvx/kvx.ld new file mode 100644 index 00000000000..b1f3c050455 --- /dev/null +++ b/ld/testsuite/ld-kvx/kvx.ld @@ -0,0 +1,18 @@ +/* Script for ld testsuite */ +OUTPUT_ARCH(kv3-1:64) +ENTRY(_start) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + PROVIDE (__executable_start = 0x8000); . = 0x8000; + .text : + { + *(.before) + *(.text) + *(.after) + } =0 + . = 0x9000; + .got : { *(.got) *(.got.plt)} + . = 0x12340000; + .far : { *(.far) } +} diff --git a/ld/testsuite/ld-kvx/limit-call.d b/ld/testsuite/ld-kvx/limit-call.d new file mode 100644 index 00000000000..a9b6c728a34 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-call.d @@ -0,0 +1,20 @@ +#name: kvx-limit-call +#source: limit-call.s +#as: +#ld: -Ttext 0x0000 --section-start .foo=0x0FFFFFFC +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 0: ff ff ff 1b call ffffffc ;; + + 4: 00 00 d0 0f ret;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/limit-call.s b/ld/testsuite/ld-kvx/limit-call.s new file mode 100644 index 00000000000..e5cff120a38 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-call.s @@ -0,0 +1,22 @@ +# Test maximum encoding range of call + + .global _start + .global bar + +# We will place the section .text at 0x0000. + + .text + +_start: + call bar + ;; + ret + ;; + +# We will place the section .foo at 0x10000000 + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/limit-goto.d b/ld/testsuite/ld-kvx/limit-goto.d new file mode 100644 index 00000000000..36c4386ed62 --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-goto.d @@ -0,0 +1,20 @@ +#name: kvx-limit-goto +#source: limit-goto.s +#as: +#ld: -Ttext 0x0 --section-start .foo=0x0FFFFFFC +#objdump: -dr +#... + +Disassembly of section .text: + +.* <_start>: + 0: ff ff ff 13 goto ffffffc ;; + + 4: 00 00 d0 0f ret;; + + +Disassembly of section .foo: + +.* : +.*: 00 00 d0 0f ret;; + diff --git a/ld/testsuite/ld-kvx/limit-goto.s b/ld/testsuite/ld-kvx/limit-goto.s new file mode 100644 index 00000000000..f90211444ad --- /dev/null +++ b/ld/testsuite/ld-kvx/limit-goto.s @@ -0,0 +1,22 @@ +# Test maximum encoding range of call + + .global _start + .global bar + +# We will place the section .text at 0x0000. + + .text + +_start: + goto bar + ;; + ret + ;; + +# We will place the section .foo at 0x10000000 + + .section .foo, "xa" + .type bar, @function +bar: + ret + ;; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d b/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d new file mode 100644 index 00000000000..3ca9eb958f5 --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc-32bits.d @@ -0,0 +1,8 @@ +.*: file format elf32-kvx + + +Disassembly of section .text: + +.* <_start>: +.*: 00 00 d0 8f ret +.*: c0 cd 04 f0 04 00 00 00 pcrel \$r1 = 4919 \(0x1337\);; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc.d b/ld/testsuite/ld-kvx/pcrel-reloc.d new file mode 100644 index 00000000000..1931d9ef666 --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc.d @@ -0,0 +1,14 @@ +#name: pcrel-reloc +#source: pcrel-reloc.s +#as: +#ld: -Ttext 0x0 --defsym foo=0x1337 +#objdump: -dr + +.*: file format elf64-kvx + + +Disassembly of section .text: + +0000000000000000 <_start>: + 0: 00 00 d0 8f ret + 4: c0 cd 04 f0 04 00 00 80 00 00 00 00 pcrel \$r1 = 4919 \(0x1337\);; diff --git a/ld/testsuite/ld-kvx/pcrel-reloc.s b/ld/testsuite/ld-kvx/pcrel-reloc.s new file mode 100644 index 00000000000..825a38189a4 --- /dev/null +++ b/ld/testsuite/ld-kvx/pcrel-reloc.s @@ -0,0 +1,10 @@ +.text +.global _start +.weak foo +.hidden foo + +.type _start, @function +_start: + pcrel $r1 = @pcrel(foo) + ret + ;; From patchwork Fri Jul 21 07:49:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Iannetta X-Patchwork-Id: 123635 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp38640vqg; Fri, 21 Jul 2023 00:54:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlHEW6mrSR3pur9UGr7IRgiMqhMXj2spvxCeCrnorCD4ZiVVcwMJ3fhsHEo8fm4nepWeBYhm X-Received: by 2002:a17:907:7717:b0:994:5503:69c1 with SMTP id kw23-20020a170907771700b00994550369c1mr1112535ejc.18.1689926056855; Fri, 21 Jul 2023 00:54:16 -0700 (PDT) Received: from server2.sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id ot1-20020a170906ccc100b0098e1c7a62bbsi1838047ejb.96.2023.07.21.00.54.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 00:54:16 -0700 (PDT) Received-SPF: pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=FeBrtHkl; arc=fail (signature failed); spf=pass (google.com: domain of binutils-bounces+ouuuleilei=gmail.com@sourceware.org designates 8.43.85.97 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 B3D413853D33 for ; Fri, 21 Jul 2023 07:52:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B3D413853D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689925967; bh=oZZcrKok5NRSRg+u4qfN/eXT98EqVOA8XP+F5sdmXFw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=FeBrtHklHEhmjJ6WK/uVmwruZgJEbdc2BSB3Rk9q4bmuUlt5xRa2vuEXw+Vxx4cYq 6PPbCbHqHIQ9qI6lP+Hw4oh2diNDu0t8WVW+u7g8m2dgtnumtIXqKOvu2r2iE7p0s8 a9v5MzJmjg1x3y0sXrtBpRb4donRVc/e53wAQ/nE= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id CC93B385DC33 for ; Fri, 21 Jul 2023 07:50:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CC93B385DC33 Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 91CAD34961C for ; Fri, 21 Jul 2023 09:50:19 +0200 (CEST) Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 7AE023495DE for ; Fri, 21 Jul 2023 09:50:18 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01lp0108.outbound.protection.outlook.com [104.47.25.108]) by fx409.security-mail.net (Postfix) with ESMTPS id 061BF34970B for ; Fri, 21 Jul 2023 09:50:16 +0200 (CEST) Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) by MR1P264MB1731.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 07:50:13 +0000 Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d]) by MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d%7]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 07:50:13 +0000 X-Virus-Scanned: E-securemail Secumail-id: <12564.64ba38b8.5644.3> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CaY0rmn9UzND27lfULQysny2lBM9GV47SGN05p7DdDOXlu2FxGtYGOontIa4jCdSNV/Ew+kpZKfq6yyOLBmU7+LBDcJPjHMmOm+Ox/mLrqSYqugSKhMYYFDlAjUGmybY+XHz1Vmw5ZzTf4hHSZkLTMEdCSssA+pUPU7aSk3xaPmRb1HItMk/YW872mOqwHC0tYIQSxEvnlePGabRfKVM3ZCmUz/zdiHbsI8fNN5mJUF20bwzt3+LRqNfrLLqprMqaGW126JF1nYLuPdUFprwldDgqNGbnbtVXSUjCr8zHM9THyjJkU4ub3dWeswve3/FvWq/KlEMum18Sk2wfPyGJQ== 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=oZZcrKok5NRSRg+u4qfN/eXT98EqVOA8XP+F5sdmXFw=; b=oeeQEJG4C63mJqaG1U0AB+gvoQ6dJe2/IQilhK3VIhU3JyGuq93dDh8rwtwdE74/0uzfA2FJDFHoNulsKdIBnCcIhzj0a90FYnYK1DkQT+cuWIn/IgBNre6Mt3X+i6pY5RoaqSf+ttrFplYSoBwvOYplcjGmeB664hBwF4tKlOpnDLSacXhW/j1LadWHvK/01LLBiLQuMiFB9AFqVDEtHKLCtPGN+K1WMGFznJ+NXFkoNQ9CmftbYlpu9xho4yx/ccjC3Za9waoJsLpH8BzWorhg4GaiF2Hh32XGrFEtsYdIyzghYUzHuFrMTwyKcG08p51dXDVdc+50Tja+Zfxn0A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none To: binutils@sourceware.org Cc: Paul Iannetta Subject: [PATCH 5/7] kvx: Add include files. Date: Fri, 21 Jul 2023 09:49:54 +0200 Message-ID: <20230721074956.7188-6-piannetta@kalrayinc.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230721074956.7188-1-piannetta@kalrayinc.com> References: <20230721074956.7188-1-piannetta@kalrayinc.com> X-ClientProxiedBy: LO4P123CA0011.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:150::16) To MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2482:EE_|MR1P264MB1731:EE_ X-MS-Office365-Filtering-Correlation-Id: 16b441e3-334b-465d-62d4-08db89bf1daa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TUXnwmrR2vqK8Wn2WqO9+snDxP2ywhi6S7MB0fWZpKFdkHF4kfkdrzwauTei6zzFZvk+oKr3laUkSHCrtBZxkIfr1DPwxGq5RdZlzv+7PcjhAeJpVoUFT00jQuabbimz2odCNLtNZ9Xw15TIVaWQn+ekd3uKBxkVSdnVtJiXmJ0vN14b2tgIfl0k2N4PamZHcLKWctXCM9kGrCaXHR2Jf4coIOe31oLPsMLUW4xvjLx81klxBKKRRXMyUwnqtDhQx30uHggkNvO3myvGDMrlNIv8erl4Xnnd4GjJF3DNc0SlOBYtKiwHQmUkkM1n+ODycy6x76zorMids7HIfM8gYgVw5DF18Ee8/rNV0deEzpoktbpHL7Cti2MtJHKK7vxK2ghldRMhdKm6ViT/aDMQnNrwfOStCsTCw6MzKPJbt+c8+aLQxlvXL74CumDALmLLBCHawq1HA0mgKW9vn8776gkTc9tEf6JM+gaRFdcAbEqYgykfSLKCt/Pv3jexztVUQkiEc4UR0O7M1nuH6vw+iSf0JCmdpwn26begMqRpc30B4BumRA2bGXhsf8j4cKPMto/dWriQcZ9PUqITsM4bymfsJjxzL2tqZiNBpTdgQH4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(39850400004)(346002)(376002)(451199021)(6666004)(6486002)(478600001)(83380400001)(6916009)(26005)(6506007)(1076003)(107886003)(6512007)(4326008)(38100700002)(66556008)(19627235002)(66476007)(66946007)(186003)(2616005)(5660300002)(8676002)(30864003)(8936002)(2906002)(41300700001)(316002)(86362001)(36756003)(2004002)(579004)(559001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VOUYYOR7FCOsxyaDMlXbhAAfXaJ+kmP9UqO/xGDyJzbTsFcXBE7Cp7JvBAQ9jjsdhHLAwsqw2cA3ttqmaZ1fmGEqCKeYw0Snn2tcYpHcFTzkSxER8SfJ9ieOGdYvCXIk0DSSwVcKL/HUerEawfJsXnxokq5skXIpBQ/utdI2NGFQb+++Qjm3Pi4LQnmsHtnN/bFCFWw0e8+J5qqOxA1dNt1wjYYpl1gjQ0QXYIi0VXaxGeMFJnWvlR/ay4O1xFerVHPSUuRAj04nPar57tQCxLWlTniFtKWvXv1QCsGoj29Ft92BXqrcLCha0aia9lHp8t/Mh6i15+bh2MUs/jZMAjWSpjvMwZoKXZlKDuoIORQTGuKLnPt0kJRXBz+curmmiqsa2NQKh1z496ZSNKunI172Y9u3nS77fzqeAIkQ69ImlEl45UyNNH6FOXo6OnKt9Og5iDHamgjV6XTFzyMbQPe2aNRd74PnNqTodPzeetBleEfUAbY90TGTO2k0BAb2co16ByaJo0NrtnlX394ZT+ZmlK4BDprdFtMP/drMJ1yeh6wJYtrq9/V7SHz0ZOMLnqi8zSlk9AULkDe0+B3pJH5vvKPQKT24vHCt0pceksYX17WtqD+AVZU+O3Um5vMI4WnluO2ebbTeFp2lWIsWMqczHLN+zX8ErFyzGUzYnhrClHwuKMEh3YMT/bfaBGPtQRLXOrgmfGSLztc+/iPC0wJej37tuIOcXiXE0J5EvLx51PM1xpKQLazNW+KGKEWJJ+etWPloA06A7rotMuaXMzY7tG7KIdNxZfsthNydJ4avcaCS1ckM50/bwTQ87sfo9M01NpAOrtH8TgzKMrM6B0XfOCGYX4JobMIia2szuQ5s1+pz8+mDrA3J5I4CthwvY4SIT2qJkiotx5Jfb2bFPRkME6UsNAhklJG+vPfVGtp1Es/Ij040GbHrjNxd1RTJ 8YEsNi2AOeSWG3U4eLc5BTr/wqCN11UISPlYTzPJpk2fqHL0KPjXc84uSYDe5Lz+dENsePTxe7vha+IyVhRWhiN42SW3wKX49OgoNzuoDxMOaw3D3zPYm83CREoJ1XT1iCzQkg6NobMsbKwRKJvVPl9k2IsIH3et+TUfWx0eFuSWr3AludllerYdIOaTLoUboSnooElk67V5SLGgoJjPLgTGHIizUgkXEAQ+9p70CmneTBVYqfia2wNczei3JpOOdOIHj5vwDE9kn6LxRJJq7kmTAjuNiOtjBg4AmaKuvO7MO2JL0Hs+/u8j3/qkGwujOvH4a3BUcPtqBJdzaw3A3c7qDzoJFPsdQH03dVi7o/j2DUh4Y27NGtPYXyXIq/ngEI3l2N/wyb5hQqHyKhX8PNyslLUmt8xSjm6AEsJ+JXF1AUUOxMq+R2q8zJgaNtgZCgXRgHUZuPSmLpIpje6MN+8IgwDzX+ligacR1AJy7d+qTXHYtbWbQYWqwUd9Bs/iKPfif4UIUn0c9pJ7A3c1itb08aYQdqaXrBVbfciego4UQmIOzDZiwIxyqV9DdxWy/DVOC2f8DQXDXhn1WS5usjIuDUpjVdhg3hUHopjJa/BbV12Mh9NxJCMHDm1F1StxW1aR5o3sNCVLKXnfKBwoUQ== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16b441e3-334b-465d-62d4-08db89bf1daa X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 07:50:13.4134 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FWsWNphcr7o00O2pOKYo4VmKjPKvFxwHnDmKLMue6gG/kvqk7bturkqnngxQljSk9v4WS5hUcQpo8tFOo21OEQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1731 X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Paul Iannetta via Binutils From: Paul Iannetta Reply-To: Paul Iannetta Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772015904593808890 X-GMAIL-MSGID: 1772015904593808890 include/ChangeLog: 2023-07-20 Paul Iannetta * dis-asm.h (print_kvx_disassembler_options): New function. * elf/kvx.h: New file. * elf/kvx_elfids.h: New file. * opcode/kvx.h: New file. --- include/dis-asm.h | 1 + include/elf/kvx.h | 115 ++ include/elf/kvx_elfids.h | 81 + include/opcode/kvx.h | 3159 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 3356 insertions(+) create mode 100644 include/elf/kvx.h create mode 100644 include/elf/kvx_elfids.h create mode 100644 include/opcode/kvx.h diff --git a/include/dis-asm.h b/include/dis-asm.h index d356429f3c5..52e319d7c29 100644 --- a/include/dis-asm.h +++ b/include/dis-asm.h @@ -385,6 +385,7 @@ extern void print_ppc_disassembler_options (FILE *); extern void print_riscv_disassembler_options (FILE *); extern void print_arm_disassembler_options (FILE *); extern void print_arc_disassembler_options (FILE *); +extern void print_kvx_disassembler_options(FILE *); extern void print_s390_disassembler_options (FILE *); extern void print_wasm32_disassembler_options (FILE *); extern void print_loongarch_disassembler_options (FILE *); diff --git a/include/elf/kvx.h b/include/elf/kvx.h new file mode 100644 index 00000000000..691ce56ac48 --- /dev/null +++ b/include/elf/kvx.h @@ -0,0 +1,115 @@ +/* KVX ELF support for BFD. + + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of GNU Binutils. + + This program 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 of the license, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +#ifndef _ELF_KVX_H +#define _ELF_KVX_H + +#include "elf/reloc-macros.h" + +START_RELOC_NUMBERS (elf_kvx_reloc_type) + RELOC_NUMBER (R_KVX_NONE, 0) + RELOC_NUMBER (R_KVX_16, 1) + RELOC_NUMBER (R_KVX_32, 2) + RELOC_NUMBER (R_KVX_64, 3) + RELOC_NUMBER (R_KVX_S16_PCREL, 4) + RELOC_NUMBER (R_KVX_PCREL17, 5) + RELOC_NUMBER (R_KVX_PCREL27, 6) + RELOC_NUMBER (R_KVX_32_PCREL, 7) + RELOC_NUMBER (R_KVX_S37_PCREL_LO10, 8) + RELOC_NUMBER (R_KVX_S37_PCREL_UP27, 9) + RELOC_NUMBER (R_KVX_S43_PCREL_LO10, 10) + RELOC_NUMBER (R_KVX_S43_PCREL_UP27, 11) + RELOC_NUMBER (R_KVX_S43_PCREL_EX6, 12) + RELOC_NUMBER (R_KVX_S64_PCREL_LO10, 13) + RELOC_NUMBER (R_KVX_S64_PCREL_UP27, 14) + RELOC_NUMBER (R_KVX_S64_PCREL_EX27, 15) + RELOC_NUMBER (R_KVX_64_PCREL, 16) + RELOC_NUMBER (R_KVX_S16, 17) + RELOC_NUMBER (R_KVX_S32_LO5, 18) + RELOC_NUMBER (R_KVX_S32_UP27, 19) + RELOC_NUMBER (R_KVX_S37_LO10, 20) + RELOC_NUMBER (R_KVX_S37_UP27, 21) + RELOC_NUMBER (R_KVX_S37_GOTOFF_LO10, 22) + RELOC_NUMBER (R_KVX_S37_GOTOFF_UP27, 23) + RELOC_NUMBER (R_KVX_S43_GOTOFF_LO10, 24) + RELOC_NUMBER (R_KVX_S43_GOTOFF_UP27, 25) + RELOC_NUMBER (R_KVX_S43_GOTOFF_EX6, 26) + RELOC_NUMBER (R_KVX_32_GOTOFF, 27) + RELOC_NUMBER (R_KVX_64_GOTOFF, 28) + RELOC_NUMBER (R_KVX_32_GOT, 29) + RELOC_NUMBER (R_KVX_S37_GOT_LO10, 30) + RELOC_NUMBER (R_KVX_S37_GOT_UP27, 31) + RELOC_NUMBER (R_KVX_S43_GOT_LO10, 32) + RELOC_NUMBER (R_KVX_S43_GOT_UP27, 33) + RELOC_NUMBER (R_KVX_S43_GOT_EX6, 34) + RELOC_NUMBER (R_KVX_64_GOT, 35) + RELOC_NUMBER (R_KVX_GLOB_DAT, 36) + RELOC_NUMBER (R_KVX_COPY, 37) + RELOC_NUMBER (R_KVX_JMP_SLOT, 38) + RELOC_NUMBER (R_KVX_RELATIVE, 39) + RELOC_NUMBER (R_KVX_S43_LO10, 40) + RELOC_NUMBER (R_KVX_S43_UP27, 41) + RELOC_NUMBER (R_KVX_S43_EX6, 42) + RELOC_NUMBER (R_KVX_S64_LO10, 43) + RELOC_NUMBER (R_KVX_S64_UP27, 44) + RELOC_NUMBER (R_KVX_S64_EX27, 45) + RELOC_NUMBER (R_KVX_S37_GOTADDR_LO10, 46) + RELOC_NUMBER (R_KVX_S37_GOTADDR_UP27, 47) + RELOC_NUMBER (R_KVX_S43_GOTADDR_LO10, 48) + RELOC_NUMBER (R_KVX_S43_GOTADDR_UP27, 49) + RELOC_NUMBER (R_KVX_S43_GOTADDR_EX6, 50) + RELOC_NUMBER (R_KVX_S64_GOTADDR_LO10, 51) + RELOC_NUMBER (R_KVX_S64_GOTADDR_UP27, 52) + RELOC_NUMBER (R_KVX_S64_GOTADDR_EX27, 53) + RELOC_NUMBER (R_KVX_64_DTPMOD, 54) + RELOC_NUMBER (R_KVX_64_DTPOFF, 55) + RELOC_NUMBER (R_KVX_S37_TLS_DTPOFF_LO10, 56) + RELOC_NUMBER (R_KVX_S37_TLS_DTPOFF_UP27, 57) + RELOC_NUMBER (R_KVX_S43_TLS_DTPOFF_LO10, 58) + RELOC_NUMBER (R_KVX_S43_TLS_DTPOFF_UP27, 59) + RELOC_NUMBER (R_KVX_S43_TLS_DTPOFF_EX6, 60) + RELOC_NUMBER (R_KVX_S37_TLS_GD_LO10, 61) + RELOC_NUMBER (R_KVX_S37_TLS_GD_UP27, 62) + RELOC_NUMBER (R_KVX_S43_TLS_GD_LO10, 63) + RELOC_NUMBER (R_KVX_S43_TLS_GD_UP27, 64) + RELOC_NUMBER (R_KVX_S43_TLS_GD_EX6, 65) + RELOC_NUMBER (R_KVX_S37_TLS_LD_LO10, 66) + RELOC_NUMBER (R_KVX_S37_TLS_LD_UP27, 67) + RELOC_NUMBER (R_KVX_S43_TLS_LD_LO10, 68) + RELOC_NUMBER (R_KVX_S43_TLS_LD_UP27, 69) + RELOC_NUMBER (R_KVX_S43_TLS_LD_EX6, 70) + RELOC_NUMBER (R_KVX_64_TPOFF, 71) + RELOC_NUMBER (R_KVX_S37_TLS_IE_LO10, 72) + RELOC_NUMBER (R_KVX_S37_TLS_IE_UP27, 73) + RELOC_NUMBER (R_KVX_S43_TLS_IE_LO10, 74) + RELOC_NUMBER (R_KVX_S43_TLS_IE_UP27, 75) + RELOC_NUMBER (R_KVX_S43_TLS_IE_EX6, 76) + RELOC_NUMBER (R_KVX_S37_TLS_LE_LO10, 77) + RELOC_NUMBER (R_KVX_S37_TLS_LE_UP27, 78) + RELOC_NUMBER (R_KVX_S43_TLS_LE_LO10, 79) + RELOC_NUMBER (R_KVX_S43_TLS_LE_UP27, 80) + RELOC_NUMBER (R_KVX_S43_TLS_LE_EX6, 81) + RELOC_NUMBER (R_KVX_8, 82) +END_RELOC_NUMBERS (R_KVX_end) + +#include "kvx_elfids.h" + +#endif diff --git a/include/elf/kvx_elfids.h b/include/elf/kvx_elfids.h new file mode 100644 index 00000000000..449f1d8d601 --- /dev/null +++ b/include/elf/kvx_elfids.h @@ -0,0 +1,81 @@ +/* DO NOT EDIT! -*- buffer-read-only: t -*- vi:set ro: */ + +/* KVX ELF IDs definitions. + + Copyright (C) 2009-2023 Free Software Foundation, Inc. + Contributed by Kalray SA. + + This file is part of GNU Binutils. + + This program 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 of the license, or + (at your option) any later version. + + This program 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; see the file COPYING3. If not, + see . */ + +/* This file holds definitions specific to the KV3 ELF IDs. */ + +#ifndef _KVX_ELFIDS_H_ +#define _KVX_ELFIDS_H_ + +/* 16.15 8.7 4.3 0 */ +/* +----------------------------+ */ +/* | CUT | CORE |PIC |ABI | */ +/* +----------------------------+ */ + + +#define KVX_CUT_MASK 0x00ff0000 +#define KVX_CORE_MASK 0x0000ff00 +#define KVX_ABI_MASK 0x000000ff +#define KVX_MACH_MASK (KVX_CUT_MASK | KVX_CORE_MASK | KVX_ABI_MASK) + +/* + * Machine private data : + * - byte 0 = ABI specific (PIC, OS, ...) + * - bit 0..3 = ABI ident + * - bit 4 = 32/64 bits addressing + * - bit 5 = PIC + * - byte 1 = Core info : + * - bits 0..3 = Core Major Version + * - bit 4..7 = Core Minor Version + */ + +/* Core */ +#define ELF_KVX_CORE_BIT_SHIFT (8) +#define ELF_KVX_CORE_MASK (0x7f<. */ + + +#ifndef OPCODE_KVX_H +#define OPCODE_KVX_H + +#define KVXMAXSYLLABLES 3 +#define KVXMAXOPERANDS 7 +#define KVXMAXBUNDLEISSUE 6 +#define KVXMAXBUNDLEWORDS 8 +#define KVXNUMCORES 3 +#define KVXNUMBUNDLINGS 19 + + +/* + * The following macros are provided for compatibility with old + * code. They should not be used in new code. + */ + + +/***********************************************/ +/* DATA TYPES */ +/***********************************************/ + +/* Operand definition -- used in building */ +/* format table */ + +enum kvx_rel { + /* Absolute relocation. */ + KVX_REL_ABS, + /* PC relative relocation. */ + KVX_REL_PC, + /* GP relative relocation. */ + KVX_REL_GP, + /* TP relative relocation. */ + KVX_REL_TP, + /* GOT relative relocation. */ + KVX_REL_GOT, + /* BASE load address relative relocation. */ + KVX_REL_BASE, +}; + +struct kvx_reloc { + /* Size in bits. */ + int bitsize; + /* Type of relative relocation. */ + enum kvx_rel relative; + /* Number of BFD relocations. */ + int reloc_nb; + /* List of BFD relocations. */ + unsigned int relocs[]; +}; + +struct kvx_bitfield { + /* Number of bits. */ + int size; + /* Offset in abstract value. */ + int from_offset; + /* Offset in encoded value. */ + int to_offset; +}; + +struct kvx_operand { + /* Operand type name. */ + const char *tname; + /* Type of operand. */ + int type; + /* Width of the operand. */ + int width; + /* Encoded value shift. */ + int shift; + /* Encoded value bias. */ + int bias; + /* Can be SIGNED|CANEXTEND|BITMASK|WRAPPED. */ + int flags; + /* Number of registers. */ + int reg_nb; + /* Valid registers for this operand (if no register get null pointer). */ + int *regs; + /* Number of relocations. */ + int reloc_nb; + /* List of relocations that can be applied to this operand. */ + struct kvx_reloc **relocs; + /* Number of given bitfields. */ + int bitfields; + /* Bitfields in most to least significant order. */ + struct kvx_bitfield bfield[]; +}; + +struct kvx_pseudo_relocs +{ + enum + { + S32_LO5_UP27, + S37_LO10_UP27, + S43_LO10_UP27_EX6, + S64_LO10_UP27_EX27, + S16, + S32, + S64, + } reloc_type; + + int bitsize; + + /* Used when pseudo func should expand to different relocations + based on the 32/64 bits mode. + Enum values should match the kvx_arch_size var set by -m32 + */ + enum + { + PSEUDO_ALL = 0, + PSEUDO_32_ONLY = 32, + PSEUDO_64_ONLY = 64, + } avail_modes; + + /* set to 1 when pseudo func does not take an argument */ + int has_no_arg; + + bfd_reloc_code_real_type reloc_lo5, reloc_lo10, reloc_up27, reloc_ex; + bfd_reloc_code_real_type single; + struct kvx_reloc *kreloc; +}; + +typedef struct symbol symbolS; + +struct pseudo_func +{ + const char *name; + + symbolS *sym; + struct kvx_pseudo_relocs pseudo_relocs; +}; + +/* some flags for kvx_operand */ +/* kvxSIGNED : is this operand treated as signed ? */ +/* kvxCANEXTEND : can this operand have an extension */ +/* kvxBITMASK : this operand is a bit mask */ +/* kvxWRAPPED : this operand can accept signed and unsigned integer ranges */ + + +#define kvxSIGNED 1 +#define kvxCANEXTEND 2 +#define kvxBITMASK 4 +#define kvxWRAPPED 8 + +#define kvxOPCODE_FLAG_UNDEF 0 + +#define kvxOPCODE_FLAG_IMMX0 1 +#define kvxOPCODE_FLAG_IMMX1 2 +#define kvxOPCODE_FLAG_BCU 4 +#define kvxOPCODE_FLAG_ALU 8 +#define kvxOPCODE_FLAG_LSU 16 +#define kvxOPCODE_FLAG_MAU 32 +#define kvxOPCODE_FLAG_MODE64 64 +#define kvxOPCODE_FLAG_MODE32 128 +/* Opcode definition. */ + +struct kvx_codeword { + /* The opcode. */ + unsigned opcode; + /* Disassembly mask. */ + unsigned mask; + /* Target dependent flags. */ + unsigned flags; +}; + +struct kvxopc { + /* asm name */ + const char *as_op; + /* 32 bits code words. */ + struct kvx_codeword codewords[KVXMAXSYLLABLES]; + /* Number of words in codewords[]. */ + int wordcount; + /* coding size in case of variable length. */ + unsigned coding_size; + /* Bundling class. */ + int bundling; + /* Reservation class. */ + int reservation; + /* 0 terminated. */ + struct kvx_operand *format[KVXMAXOPERANDS + 1]; + /* Resource class. */ + const char *rclass; + /* Formating string. */ + const char *fmtstring; +}; + +struct kvx_core_info { + struct kvxopc *optab; + const char *name; + const int *resources; + int elf_core; + struct pseudo_func *pseudo_funcs; + int nb_pseudo_funcs; + int **reservation_table_table; + int reservation_table_lines; + int resource_max; + char **resource_names; +}; + +struct kvx_Register { + int id; + const char *name; +}; + +extern const int kvx_kv3_v1_reservation_table_lines; +extern const int *kvx_kv3_v1_reservation_table_table[]; +extern const char *kvx_kv3_v1_resource_names[]; + +extern const int kvx_kv3_v1_resources[]; +extern struct kvxopc kvx_kv3_v1_optab[]; +extern const struct kvx_core_info kvx_kv3_v1_core_info; +extern const int kvx_kv3_v2_reservation_table_lines; +extern const int *kvx_kv3_v2_reservation_table_table[]; +extern const char *kvx_kv3_v2_resource_names[]; + +extern const int kvx_kv3_v2_resources[]; +extern struct kvxopc kvx_kv3_v2_optab[]; +extern const struct kvx_core_info kvx_kv3_v2_core_info; +extern const int kvx_kv4_v1_reservation_table_lines; +extern const int *kvx_kv4_v1_reservation_table_table[]; +extern const char *kvx_kv4_v1_resource_names[]; + +extern const int kvx_kv4_v1_resources[]; +extern struct kvxopc kvx_kv4_v1_optab[]; +extern const struct kvx_core_info kvx_kv4_v1_core_info; +extern const struct kvx_core_info *kvx_core_info_table[]; +extern const char ***kvx_modifiers_table[]; +extern const struct kvx_Register *kvx_registers_table[]; +extern const int *kvx_regfiles_table[]; + +#define KVX_REGFILE_FIRST_GPR 0 +#define KVX_REGFILE_LAST_GPR 1 +#define KVX_REGFILE_DEC_GPR 2 +#define KVX_REGFILE_FIRST_PGR 3 +#define KVX_REGFILE_LAST_PGR 4 +#define KVX_REGFILE_DEC_PGR 5 +#define KVX_REGFILE_FIRST_QGR 6 +#define KVX_REGFILE_LAST_QGR 7 +#define KVX_REGFILE_DEC_QGR 8 +#define KVX_REGFILE_FIRST_SFR 9 +#define KVX_REGFILE_LAST_SFR 10 +#define KVX_REGFILE_DEC_SFR 11 +#define KVX_REGFILE_FIRST_X16R 12 +#define KVX_REGFILE_LAST_X16R 13 +#define KVX_REGFILE_DEC_X16R 14 +#define KVX_REGFILE_FIRST_X2R 15 +#define KVX_REGFILE_LAST_X2R 16 +#define KVX_REGFILE_DEC_X2R 17 +#define KVX_REGFILE_FIRST_X32R 18 +#define KVX_REGFILE_LAST_X32R 19 +#define KVX_REGFILE_DEC_X32R 20 +#define KVX_REGFILE_FIRST_X4R 21 +#define KVX_REGFILE_LAST_X4R 22 +#define KVX_REGFILE_DEC_X4R 23 +#define KVX_REGFILE_FIRST_X64R 24 +#define KVX_REGFILE_LAST_X64R 25 +#define KVX_REGFILE_DEC_X64R 26 +#define KVX_REGFILE_FIRST_X8R 27 +#define KVX_REGFILE_LAST_X8R 28 +#define KVX_REGFILE_DEC_X8R 29 +#define KVX_REGFILE_FIRST_XBR 30 +#define KVX_REGFILE_LAST_XBR 31 +#define KVX_REGFILE_DEC_XBR 32 +#define KVX_REGFILE_FIRST_XCR 33 +#define KVX_REGFILE_LAST_XCR 34 +#define KVX_REGFILE_DEC_XCR 35 +#define KVX_REGFILE_FIRST_XMR 36 +#define KVX_REGFILE_LAST_XMR 37 +#define KVX_REGFILE_DEC_XMR 38 +#define KVX_REGFILE_FIRST_XTR 39 +#define KVX_REGFILE_LAST_XTR 40 +#define KVX_REGFILE_DEC_XTR 41 +#define KVX_REGFILE_FIRST_XVR 42 +#define KVX_REGFILE_LAST_XVR 43 +#define KVX_REGFILE_DEC_XVR 44 +#define KVX_REGFILE_REGISTERS 45 +#define KVX_REGFILE_DEC_REGISTERS 46 + + +extern int kvx_kv3_v1_regfiles[]; +extern const char **kvx_kv3_v1_modifiers[]; +extern struct kvx_Register kvx_kv3_v1_registers[]; + +extern int kvx_kv3_v1_dec_registers[]; + +enum Method_kvx_kv3_v1_enum { + Immediate_kv3_v1_pcrel17 = 1, + Immediate_kv3_v1_pcrel27 = 2, + Immediate_kv3_v1_signed10 = 3, + Immediate_kv3_v1_signed16 = 4, + Immediate_kv3_v1_signed27 = 5, + Immediate_kv3_v1_signed37 = 6, + Immediate_kv3_v1_signed43 = 7, + Immediate_kv3_v1_signed54 = 8, + Immediate_kv3_v1_sysnumber = 9, + Immediate_kv3_v1_unsigned6 = 10, + Immediate_kv3_v1_wrapped32 = 11, + Immediate_kv3_v1_wrapped64 = 12, + Modifier_kv3_v1_column = 13, + Modifier_kv3_v1_comparison = 14, + Modifier_kv3_v1_doscale = 15, + Modifier_kv3_v1_exunum = 16, + Modifier_kv3_v1_floatcomp = 17, + Modifier_kv3_v1_qindex = 18, + Modifier_kv3_v1_rectify = 19, + Modifier_kv3_v1_rounding = 20, + Modifier_kv3_v1_roundint = 21, + Modifier_kv3_v1_saturate = 22, + Modifier_kv3_v1_scalarcond = 23, + Modifier_kv3_v1_silent = 24, + Modifier_kv3_v1_simplecond = 25, + Modifier_kv3_v1_speculate = 26, + Modifier_kv3_v1_splat32 = 27, + Modifier_kv3_v1_variant = 28, + RegClass_kv3_v1_aloneReg = 29, + RegClass_kv3_v1_blockReg = 30, + RegClass_kv3_v1_blockReg0M4 = 31, + RegClass_kv3_v1_blockReg1M4 = 32, + RegClass_kv3_v1_blockReg2M4 = 33, + RegClass_kv3_v1_blockReg3M4 = 34, + RegClass_kv3_v1_blockRegE = 35, + RegClass_kv3_v1_blockRegO = 36, + RegClass_kv3_v1_blockReg_0 = 37, + RegClass_kv3_v1_blockReg_1 = 38, + RegClass_kv3_v1_buffer16Reg = 39, + RegClass_kv3_v1_buffer2Reg = 40, + RegClass_kv3_v1_buffer32Reg = 41, + RegClass_kv3_v1_buffer4Reg = 42, + RegClass_kv3_v1_buffer64Reg = 43, + RegClass_kv3_v1_buffer8Reg = 44, + RegClass_kv3_v1_coproReg = 45, + RegClass_kv3_v1_coproReg0M4 = 46, + RegClass_kv3_v1_coproReg1M4 = 47, + RegClass_kv3_v1_coproReg2M4 = 48, + RegClass_kv3_v1_coproReg3M4 = 49, + RegClass_kv3_v1_matrixReg = 50, + RegClass_kv3_v1_matrixReg_0 = 51, + RegClass_kv3_v1_matrixReg_1 = 52, + RegClass_kv3_v1_matrixReg_2 = 53, + RegClass_kv3_v1_matrixReg_3 = 54, + RegClass_kv3_v1_onlyfxReg = 55, + RegClass_kv3_v1_onlygetReg = 56, + RegClass_kv3_v1_onlyraReg = 57, + RegClass_kv3_v1_onlysetReg = 58, + RegClass_kv3_v1_onlyswapReg = 59, + RegClass_kv3_v1_pairedReg = 60, + RegClass_kv3_v1_pairedReg_0 = 61, + RegClass_kv3_v1_pairedReg_1 = 62, + RegClass_kv3_v1_quadReg = 63, + RegClass_kv3_v1_quadReg_0 = 64, + RegClass_kv3_v1_quadReg_1 = 65, + RegClass_kv3_v1_quadReg_2 = 66, + RegClass_kv3_v1_quadReg_3 = 67, + RegClass_kv3_v1_singleReg = 68, + RegClass_kv3_v1_systemReg = 69, + RegClass_kv3_v1_tileReg = 70, + RegClass_kv3_v1_tileReg_0 = 71, + RegClass_kv3_v1_tileReg_1 = 72, + RegClass_kv3_v1_vectorReg = 73, + RegClass_kv3_v1_vectorRegE = 74, + RegClass_kv3_v1_vectorRegO = 75, + RegClass_kv3_v1_vectorReg_0 = 76, + RegClass_kv3_v1_vectorReg_1 = 77, + RegClass_kv3_v1_vectorReg_2 = 78, + RegClass_kv3_v1_vectorReg_3 = 79, + Instruction_kv3_v1_abdd = 80, + Instruction_kv3_v1_abdd_abase = 81, + Instruction_kv3_v1_abdhq = 82, + Instruction_kv3_v1_abdw = 83, + Instruction_kv3_v1_abdwp = 84, + Instruction_kv3_v1_absd = 85, + Instruction_kv3_v1_abshq = 86, + Instruction_kv3_v1_absw = 87, + Instruction_kv3_v1_abswp = 88, + Instruction_kv3_v1_acswapd = 89, + Instruction_kv3_v1_acswapw = 90, + Instruction_kv3_v1_addcd = 91, + Instruction_kv3_v1_addcd_i = 92, + Instruction_kv3_v1_addd = 93, + Instruction_kv3_v1_addd_abase = 94, + Instruction_kv3_v1_addhcp_c = 95, + Instruction_kv3_v1_addhq = 96, + Instruction_kv3_v1_addsd = 97, + Instruction_kv3_v1_addshq = 98, + Instruction_kv3_v1_addsw = 99, + Instruction_kv3_v1_addswp = 100, + Instruction_kv3_v1_adduwd = 101, + Instruction_kv3_v1_addw = 102, + Instruction_kv3_v1_addwc_c = 103, + Instruction_kv3_v1_addwd = 104, + Instruction_kv3_v1_addwp = 105, + Instruction_kv3_v1_addx16d = 106, + Instruction_kv3_v1_addx16hq = 107, + Instruction_kv3_v1_addx16uwd = 108, + Instruction_kv3_v1_addx16w = 109, + Instruction_kv3_v1_addx16wd = 110, + Instruction_kv3_v1_addx16wp = 111, + Instruction_kv3_v1_addx2d = 112, + Instruction_kv3_v1_addx2hq = 113, + Instruction_kv3_v1_addx2uwd = 114, + Instruction_kv3_v1_addx2w = 115, + Instruction_kv3_v1_addx2wd = 116, + Instruction_kv3_v1_addx2wp = 117, + Instruction_kv3_v1_addx4d = 118, + Instruction_kv3_v1_addx4hq = 119, + Instruction_kv3_v1_addx4uwd = 120, + Instruction_kv3_v1_addx4w = 121, + Instruction_kv3_v1_addx4wd = 122, + Instruction_kv3_v1_addx4wp = 123, + Instruction_kv3_v1_addx8d = 124, + Instruction_kv3_v1_addx8hq = 125, + Instruction_kv3_v1_addx8uwd = 126, + Instruction_kv3_v1_addx8w = 127, + Instruction_kv3_v1_addx8wd = 128, + Instruction_kv3_v1_addx8wp = 129, + Instruction_kv3_v1_aladdd = 130, + Instruction_kv3_v1_aladdw = 131, + Instruction_kv3_v1_alclrd = 132, + Instruction_kv3_v1_alclrw = 133, + Instruction_kv3_v1_aligno = 134, + Instruction_kv3_v1_alignv = 135, + Instruction_kv3_v1_andd = 136, + Instruction_kv3_v1_andd_abase = 137, + Instruction_kv3_v1_andnd = 138, + Instruction_kv3_v1_andnd_abase = 139, + Instruction_kv3_v1_andnw = 140, + Instruction_kv3_v1_andw = 141, + Instruction_kv3_v1_avghq = 142, + Instruction_kv3_v1_avgrhq = 143, + Instruction_kv3_v1_avgruhq = 144, + Instruction_kv3_v1_avgruw = 145, + Instruction_kv3_v1_avgruwp = 146, + Instruction_kv3_v1_avgrw = 147, + Instruction_kv3_v1_avgrwp = 148, + Instruction_kv3_v1_avguhq = 149, + Instruction_kv3_v1_avguw = 150, + Instruction_kv3_v1_avguwp = 151, + Instruction_kv3_v1_avgw = 152, + Instruction_kv3_v1_avgwp = 153, + Instruction_kv3_v1_await = 154, + Instruction_kv3_v1_barrier = 155, + Instruction_kv3_v1_call = 156, + Instruction_kv3_v1_cb = 157, + Instruction_kv3_v1_cbsd = 158, + Instruction_kv3_v1_cbsw = 159, + Instruction_kv3_v1_cbswp = 160, + Instruction_kv3_v1_clrf = 161, + Instruction_kv3_v1_clsd = 162, + Instruction_kv3_v1_clsw = 163, + Instruction_kv3_v1_clswp = 164, + Instruction_kv3_v1_clzd = 165, + Instruction_kv3_v1_clzw = 166, + Instruction_kv3_v1_clzwp = 167, + Instruction_kv3_v1_cmoved = 168, + Instruction_kv3_v1_cmovehq = 169, + Instruction_kv3_v1_cmovewp = 170, + Instruction_kv3_v1_cmuldt = 171, + Instruction_kv3_v1_cmulghxdt = 172, + Instruction_kv3_v1_cmulglxdt = 173, + Instruction_kv3_v1_cmulgmxdt = 174, + Instruction_kv3_v1_cmulxdt = 175, + Instruction_kv3_v1_compd = 176, + Instruction_kv3_v1_compnhq = 177, + Instruction_kv3_v1_compnwp = 178, + Instruction_kv3_v1_compuwd = 179, + Instruction_kv3_v1_compw = 180, + Instruction_kv3_v1_compwd = 181, + Instruction_kv3_v1_convdhv0 = 182, + Instruction_kv3_v1_convdhv1 = 183, + Instruction_kv3_v1_convwbv0 = 184, + Instruction_kv3_v1_convwbv1 = 185, + Instruction_kv3_v1_convwbv2 = 186, + Instruction_kv3_v1_convwbv3 = 187, + Instruction_kv3_v1_copyd = 188, + Instruction_kv3_v1_copyo = 189, + Instruction_kv3_v1_copyq = 190, + Instruction_kv3_v1_copyw = 191, + Instruction_kv3_v1_crcbellw = 192, + Instruction_kv3_v1_crcbelmw = 193, + Instruction_kv3_v1_crclellw = 194, + Instruction_kv3_v1_crclelmw = 195, + Instruction_kv3_v1_ctzd = 196, + Instruction_kv3_v1_ctzw = 197, + Instruction_kv3_v1_ctzwp = 198, + Instruction_kv3_v1_d1inval = 199, + Instruction_kv3_v1_dinvall = 200, + Instruction_kv3_v1_dot2suwd = 201, + Instruction_kv3_v1_dot2suwdp = 202, + Instruction_kv3_v1_dot2uwd = 203, + Instruction_kv3_v1_dot2uwdp = 204, + Instruction_kv3_v1_dot2w = 205, + Instruction_kv3_v1_dot2wd = 206, + Instruction_kv3_v1_dot2wdp = 207, + Instruction_kv3_v1_dot2wzp = 208, + Instruction_kv3_v1_dtouchl = 209, + Instruction_kv3_v1_dzerol = 210, + Instruction_kv3_v1_errop = 211, + Instruction_kv3_v1_extfs = 212, + Instruction_kv3_v1_extfz = 213, + Instruction_kv3_v1_fabsd = 214, + Instruction_kv3_v1_fabshq = 215, + Instruction_kv3_v1_fabsw = 216, + Instruction_kv3_v1_fabswp = 217, + Instruction_kv3_v1_faddd = 218, + Instruction_kv3_v1_fadddc = 219, + Instruction_kv3_v1_fadddc_c = 220, + Instruction_kv3_v1_fadddp = 221, + Instruction_kv3_v1_faddhq = 222, + Instruction_kv3_v1_faddw = 223, + Instruction_kv3_v1_faddwc = 224, + Instruction_kv3_v1_faddwc_c = 225, + Instruction_kv3_v1_faddwcp = 226, + Instruction_kv3_v1_faddwcp_c = 227, + Instruction_kv3_v1_faddwp = 228, + Instruction_kv3_v1_faddwq = 229, + Instruction_kv3_v1_fcdivd = 230, + Instruction_kv3_v1_fcdivw = 231, + Instruction_kv3_v1_fcdivwp = 232, + Instruction_kv3_v1_fcompd = 233, + Instruction_kv3_v1_fcompnhq = 234, + Instruction_kv3_v1_fcompnwp = 235, + Instruction_kv3_v1_fcompw = 236, + Instruction_kv3_v1_fdot2w = 237, + Instruction_kv3_v1_fdot2wd = 238, + Instruction_kv3_v1_fdot2wdp = 239, + Instruction_kv3_v1_fdot2wzp = 240, + Instruction_kv3_v1_fence = 241, + Instruction_kv3_v1_ffmad = 242, + Instruction_kv3_v1_ffmahq = 243, + Instruction_kv3_v1_ffmahw = 244, + Instruction_kv3_v1_ffmahwq = 245, + Instruction_kv3_v1_ffmaw = 246, + Instruction_kv3_v1_ffmawd = 247, + Instruction_kv3_v1_ffmawdp = 248, + Instruction_kv3_v1_ffmawp = 249, + Instruction_kv3_v1_ffmsd = 250, + Instruction_kv3_v1_ffmshq = 251, + Instruction_kv3_v1_ffmshw = 252, + Instruction_kv3_v1_ffmshwq = 253, + Instruction_kv3_v1_ffmsw = 254, + Instruction_kv3_v1_ffmswd = 255, + Instruction_kv3_v1_ffmswdp = 256, + Instruction_kv3_v1_ffmswp = 257, + Instruction_kv3_v1_fixedd = 258, + Instruction_kv3_v1_fixedud = 259, + Instruction_kv3_v1_fixeduw = 260, + Instruction_kv3_v1_fixeduwp = 261, + Instruction_kv3_v1_fixedw = 262, + Instruction_kv3_v1_fixedwp = 263, + Instruction_kv3_v1_floatd = 264, + Instruction_kv3_v1_floatud = 265, + Instruction_kv3_v1_floatuw = 266, + Instruction_kv3_v1_floatuwp = 267, + Instruction_kv3_v1_floatw = 268, + Instruction_kv3_v1_floatwp = 269, + Instruction_kv3_v1_fmaxd = 270, + Instruction_kv3_v1_fmaxhq = 271, + Instruction_kv3_v1_fmaxw = 272, + Instruction_kv3_v1_fmaxwp = 273, + Instruction_kv3_v1_fmind = 274, + Instruction_kv3_v1_fminhq = 275, + Instruction_kv3_v1_fminw = 276, + Instruction_kv3_v1_fminwp = 277, + Instruction_kv3_v1_fmm212w = 278, + Instruction_kv3_v1_fmma212w = 279, + Instruction_kv3_v1_fmma242hw0 = 280, + Instruction_kv3_v1_fmma242hw1 = 281, + Instruction_kv3_v1_fmma242hw2 = 282, + Instruction_kv3_v1_fmma242hw3 = 283, + Instruction_kv3_v1_fmms212w = 284, + Instruction_kv3_v1_fmuld = 285, + Instruction_kv3_v1_fmulhq = 286, + Instruction_kv3_v1_fmulhw = 287, + Instruction_kv3_v1_fmulhwq = 288, + Instruction_kv3_v1_fmulw = 289, + Instruction_kv3_v1_fmulwc = 290, + Instruction_kv3_v1_fmulwc_c = 291, + Instruction_kv3_v1_fmulwd = 292, + Instruction_kv3_v1_fmulwdc = 293, + Instruction_kv3_v1_fmulwdc_c = 294, + Instruction_kv3_v1_fmulwdp = 295, + Instruction_kv3_v1_fmulwp = 296, + Instruction_kv3_v1_fmulwq = 297, + Instruction_kv3_v1_fnarrow44wh = 298, + Instruction_kv3_v1_fnarrowdw = 299, + Instruction_kv3_v1_fnarrowdwp = 300, + Instruction_kv3_v1_fnarrowwh = 301, + Instruction_kv3_v1_fnarrowwhq = 302, + Instruction_kv3_v1_fnegd = 303, + Instruction_kv3_v1_fneghq = 304, + Instruction_kv3_v1_fnegw = 305, + Instruction_kv3_v1_fnegwp = 306, + Instruction_kv3_v1_frecw = 307, + Instruction_kv3_v1_frsrw = 308, + Instruction_kv3_v1_fsbfd = 309, + Instruction_kv3_v1_fsbfdc = 310, + Instruction_kv3_v1_fsbfdc_c = 311, + Instruction_kv3_v1_fsbfdp = 312, + Instruction_kv3_v1_fsbfhq = 313, + Instruction_kv3_v1_fsbfw = 314, + Instruction_kv3_v1_fsbfwc = 315, + Instruction_kv3_v1_fsbfwc_c = 316, + Instruction_kv3_v1_fsbfwcp = 317, + Instruction_kv3_v1_fsbfwcp_c = 318, + Instruction_kv3_v1_fsbfwp = 319, + Instruction_kv3_v1_fsbfwq = 320, + Instruction_kv3_v1_fscalewv = 321, + Instruction_kv3_v1_fsdivd = 322, + Instruction_kv3_v1_fsdivw = 323, + Instruction_kv3_v1_fsdivwp = 324, + Instruction_kv3_v1_fsrecd = 325, + Instruction_kv3_v1_fsrecw = 326, + Instruction_kv3_v1_fsrecwp = 327, + Instruction_kv3_v1_fsrsrd = 328, + Instruction_kv3_v1_fsrsrw = 329, + Instruction_kv3_v1_fsrsrwp = 330, + Instruction_kv3_v1_fwidenlhw = 331, + Instruction_kv3_v1_fwidenlhwp = 332, + Instruction_kv3_v1_fwidenlwd = 333, + Instruction_kv3_v1_fwidenmhw = 334, + Instruction_kv3_v1_fwidenmhwp = 335, + Instruction_kv3_v1_fwidenmwd = 336, + Instruction_kv3_v1_get = 337, + Instruction_kv3_v1_goto = 338, + Instruction_kv3_v1_i1inval = 339, + Instruction_kv3_v1_i1invals = 340, + Instruction_kv3_v1_icall = 341, + Instruction_kv3_v1_iget = 342, + Instruction_kv3_v1_igoto = 343, + Instruction_kv3_v1_insf = 344, + Instruction_kv3_v1_landd = 345, + Instruction_kv3_v1_landhq = 346, + Instruction_kv3_v1_landw = 347, + Instruction_kv3_v1_landwp = 348, + Instruction_kv3_v1_lbs = 349, + Instruction_kv3_v1_lbz = 350, + Instruction_kv3_v1_ld = 351, + Instruction_kv3_v1_lhs = 352, + Instruction_kv3_v1_lhz = 353, + Instruction_kv3_v1_lnandd = 354, + Instruction_kv3_v1_lnandhq = 355, + Instruction_kv3_v1_lnandw = 356, + Instruction_kv3_v1_lnandwp = 357, + Instruction_kv3_v1_lnord = 358, + Instruction_kv3_v1_lnorhq = 359, + Instruction_kv3_v1_lnorw = 360, + Instruction_kv3_v1_lnorwp = 361, + Instruction_kv3_v1_lo = 362, + Instruction_kv3_v1_loopdo = 363, + Instruction_kv3_v1_lord = 364, + Instruction_kv3_v1_lorhq = 365, + Instruction_kv3_v1_lorw = 366, + Instruction_kv3_v1_lorwp = 367, + Instruction_kv3_v1_lq = 368, + Instruction_kv3_v1_lws = 369, + Instruction_kv3_v1_lwz = 370, + Instruction_kv3_v1_maddd = 371, + Instruction_kv3_v1_madddt = 372, + Instruction_kv3_v1_maddhq = 373, + Instruction_kv3_v1_maddhwq = 374, + Instruction_kv3_v1_maddsudt = 375, + Instruction_kv3_v1_maddsuhwq = 376, + Instruction_kv3_v1_maddsuwd = 377, + Instruction_kv3_v1_maddsuwdp = 378, + Instruction_kv3_v1_maddudt = 379, + Instruction_kv3_v1_madduhwq = 380, + Instruction_kv3_v1_madduwd = 381, + Instruction_kv3_v1_madduwdp = 382, + Instruction_kv3_v1_madduzdt = 383, + Instruction_kv3_v1_maddw = 384, + Instruction_kv3_v1_maddwd = 385, + Instruction_kv3_v1_maddwdp = 386, + Instruction_kv3_v1_maddwp = 387, + Instruction_kv3_v1_make = 388, + Instruction_kv3_v1_maxd = 389, + Instruction_kv3_v1_maxd_abase = 390, + Instruction_kv3_v1_maxhq = 391, + Instruction_kv3_v1_maxud = 392, + Instruction_kv3_v1_maxud_abase = 393, + Instruction_kv3_v1_maxuhq = 394, + Instruction_kv3_v1_maxuw = 395, + Instruction_kv3_v1_maxuwp = 396, + Instruction_kv3_v1_maxw = 397, + Instruction_kv3_v1_maxwp = 398, + Instruction_kv3_v1_mind = 399, + Instruction_kv3_v1_mind_abase = 400, + Instruction_kv3_v1_minhq = 401, + Instruction_kv3_v1_minud = 402, + Instruction_kv3_v1_minud_abase = 403, + Instruction_kv3_v1_minuhq = 404, + Instruction_kv3_v1_minuw = 405, + Instruction_kv3_v1_minuwp = 406, + Instruction_kv3_v1_minw = 407, + Instruction_kv3_v1_minwp = 408, + Instruction_kv3_v1_mm212w = 409, + Instruction_kv3_v1_mma212w = 410, + Instruction_kv3_v1_mma444hbd0 = 411, + Instruction_kv3_v1_mma444hbd1 = 412, + Instruction_kv3_v1_mma444hd = 413, + Instruction_kv3_v1_mma444suhbd0 = 414, + Instruction_kv3_v1_mma444suhbd1 = 415, + Instruction_kv3_v1_mma444suhd = 416, + Instruction_kv3_v1_mma444uhbd0 = 417, + Instruction_kv3_v1_mma444uhbd1 = 418, + Instruction_kv3_v1_mma444uhd = 419, + Instruction_kv3_v1_mma444ushbd0 = 420, + Instruction_kv3_v1_mma444ushbd1 = 421, + Instruction_kv3_v1_mma444ushd = 422, + Instruction_kv3_v1_mms212w = 423, + Instruction_kv3_v1_movetq = 424, + Instruction_kv3_v1_msbfd = 425, + Instruction_kv3_v1_msbfdt = 426, + Instruction_kv3_v1_msbfhq = 427, + Instruction_kv3_v1_msbfhwq = 428, + Instruction_kv3_v1_msbfsudt = 429, + Instruction_kv3_v1_msbfsuhwq = 430, + Instruction_kv3_v1_msbfsuwd = 431, + Instruction_kv3_v1_msbfsuwdp = 432, + Instruction_kv3_v1_msbfudt = 433, + Instruction_kv3_v1_msbfuhwq = 434, + Instruction_kv3_v1_msbfuwd = 435, + Instruction_kv3_v1_msbfuwdp = 436, + Instruction_kv3_v1_msbfuzdt = 437, + Instruction_kv3_v1_msbfw = 438, + Instruction_kv3_v1_msbfwd = 439, + Instruction_kv3_v1_msbfwdp = 440, + Instruction_kv3_v1_msbfwp = 441, + Instruction_kv3_v1_muld = 442, + Instruction_kv3_v1_muldt = 443, + Instruction_kv3_v1_mulhq = 444, + Instruction_kv3_v1_mulhwq = 445, + Instruction_kv3_v1_mulsudt = 446, + Instruction_kv3_v1_mulsuhwq = 447, + Instruction_kv3_v1_mulsuwd = 448, + Instruction_kv3_v1_mulsuwdp = 449, + Instruction_kv3_v1_muludt = 450, + Instruction_kv3_v1_muluhwq = 451, + Instruction_kv3_v1_muluwd = 452, + Instruction_kv3_v1_muluwdp = 453, + Instruction_kv3_v1_mulw = 454, + Instruction_kv3_v1_mulwc = 455, + Instruction_kv3_v1_mulwc_c = 456, + Instruction_kv3_v1_mulwd = 457, + Instruction_kv3_v1_mulwdc = 458, + Instruction_kv3_v1_mulwdc_c = 459, + Instruction_kv3_v1_mulwdp = 460, + Instruction_kv3_v1_mulwp = 461, + Instruction_kv3_v1_mulwq = 462, + Instruction_kv3_v1_nandd = 463, + Instruction_kv3_v1_nandd_abase = 464, + Instruction_kv3_v1_nandw = 465, + Instruction_kv3_v1_negd = 466, + Instruction_kv3_v1_neghq = 467, + Instruction_kv3_v1_negw = 468, + Instruction_kv3_v1_negwp = 469, + Instruction_kv3_v1_nop = 470, + Instruction_kv3_v1_nord = 471, + Instruction_kv3_v1_nord_abase = 472, + Instruction_kv3_v1_norw = 473, + Instruction_kv3_v1_notd = 474, + Instruction_kv3_v1_notw = 475, + Instruction_kv3_v1_nxord = 476, + Instruction_kv3_v1_nxord_abase = 477, + Instruction_kv3_v1_nxorw = 478, + Instruction_kv3_v1_ord = 479, + Instruction_kv3_v1_ord_abase = 480, + Instruction_kv3_v1_ornd = 481, + Instruction_kv3_v1_ornd_abase = 482, + Instruction_kv3_v1_ornw = 483, + Instruction_kv3_v1_orw = 484, + Instruction_kv3_v1_pcrel = 485, + Instruction_kv3_v1_ret = 486, + Instruction_kv3_v1_rfe = 487, + Instruction_kv3_v1_rolw = 488, + Instruction_kv3_v1_rolwps = 489, + Instruction_kv3_v1_rorw = 490, + Instruction_kv3_v1_rorwps = 491, + Instruction_kv3_v1_rswap = 492, + Instruction_kv3_v1_satd = 493, + Instruction_kv3_v1_satdh = 494, + Instruction_kv3_v1_satdw = 495, + Instruction_kv3_v1_sb = 496, + Instruction_kv3_v1_sbfcd = 497, + Instruction_kv3_v1_sbfcd_i = 498, + Instruction_kv3_v1_sbfd = 499, + Instruction_kv3_v1_sbfd_abase = 500, + Instruction_kv3_v1_sbfhcp_c = 501, + Instruction_kv3_v1_sbfhq = 502, + Instruction_kv3_v1_sbfsd = 503, + Instruction_kv3_v1_sbfshq = 504, + Instruction_kv3_v1_sbfsw = 505, + Instruction_kv3_v1_sbfswp = 506, + Instruction_kv3_v1_sbfuwd = 507, + Instruction_kv3_v1_sbfw = 508, + Instruction_kv3_v1_sbfwc_c = 509, + Instruction_kv3_v1_sbfwd = 510, + Instruction_kv3_v1_sbfwp = 511, + Instruction_kv3_v1_sbfx16d = 512, + Instruction_kv3_v1_sbfx16hq = 513, + Instruction_kv3_v1_sbfx16uwd = 514, + Instruction_kv3_v1_sbfx16w = 515, + Instruction_kv3_v1_sbfx16wd = 516, + Instruction_kv3_v1_sbfx16wp = 517, + Instruction_kv3_v1_sbfx2d = 518, + Instruction_kv3_v1_sbfx2hq = 519, + Instruction_kv3_v1_sbfx2uwd = 520, + Instruction_kv3_v1_sbfx2w = 521, + Instruction_kv3_v1_sbfx2wd = 522, + Instruction_kv3_v1_sbfx2wp = 523, + Instruction_kv3_v1_sbfx4d = 524, + Instruction_kv3_v1_sbfx4hq = 525, + Instruction_kv3_v1_sbfx4uwd = 526, + Instruction_kv3_v1_sbfx4w = 527, + Instruction_kv3_v1_sbfx4wd = 528, + Instruction_kv3_v1_sbfx4wp = 529, + Instruction_kv3_v1_sbfx8d = 530, + Instruction_kv3_v1_sbfx8hq = 531, + Instruction_kv3_v1_sbfx8uwd = 532, + Instruction_kv3_v1_sbfx8w = 533, + Instruction_kv3_v1_sbfx8wd = 534, + Instruction_kv3_v1_sbfx8wp = 535, + Instruction_kv3_v1_sbmm8 = 536, + Instruction_kv3_v1_sbmm8_abase = 537, + Instruction_kv3_v1_sbmmt8 = 538, + Instruction_kv3_v1_sbmmt8_abase = 539, + Instruction_kv3_v1_scall = 540, + Instruction_kv3_v1_sd = 541, + Instruction_kv3_v1_set = 542, + Instruction_kv3_v1_sh = 543, + Instruction_kv3_v1_sleep = 544, + Instruction_kv3_v1_slld = 545, + Instruction_kv3_v1_sllhqs = 546, + Instruction_kv3_v1_sllw = 547, + Instruction_kv3_v1_sllwps = 548, + Instruction_kv3_v1_slsd = 549, + Instruction_kv3_v1_slshqs = 550, + Instruction_kv3_v1_slsw = 551, + Instruction_kv3_v1_slswps = 552, + Instruction_kv3_v1_so = 553, + Instruction_kv3_v1_sq = 554, + Instruction_kv3_v1_srad = 555, + Instruction_kv3_v1_srahqs = 556, + Instruction_kv3_v1_sraw = 557, + Instruction_kv3_v1_srawps = 558, + Instruction_kv3_v1_srld = 559, + Instruction_kv3_v1_srlhqs = 560, + Instruction_kv3_v1_srlw = 561, + Instruction_kv3_v1_srlwps = 562, + Instruction_kv3_v1_srsd = 563, + Instruction_kv3_v1_srshqs = 564, + Instruction_kv3_v1_srsw = 565, + Instruction_kv3_v1_srswps = 566, + Instruction_kv3_v1_stop = 567, + Instruction_kv3_v1_stsud = 568, + Instruction_kv3_v1_stsuw = 569, + Instruction_kv3_v1_sw = 570, + Instruction_kv3_v1_sxbd = 571, + Instruction_kv3_v1_sxhd = 572, + Instruction_kv3_v1_sxlbhq = 573, + Instruction_kv3_v1_sxlhwp = 574, + Instruction_kv3_v1_sxmbhq = 575, + Instruction_kv3_v1_sxmhwp = 576, + Instruction_kv3_v1_sxwd = 577, + Instruction_kv3_v1_syncgroup = 578, + Instruction_kv3_v1_tlbdinval = 579, + Instruction_kv3_v1_tlbiinval = 580, + Instruction_kv3_v1_tlbprobe = 581, + Instruction_kv3_v1_tlbread = 582, + Instruction_kv3_v1_tlbwrite = 583, + Instruction_kv3_v1_waitit = 584, + Instruction_kv3_v1_wfxl = 585, + Instruction_kv3_v1_wfxm = 586, + Instruction_kv3_v1_xcopyo = 587, + Instruction_kv3_v1_xlo = 588, + Instruction_kv3_v1_xmma484bw = 589, + Instruction_kv3_v1_xmma484subw = 590, + Instruction_kv3_v1_xmma484ubw = 591, + Instruction_kv3_v1_xmma484usbw = 592, + Instruction_kv3_v1_xmovefo = 593, + Instruction_kv3_v1_xmovetq = 594, + Instruction_kv3_v1_xmt44d = 595, + Instruction_kv3_v1_xord = 596, + Instruction_kv3_v1_xord_abase = 597, + Instruction_kv3_v1_xorw = 598, + Instruction_kv3_v1_xso = 599, + Instruction_kv3_v1_zxbd = 600, + Instruction_kv3_v1_zxhd = 601, + Instruction_kv3_v1_zxwd = 602, + Separator_kv3_v1_comma = 603, + Separator_kv3_v1_equal = 604, + Separator_kv3_v1_qmark = 605, + Separator_kv3_v1_rsbracket = 606, + Separator_kv3_v1_lsbracket = 607 +}; + +enum Modifier_kv3_v1_exunum_enum { + Modifier_kv3_v1_exunum_ALU0=0, + Modifier_kv3_v1_exunum_ALU1=1, + Modifier_kv3_v1_exunum_MAU=2, + Modifier_kv3_v1_exunum_LSU=3, +}; + +extern const char *mod_kv3_v1_exunum[]; +extern const char *mod_kv3_v1_scalarcond[]; +extern const char *mod_kv3_v1_simplecond[]; +extern const char *mod_kv3_v1_comparison[]; +extern const char *mod_kv3_v1_floatcomp[]; +extern const char *mod_kv3_v1_rounding[]; +extern const char *mod_kv3_v1_silent[]; +extern const char *mod_kv3_v1_roundint[]; +extern const char *mod_kv3_v1_saturate[]; +extern const char *mod_kv3_v1_rectify[]; +extern const char *mod_kv3_v1_variant[]; +extern const char *mod_kv3_v1_speculate[]; +extern const char *mod_kv3_v1_column[]; +extern const char *mod_kv3_v1_doscale[]; +extern const char *mod_kv3_v1_qindex[]; +extern const char *mod_kv3_v1_splat32[]; +typedef enum { + Bundling_kv3_v1_ALL, + Bundling_kv3_v1_BCU, + Bundling_kv3_v1_TCA, + Bundling_kv3_v1_FULL, + Bundling_kv3_v1_FULL_X, + Bundling_kv3_v1_FULL_Y, + Bundling_kv3_v1_LITE, + Bundling_kv3_v1_LITE_X, + Bundling_kv3_v1_LITE_Y, + Bundling_kv3_v1_MAU, + Bundling_kv3_v1_MAU_X, + Bundling_kv3_v1_MAU_Y, + Bundling_kv3_v1_LSU, + Bundling_kv3_v1_LSU_X, + Bundling_kv3_v1_LSU_Y, + Bundling_kv3_v1_TINY, + Bundling_kv3_v1_TINY_X, + Bundling_kv3_v1_TINY_Y, + Bundling_kv3_v1_NOP, +} Bundling_kv3_v1; + + +static const char *bundling_kv3_v1_names(Bundling_kv3_v1 bundling) __attribute__((unused)); +static const char *bundling_kv3_v1_names(Bundling_kv3_v1 bundling) { + switch(bundling) { + case Bundling_kv3_v1_ALL: return "Bundling_kv3_v1_ALL"; + case Bundling_kv3_v1_BCU: return "Bundling_kv3_v1_BCU"; + case Bundling_kv3_v1_TCA: return "Bundling_kv3_v1_TCA"; + case Bundling_kv3_v1_FULL: return "Bundling_kv3_v1_FULL"; + case Bundling_kv3_v1_FULL_X: return "Bundling_kv3_v1_FULL_X"; + case Bundling_kv3_v1_FULL_Y: return "Bundling_kv3_v1_FULL_Y"; + case Bundling_kv3_v1_LITE: return "Bundling_kv3_v1_LITE"; + case Bundling_kv3_v1_LITE_X: return "Bundling_kv3_v1_LITE_X"; + case Bundling_kv3_v1_LITE_Y: return "Bundling_kv3_v1_LITE_Y"; + case Bundling_kv3_v1_MAU: return "Bundling_kv3_v1_MAU"; + case Bundling_kv3_v1_MAU_X: return "Bundling_kv3_v1_MAU_X"; + case Bundling_kv3_v1_MAU_Y: return "Bundling_kv3_v1_MAU_Y"; + case Bundling_kv3_v1_LSU: return "Bundling_kv3_v1_LSU"; + case Bundling_kv3_v1_LSU_X: return "Bundling_kv3_v1_LSU_X"; + case Bundling_kv3_v1_LSU_Y: return "Bundling_kv3_v1_LSU_Y"; + case Bundling_kv3_v1_TINY: return "Bundling_kv3_v1_TINY"; + case Bundling_kv3_v1_TINY_X: return "Bundling_kv3_v1_TINY_X"; + case Bundling_kv3_v1_TINY_Y: return "Bundling_kv3_v1_TINY_Y"; + case Bundling_kv3_v1_NOP: return "Bundling_kv3_v1_NOP"; + }; + return "unknown bundling"; +}; + +/* Resources list */ +#define Resource_kv3_v1_ISSUE 0 +#define Resource_kv3_v1_TINY 1 +#define Resource_kv3_v1_LITE 2 +#define Resource_kv3_v1_FULL 3 +#define Resource_kv3_v1_LSU 4 +#define Resource_kv3_v1_MAU 5 +#define Resource_kv3_v1_BCU 6 +#define Resource_kv3_v1_TCA 7 +#define Resource_kv3_v1_AUXR 8 +#define Resource_kv3_v1_AUXW 9 +#define Resource_kv3_v1_CRRP 10 +#define Resource_kv3_v1_CRWL 11 +#define Resource_kv3_v1_CRWH 12 +#define Resource_kv3_v1_NOP 13 +#define kvx_kv3_v1_RESOURCE_MAX 14 + + +/* Reservations list */ +#define Reservation_kv3_v1_ALL 0 +#define Reservation_kv3_v1_ALU_NOP 1 +#define Reservation_kv3_v1_ALU_TINY 2 +#define Reservation_kv3_v1_ALU_TINY_X 3 +#define Reservation_kv3_v1_ALU_TINY_Y 4 +#define Reservation_kv3_v1_ALU_LITE 5 +#define Reservation_kv3_v1_ALU_LITE_X 6 +#define Reservation_kv3_v1_ALU_LITE_Y 7 +#define Reservation_kv3_v1_ALU_LITE_CRWL 8 +#define Reservation_kv3_v1_ALU_LITE_CRWH 9 +#define Reservation_kv3_v1_ALU_FULL 10 +#define Reservation_kv3_v1_ALU_FULL_X 11 +#define Reservation_kv3_v1_ALU_FULL_Y 12 +#define Reservation_kv3_v1_BCU 13 +#define Reservation_kv3_v1_BCU_CRRP_CRWL_CRWH 14 +#define Reservation_kv3_v1_BCU_TINY_AUXW_CRRP 15 +#define Reservation_kv3_v1_BCU_TINY_TINY_MAU_XNOP 16 +#define Reservation_kv3_v1_TCA 17 +#define Reservation_kv3_v1_LSU 18 +#define Reservation_kv3_v1_LSU_X 19 +#define Reservation_kv3_v1_LSU_Y 20 +#define Reservation_kv3_v1_LSU_CRRP 21 +#define Reservation_kv3_v1_LSU_CRRP_X 22 +#define Reservation_kv3_v1_LSU_CRRP_Y 23 +#define Reservation_kv3_v1_LSU_AUXR 24 +#define Reservation_kv3_v1_LSU_AUXR_X 25 +#define Reservation_kv3_v1_LSU_AUXR_Y 26 +#define Reservation_kv3_v1_LSU_AUXW 27 +#define Reservation_kv3_v1_LSU_AUXW_X 28 +#define Reservation_kv3_v1_LSU_AUXW_Y 29 +#define Reservation_kv3_v1_LSU_AUXR_AUXW 30 +#define Reservation_kv3_v1_LSU_AUXR_AUXW_X 31 +#define Reservation_kv3_v1_LSU_AUXR_AUXW_Y 32 +#define Reservation_kv3_v1_MAU 33 +#define Reservation_kv3_v1_MAU_X 34 +#define Reservation_kv3_v1_MAU_Y 35 +#define Reservation_kv3_v1_MAU_AUXR 36 +#define Reservation_kv3_v1_MAU_AUXR_X 37 +#define Reservation_kv3_v1_MAU_AUXR_Y 38 + + +extern struct kvx_reloc kv3_v1_rel16_reloc; +extern struct kvx_reloc kv3_v1_rel32_reloc; +extern struct kvx_reloc kv3_v1_rel64_reloc; +extern struct kvx_reloc kv3_v1_pcrel_signed16_reloc; +extern struct kvx_reloc kv3_v1_pcrel17_reloc; +extern struct kvx_reloc kv3_v1_pcrel27_reloc; +extern struct kvx_reloc kv3_v1_pcrel32_reloc; +extern struct kvx_reloc kv3_v1_pcrel_signed37_reloc; +extern struct kvx_reloc kv3_v1_pcrel_signed43_reloc; +extern struct kvx_reloc kv3_v1_pcrel_signed64_reloc; +extern struct kvx_reloc kv3_v1_pcrel64_reloc; +extern struct kvx_reloc kv3_v1_signed16_reloc; +extern struct kvx_reloc kv3_v1_signed32_reloc; +extern struct kvx_reloc kv3_v1_signed37_reloc; +extern struct kvx_reloc kv3_v1_gotoff_signed37_reloc; +extern struct kvx_reloc kv3_v1_gotoff_signed43_reloc; +extern struct kvx_reloc kv3_v1_gotoff_32_reloc; +extern struct kvx_reloc kv3_v1_gotoff_64_reloc; +extern struct kvx_reloc kv3_v1_got_32_reloc; +extern struct kvx_reloc kv3_v1_got_signed37_reloc; +extern struct kvx_reloc kv3_v1_got_signed43_reloc; +extern struct kvx_reloc kv3_v1_got_64_reloc; +extern struct kvx_reloc kv3_v1_glob_dat_reloc; +extern struct kvx_reloc kv3_v1_copy_reloc; +extern struct kvx_reloc kv3_v1_jump_slot_reloc; +extern struct kvx_reloc kv3_v1_relative_reloc; +extern struct kvx_reloc kv3_v1_signed43_reloc; +extern struct kvx_reloc kv3_v1_signed64_reloc; +extern struct kvx_reloc kv3_v1_gotaddr_signed37_reloc; +extern struct kvx_reloc kv3_v1_gotaddr_signed43_reloc; +extern struct kvx_reloc kv3_v1_gotaddr_signed64_reloc; +extern struct kvx_reloc kv3_v1_dtpmod64_reloc; +extern struct kvx_reloc kv3_v1_dtpoff64_reloc; +extern struct kvx_reloc kv3_v1_dtpoff_signed37_reloc; +extern struct kvx_reloc kv3_v1_dtpoff_signed43_reloc; +extern struct kvx_reloc kv3_v1_tlsgd_signed37_reloc; +extern struct kvx_reloc kv3_v1_tlsgd_signed43_reloc; +extern struct kvx_reloc kv3_v1_tlsld_signed37_reloc; +extern struct kvx_reloc kv3_v1_tlsld_signed43_reloc; +extern struct kvx_reloc kv3_v1_tpoff64_reloc; +extern struct kvx_reloc kv3_v1_tlsie_signed37_reloc; +extern struct kvx_reloc kv3_v1_tlsie_signed43_reloc; +extern struct kvx_reloc kv3_v1_tlsle_signed37_reloc; +extern struct kvx_reloc kv3_v1_tlsle_signed43_reloc; +extern struct kvx_reloc kv3_v1_rel8_reloc; + +#define KVX_REGFILE_FIRST_GPR 0 +#define KVX_REGFILE_LAST_GPR 1 +#define KVX_REGFILE_DEC_GPR 2 +#define KVX_REGFILE_FIRST_PGR 3 +#define KVX_REGFILE_LAST_PGR 4 +#define KVX_REGFILE_DEC_PGR 5 +#define KVX_REGFILE_FIRST_QGR 6 +#define KVX_REGFILE_LAST_QGR 7 +#define KVX_REGFILE_DEC_QGR 8 +#define KVX_REGFILE_FIRST_SFR 9 +#define KVX_REGFILE_LAST_SFR 10 +#define KVX_REGFILE_DEC_SFR 11 +#define KVX_REGFILE_FIRST_X16R 12 +#define KVX_REGFILE_LAST_X16R 13 +#define KVX_REGFILE_DEC_X16R 14 +#define KVX_REGFILE_FIRST_X2R 15 +#define KVX_REGFILE_LAST_X2R 16 +#define KVX_REGFILE_DEC_X2R 17 +#define KVX_REGFILE_FIRST_X32R 18 +#define KVX_REGFILE_LAST_X32R 19 +#define KVX_REGFILE_DEC_X32R 20 +#define KVX_REGFILE_FIRST_X4R 21 +#define KVX_REGFILE_LAST_X4R 22 +#define KVX_REGFILE_DEC_X4R 23 +#define KVX_REGFILE_FIRST_X64R 24 +#define KVX_REGFILE_LAST_X64R 25 +#define KVX_REGFILE_DEC_X64R 26 +#define KVX_REGFILE_FIRST_X8R 27 +#define KVX_REGFILE_LAST_X8R 28 +#define KVX_REGFILE_DEC_X8R 29 +#define KVX_REGFILE_FIRST_XBR 30 +#define KVX_REGFILE_LAST_XBR 31 +#define KVX_REGFILE_DEC_XBR 32 +#define KVX_REGFILE_FIRST_XCR 33 +#define KVX_REGFILE_LAST_XCR 34 +#define KVX_REGFILE_DEC_XCR 35 +#define KVX_REGFILE_FIRST_XMR 36 +#define KVX_REGFILE_LAST_XMR 37 +#define KVX_REGFILE_DEC_XMR 38 +#define KVX_REGFILE_FIRST_XTR 39 +#define KVX_REGFILE_LAST_XTR 40 +#define KVX_REGFILE_DEC_XTR 41 +#define KVX_REGFILE_FIRST_XVR 42 +#define KVX_REGFILE_LAST_XVR 43 +#define KVX_REGFILE_DEC_XVR 44 +#define KVX_REGFILE_REGISTERS 45 +#define KVX_REGFILE_DEC_REGISTERS 46 + + +extern int kvx_kv3_v2_regfiles[]; +extern const char **kvx_kv3_v2_modifiers[]; +extern struct kvx_Register kvx_kv3_v2_registers[]; + +extern int kvx_kv3_v2_dec_registers[]; + +enum Method_kvx_kv3_v2_enum { + Immediate_kv3_v2_brknumber = 1, + Immediate_kv3_v2_pcrel17 = 2, + Immediate_kv3_v2_pcrel27 = 3, + Immediate_kv3_v2_signed10 = 4, + Immediate_kv3_v2_signed16 = 5, + Immediate_kv3_v2_signed27 = 6, + Immediate_kv3_v2_signed37 = 7, + Immediate_kv3_v2_signed43 = 8, + Immediate_kv3_v2_signed54 = 9, + Immediate_kv3_v2_sysnumber = 10, + Immediate_kv3_v2_unsigned6 = 11, + Immediate_kv3_v2_wrapped32 = 12, + Immediate_kv3_v2_wrapped64 = 13, + Immediate_kv3_v2_wrapped8 = 14, + Modifier_kv3_v2_accesses = 15, + Modifier_kv3_v2_boolcas = 16, + Modifier_kv3_v2_cachelev = 17, + Modifier_kv3_v2_channel = 18, + Modifier_kv3_v2_coherency = 19, + Modifier_kv3_v2_comparison = 20, + Modifier_kv3_v2_conjugate = 21, + Modifier_kv3_v2_doscale = 22, + Modifier_kv3_v2_exunum = 23, + Modifier_kv3_v2_floatcomp = 24, + Modifier_kv3_v2_hindex = 25, + Modifier_kv3_v2_lsomask = 26, + Modifier_kv3_v2_lsumask = 27, + Modifier_kv3_v2_lsupack = 28, + Modifier_kv3_v2_qindex = 29, + Modifier_kv3_v2_rounding = 30, + Modifier_kv3_v2_scalarcond = 31, + Modifier_kv3_v2_shuffleV = 32, + Modifier_kv3_v2_shuffleX = 33, + Modifier_kv3_v2_silent = 34, + Modifier_kv3_v2_simplecond = 35, + Modifier_kv3_v2_speculate = 36, + Modifier_kv3_v2_splat32 = 37, + Modifier_kv3_v2_transpose = 38, + Modifier_kv3_v2_variant = 39, + RegClass_kv3_v2_aloneReg = 40, + RegClass_kv3_v2_blockReg = 41, + RegClass_kv3_v2_blockRegE = 42, + RegClass_kv3_v2_blockRegO = 43, + RegClass_kv3_v2_blockReg_0 = 44, + RegClass_kv3_v2_blockReg_1 = 45, + RegClass_kv3_v2_buffer16Reg = 46, + RegClass_kv3_v2_buffer2Reg = 47, + RegClass_kv3_v2_buffer32Reg = 48, + RegClass_kv3_v2_buffer4Reg = 49, + RegClass_kv3_v2_buffer64Reg = 50, + RegClass_kv3_v2_buffer8Reg = 51, + RegClass_kv3_v2_coproReg = 52, + RegClass_kv3_v2_coproReg0M4 = 53, + RegClass_kv3_v2_coproReg1M4 = 54, + RegClass_kv3_v2_coproReg2M4 = 55, + RegClass_kv3_v2_coproReg3M4 = 56, + RegClass_kv3_v2_matrixReg = 57, + RegClass_kv3_v2_matrixReg_0 = 58, + RegClass_kv3_v2_matrixReg_1 = 59, + RegClass_kv3_v2_matrixReg_2 = 60, + RegClass_kv3_v2_matrixReg_3 = 61, + RegClass_kv3_v2_onlyfxReg = 62, + RegClass_kv3_v2_onlygetReg = 63, + RegClass_kv3_v2_onlyraReg = 64, + RegClass_kv3_v2_onlysetReg = 65, + RegClass_kv3_v2_onlyswapReg = 66, + RegClass_kv3_v2_pairedReg = 67, + RegClass_kv3_v2_pairedReg_0 = 68, + RegClass_kv3_v2_pairedReg_1 = 69, + RegClass_kv3_v2_quadReg = 70, + RegClass_kv3_v2_quadReg_0 = 71, + RegClass_kv3_v2_quadReg_1 = 72, + RegClass_kv3_v2_quadReg_2 = 73, + RegClass_kv3_v2_quadReg_3 = 74, + RegClass_kv3_v2_singleReg = 75, + RegClass_kv3_v2_systemReg = 76, + RegClass_kv3_v2_tileReg = 77, + RegClass_kv3_v2_tileReg_0 = 78, + RegClass_kv3_v2_tileReg_1 = 79, + RegClass_kv3_v2_vectorReg = 80, + RegClass_kv3_v2_vectorReg_0 = 81, + RegClass_kv3_v2_vectorReg_1 = 82, + RegClass_kv3_v2_vectorReg_2 = 83, + RegClass_kv3_v2_vectorReg_3 = 84, + Instruction_kv3_v2_abdbo = 85, + Instruction_kv3_v2_abdd = 86, + Instruction_kv3_v2_abdd_abase = 87, + Instruction_kv3_v2_abdhq = 88, + Instruction_kv3_v2_abdsbo = 89, + Instruction_kv3_v2_abdsd = 90, + Instruction_kv3_v2_abdshq = 91, + Instruction_kv3_v2_abdsw = 92, + Instruction_kv3_v2_abdswp = 93, + Instruction_kv3_v2_abdubo = 94, + Instruction_kv3_v2_abdud = 95, + Instruction_kv3_v2_abduhq = 96, + Instruction_kv3_v2_abduw = 97, + Instruction_kv3_v2_abduwp = 98, + Instruction_kv3_v2_abdw = 99, + Instruction_kv3_v2_abdwp = 100, + Instruction_kv3_v2_absbo = 101, + Instruction_kv3_v2_absd = 102, + Instruction_kv3_v2_abshq = 103, + Instruction_kv3_v2_abssbo = 104, + Instruction_kv3_v2_abssd = 105, + Instruction_kv3_v2_absshq = 106, + Instruction_kv3_v2_abssw = 107, + Instruction_kv3_v2_absswp = 108, + Instruction_kv3_v2_absw = 109, + Instruction_kv3_v2_abswp = 110, + Instruction_kv3_v2_acswapd = 111, + Instruction_kv3_v2_acswapq = 112, + Instruction_kv3_v2_acswapw = 113, + Instruction_kv3_v2_addbo = 114, + Instruction_kv3_v2_addcd = 115, + Instruction_kv3_v2_addcd_i = 116, + Instruction_kv3_v2_addd = 117, + Instruction_kv3_v2_addd_abase = 118, + Instruction_kv3_v2_addhq = 119, + Instruction_kv3_v2_addrbod = 120, + Instruction_kv3_v2_addrhqd = 121, + Instruction_kv3_v2_addrwpd = 122, + Instruction_kv3_v2_addsbo = 123, + Instruction_kv3_v2_addsd = 124, + Instruction_kv3_v2_addshq = 125, + Instruction_kv3_v2_addsw = 126, + Instruction_kv3_v2_addswp = 127, + Instruction_kv3_v2_addurbod = 128, + Instruction_kv3_v2_addurhqd = 129, + Instruction_kv3_v2_addurwpd = 130, + Instruction_kv3_v2_addusbo = 131, + Instruction_kv3_v2_addusd = 132, + Instruction_kv3_v2_addushq = 133, + Instruction_kv3_v2_addusw = 134, + Instruction_kv3_v2_adduswp = 135, + Instruction_kv3_v2_adduwd = 136, + Instruction_kv3_v2_addw = 137, + Instruction_kv3_v2_addwd = 138, + Instruction_kv3_v2_addwp = 139, + Instruction_kv3_v2_addx16bo = 140, + Instruction_kv3_v2_addx16d = 141, + Instruction_kv3_v2_addx16hq = 142, + Instruction_kv3_v2_addx16uwd = 143, + Instruction_kv3_v2_addx16w = 144, + Instruction_kv3_v2_addx16wd = 145, + Instruction_kv3_v2_addx16wp = 146, + Instruction_kv3_v2_addx2bo = 147, + Instruction_kv3_v2_addx2d = 148, + Instruction_kv3_v2_addx2hq = 149, + Instruction_kv3_v2_addx2uwd = 150, + Instruction_kv3_v2_addx2w = 151, + Instruction_kv3_v2_addx2wd = 152, + Instruction_kv3_v2_addx2wp = 153, + Instruction_kv3_v2_addx32d = 154, + Instruction_kv3_v2_addx32uwd = 155, + Instruction_kv3_v2_addx32w = 156, + Instruction_kv3_v2_addx32wd = 157, + Instruction_kv3_v2_addx4bo = 158, + Instruction_kv3_v2_addx4d = 159, + Instruction_kv3_v2_addx4hq = 160, + Instruction_kv3_v2_addx4uwd = 161, + Instruction_kv3_v2_addx4w = 162, + Instruction_kv3_v2_addx4wd = 163, + Instruction_kv3_v2_addx4wp = 164, + Instruction_kv3_v2_addx64d = 165, + Instruction_kv3_v2_addx64uwd = 166, + Instruction_kv3_v2_addx64w = 167, + Instruction_kv3_v2_addx64wd = 168, + Instruction_kv3_v2_addx8bo = 169, + Instruction_kv3_v2_addx8d = 170, + Instruction_kv3_v2_addx8hq = 171, + Instruction_kv3_v2_addx8uwd = 172, + Instruction_kv3_v2_addx8w = 173, + Instruction_kv3_v2_addx8wd = 174, + Instruction_kv3_v2_addx8wp = 175, + Instruction_kv3_v2_aladdd = 176, + Instruction_kv3_v2_aladdw = 177, + Instruction_kv3_v2_alclrd = 178, + Instruction_kv3_v2_alclrw = 179, + Instruction_kv3_v2_ald = 180, + Instruction_kv3_v2_alw = 181, + Instruction_kv3_v2_andd = 182, + Instruction_kv3_v2_andd_abase = 183, + Instruction_kv3_v2_andnd = 184, + Instruction_kv3_v2_andnd_abase = 185, + Instruction_kv3_v2_andnw = 186, + Instruction_kv3_v2_andrbod = 187, + Instruction_kv3_v2_andrhqd = 188, + Instruction_kv3_v2_andrwpd = 189, + Instruction_kv3_v2_andw = 190, + Instruction_kv3_v2_asd = 191, + Instruction_kv3_v2_asw = 192, + Instruction_kv3_v2_avgbo = 193, + Instruction_kv3_v2_avghq = 194, + Instruction_kv3_v2_avgrbo = 195, + Instruction_kv3_v2_avgrhq = 196, + Instruction_kv3_v2_avgrubo = 197, + Instruction_kv3_v2_avgruhq = 198, + Instruction_kv3_v2_avgruw = 199, + Instruction_kv3_v2_avgruwp = 200, + Instruction_kv3_v2_avgrw = 201, + Instruction_kv3_v2_avgrwp = 202, + Instruction_kv3_v2_avgubo = 203, + Instruction_kv3_v2_avguhq = 204, + Instruction_kv3_v2_avguw = 205, + Instruction_kv3_v2_avguwp = 206, + Instruction_kv3_v2_avgw = 207, + Instruction_kv3_v2_avgwp = 208, + Instruction_kv3_v2_await = 209, + Instruction_kv3_v2_barrier = 210, + Instruction_kv3_v2_break = 211, + Instruction_kv3_v2_call = 212, + Instruction_kv3_v2_cb = 213, + Instruction_kv3_v2_cbsd = 214, + Instruction_kv3_v2_cbsw = 215, + Instruction_kv3_v2_cbswp = 216, + Instruction_kv3_v2_clrf = 217, + Instruction_kv3_v2_clsd = 218, + Instruction_kv3_v2_clsw = 219, + Instruction_kv3_v2_clswp = 220, + Instruction_kv3_v2_clzd = 221, + Instruction_kv3_v2_clzw = 222, + Instruction_kv3_v2_clzwp = 223, + Instruction_kv3_v2_cmovebo = 224, + Instruction_kv3_v2_cmoved = 225, + Instruction_kv3_v2_cmovehq = 226, + Instruction_kv3_v2_cmovewp = 227, + Instruction_kv3_v2_cmuldt = 228, + Instruction_kv3_v2_cmulghxdt = 229, + Instruction_kv3_v2_cmulglxdt = 230, + Instruction_kv3_v2_cmulgmxdt = 231, + Instruction_kv3_v2_cmulxdt = 232, + Instruction_kv3_v2_compd = 233, + Instruction_kv3_v2_compnbo = 234, + Instruction_kv3_v2_compnd = 235, + Instruction_kv3_v2_compnhq = 236, + Instruction_kv3_v2_compnw = 237, + Instruction_kv3_v2_compnwp = 238, + Instruction_kv3_v2_compuwd = 239, + Instruction_kv3_v2_compw = 240, + Instruction_kv3_v2_compwd = 241, + Instruction_kv3_v2_copyd = 242, + Instruction_kv3_v2_copyo = 243, + Instruction_kv3_v2_copyq = 244, + Instruction_kv3_v2_copyw = 245, + Instruction_kv3_v2_crcbellw = 246, + Instruction_kv3_v2_crcbelmw = 247, + Instruction_kv3_v2_crclellw = 248, + Instruction_kv3_v2_crclelmw = 249, + Instruction_kv3_v2_ctzd = 250, + Instruction_kv3_v2_ctzw = 251, + Instruction_kv3_v2_ctzwp = 252, + Instruction_kv3_v2_d1inval = 253, + Instruction_kv3_v2_dflushl = 254, + Instruction_kv3_v2_dflushsw = 255, + Instruction_kv3_v2_dinvall = 256, + Instruction_kv3_v2_dinvalsw = 257, + Instruction_kv3_v2_dot2suwd = 258, + Instruction_kv3_v2_dot2suwdp = 259, + Instruction_kv3_v2_dot2uwd = 260, + Instruction_kv3_v2_dot2uwdp = 261, + Instruction_kv3_v2_dot2w = 262, + Instruction_kv3_v2_dot2wd = 263, + Instruction_kv3_v2_dot2wdp = 264, + Instruction_kv3_v2_dot2wzp = 265, + Instruction_kv3_v2_dpurgel = 266, + Instruction_kv3_v2_dpurgesw = 267, + Instruction_kv3_v2_dtouchl = 268, + Instruction_kv3_v2_errop = 269, + Instruction_kv3_v2_extfs = 270, + Instruction_kv3_v2_extfz = 271, + Instruction_kv3_v2_fabsd = 272, + Instruction_kv3_v2_fabshq = 273, + Instruction_kv3_v2_fabsw = 274, + Instruction_kv3_v2_fabswp = 275, + Instruction_kv3_v2_faddd = 276, + Instruction_kv3_v2_fadddc = 277, + Instruction_kv3_v2_fadddc_c = 278, + Instruction_kv3_v2_fadddp = 279, + Instruction_kv3_v2_faddho = 280, + Instruction_kv3_v2_faddhq = 281, + Instruction_kv3_v2_faddw = 282, + Instruction_kv3_v2_faddwc = 283, + Instruction_kv3_v2_faddwc_c = 284, + Instruction_kv3_v2_faddwcp = 285, + Instruction_kv3_v2_faddwcp_c = 286, + Instruction_kv3_v2_faddwp = 287, + Instruction_kv3_v2_faddwq = 288, + Instruction_kv3_v2_fcdivd = 289, + Instruction_kv3_v2_fcdivw = 290, + Instruction_kv3_v2_fcdivwp = 291, + Instruction_kv3_v2_fcompd = 292, + Instruction_kv3_v2_fcompnd = 293, + Instruction_kv3_v2_fcompnhq = 294, + Instruction_kv3_v2_fcompnw = 295, + Instruction_kv3_v2_fcompnwp = 296, + Instruction_kv3_v2_fcompw = 297, + Instruction_kv3_v2_fdot2w = 298, + Instruction_kv3_v2_fdot2wd = 299, + Instruction_kv3_v2_fdot2wdp = 300, + Instruction_kv3_v2_fdot2wzp = 301, + Instruction_kv3_v2_fence = 302, + Instruction_kv3_v2_ffdmasw = 303, + Instruction_kv3_v2_ffdmaswp = 304, + Instruction_kv3_v2_ffdmaswq = 305, + Instruction_kv3_v2_ffdmaw = 306, + Instruction_kv3_v2_ffdmawp = 307, + Instruction_kv3_v2_ffdmawq = 308, + Instruction_kv3_v2_ffdmdaw = 309, + Instruction_kv3_v2_ffdmdawp = 310, + Instruction_kv3_v2_ffdmdawq = 311, + Instruction_kv3_v2_ffdmdsw = 312, + Instruction_kv3_v2_ffdmdswp = 313, + Instruction_kv3_v2_ffdmdswq = 314, + Instruction_kv3_v2_ffdmsaw = 315, + Instruction_kv3_v2_ffdmsawp = 316, + Instruction_kv3_v2_ffdmsawq = 317, + Instruction_kv3_v2_ffdmsw = 318, + Instruction_kv3_v2_ffdmswp = 319, + Instruction_kv3_v2_ffdmswq = 320, + Instruction_kv3_v2_ffmad = 321, + Instruction_kv3_v2_ffmaho = 322, + Instruction_kv3_v2_ffmahq = 323, + Instruction_kv3_v2_ffmahw = 324, + Instruction_kv3_v2_ffmahwq = 325, + Instruction_kv3_v2_ffmaw = 326, + Instruction_kv3_v2_ffmawc = 327, + Instruction_kv3_v2_ffmawcp = 328, + Instruction_kv3_v2_ffmawd = 329, + Instruction_kv3_v2_ffmawdp = 330, + Instruction_kv3_v2_ffmawp = 331, + Instruction_kv3_v2_ffmawq = 332, + Instruction_kv3_v2_ffmsd = 333, + Instruction_kv3_v2_ffmsho = 334, + Instruction_kv3_v2_ffmshq = 335, + Instruction_kv3_v2_ffmshw = 336, + Instruction_kv3_v2_ffmshwq = 337, + Instruction_kv3_v2_ffmsw = 338, + Instruction_kv3_v2_ffmswc = 339, + Instruction_kv3_v2_ffmswcp = 340, + Instruction_kv3_v2_ffmswd = 341, + Instruction_kv3_v2_ffmswdp = 342, + Instruction_kv3_v2_ffmswp = 343, + Instruction_kv3_v2_ffmswq = 344, + Instruction_kv3_v2_fixedd = 345, + Instruction_kv3_v2_fixedud = 346, + Instruction_kv3_v2_fixeduw = 347, + Instruction_kv3_v2_fixeduwp = 348, + Instruction_kv3_v2_fixedw = 349, + Instruction_kv3_v2_fixedwp = 350, + Instruction_kv3_v2_floatd = 351, + Instruction_kv3_v2_floatud = 352, + Instruction_kv3_v2_floatuw = 353, + Instruction_kv3_v2_floatuwp = 354, + Instruction_kv3_v2_floatw = 355, + Instruction_kv3_v2_floatwp = 356, + Instruction_kv3_v2_fmaxd = 357, + Instruction_kv3_v2_fmaxhq = 358, + Instruction_kv3_v2_fmaxw = 359, + Instruction_kv3_v2_fmaxwp = 360, + Instruction_kv3_v2_fmind = 361, + Instruction_kv3_v2_fminhq = 362, + Instruction_kv3_v2_fminw = 363, + Instruction_kv3_v2_fminwp = 364, + Instruction_kv3_v2_fmm212w = 365, + Instruction_kv3_v2_fmm222w = 366, + Instruction_kv3_v2_fmma212w = 367, + Instruction_kv3_v2_fmma222w = 368, + Instruction_kv3_v2_fmms212w = 369, + Instruction_kv3_v2_fmms222w = 370, + Instruction_kv3_v2_fmuld = 371, + Instruction_kv3_v2_fmulho = 372, + Instruction_kv3_v2_fmulhq = 373, + Instruction_kv3_v2_fmulhw = 374, + Instruction_kv3_v2_fmulhwq = 375, + Instruction_kv3_v2_fmulw = 376, + Instruction_kv3_v2_fmulwc = 377, + Instruction_kv3_v2_fmulwcp = 378, + Instruction_kv3_v2_fmulwd = 379, + Instruction_kv3_v2_fmulwdp = 380, + Instruction_kv3_v2_fmulwp = 381, + Instruction_kv3_v2_fmulwq = 382, + Instruction_kv3_v2_fnarrowdw = 383, + Instruction_kv3_v2_fnarrowdwp = 384, + Instruction_kv3_v2_fnarrowwh = 385, + Instruction_kv3_v2_fnarrowwhq = 386, + Instruction_kv3_v2_fnegd = 387, + Instruction_kv3_v2_fneghq = 388, + Instruction_kv3_v2_fnegw = 389, + Instruction_kv3_v2_fnegwp = 390, + Instruction_kv3_v2_frecw = 391, + Instruction_kv3_v2_frsrw = 392, + Instruction_kv3_v2_fsbfd = 393, + Instruction_kv3_v2_fsbfdc = 394, + Instruction_kv3_v2_fsbfdc_c = 395, + Instruction_kv3_v2_fsbfdp = 396, + Instruction_kv3_v2_fsbfho = 397, + Instruction_kv3_v2_fsbfhq = 398, + Instruction_kv3_v2_fsbfw = 399, + Instruction_kv3_v2_fsbfwc = 400, + Instruction_kv3_v2_fsbfwc_c = 401, + Instruction_kv3_v2_fsbfwcp = 402, + Instruction_kv3_v2_fsbfwcp_c = 403, + Instruction_kv3_v2_fsbfwp = 404, + Instruction_kv3_v2_fsbfwq = 405, + Instruction_kv3_v2_fsdivd = 406, + Instruction_kv3_v2_fsdivw = 407, + Instruction_kv3_v2_fsdivwp = 408, + Instruction_kv3_v2_fsrecd = 409, + Instruction_kv3_v2_fsrecw = 410, + Instruction_kv3_v2_fsrecwp = 411, + Instruction_kv3_v2_fsrsrd = 412, + Instruction_kv3_v2_fsrsrw = 413, + Instruction_kv3_v2_fsrsrwp = 414, + Instruction_kv3_v2_fwidenlhw = 415, + Instruction_kv3_v2_fwidenlhwp = 416, + Instruction_kv3_v2_fwidenlwd = 417, + Instruction_kv3_v2_fwidenmhw = 418, + Instruction_kv3_v2_fwidenmhwp = 419, + Instruction_kv3_v2_fwidenmwd = 420, + Instruction_kv3_v2_get = 421, + Instruction_kv3_v2_goto = 422, + Instruction_kv3_v2_i1inval = 423, + Instruction_kv3_v2_i1invals = 424, + Instruction_kv3_v2_icall = 425, + Instruction_kv3_v2_iget = 426, + Instruction_kv3_v2_igoto = 427, + Instruction_kv3_v2_insf = 428, + Instruction_kv3_v2_landd = 429, + Instruction_kv3_v2_landw = 430, + Instruction_kv3_v2_lbs = 431, + Instruction_kv3_v2_lbz = 432, + Instruction_kv3_v2_ld = 433, + Instruction_kv3_v2_lhs = 434, + Instruction_kv3_v2_lhz = 435, + Instruction_kv3_v2_lnandd = 436, + Instruction_kv3_v2_lnandw = 437, + Instruction_kv3_v2_lnord = 438, + Instruction_kv3_v2_lnorw = 439, + Instruction_kv3_v2_lo = 440, + Instruction_kv3_v2_loopdo = 441, + Instruction_kv3_v2_lord = 442, + Instruction_kv3_v2_lorw = 443, + Instruction_kv3_v2_lq = 444, + Instruction_kv3_v2_lws = 445, + Instruction_kv3_v2_lwz = 446, + Instruction_kv3_v2_maddd = 447, + Instruction_kv3_v2_madddt = 448, + Instruction_kv3_v2_maddhq = 449, + Instruction_kv3_v2_maddhwq = 450, + Instruction_kv3_v2_maddmwq = 451, + Instruction_kv3_v2_maddsudt = 452, + Instruction_kv3_v2_maddsuhwq = 453, + Instruction_kv3_v2_maddsumwq = 454, + Instruction_kv3_v2_maddsuwd = 455, + Instruction_kv3_v2_maddsuwdp = 456, + Instruction_kv3_v2_maddudt = 457, + Instruction_kv3_v2_madduhwq = 458, + Instruction_kv3_v2_maddumwq = 459, + Instruction_kv3_v2_madduwd = 460, + Instruction_kv3_v2_madduwdp = 461, + Instruction_kv3_v2_madduzdt = 462, + Instruction_kv3_v2_maddw = 463, + Instruction_kv3_v2_maddwd = 464, + Instruction_kv3_v2_maddwdp = 465, + Instruction_kv3_v2_maddwp = 466, + Instruction_kv3_v2_maddwq = 467, + Instruction_kv3_v2_make = 468, + Instruction_kv3_v2_maxbo = 469, + Instruction_kv3_v2_maxd = 470, + Instruction_kv3_v2_maxd_abase = 471, + Instruction_kv3_v2_maxhq = 472, + Instruction_kv3_v2_maxrbod = 473, + Instruction_kv3_v2_maxrhqd = 474, + Instruction_kv3_v2_maxrwpd = 475, + Instruction_kv3_v2_maxubo = 476, + Instruction_kv3_v2_maxud = 477, + Instruction_kv3_v2_maxud_abase = 478, + Instruction_kv3_v2_maxuhq = 479, + Instruction_kv3_v2_maxurbod = 480, + Instruction_kv3_v2_maxurhqd = 481, + Instruction_kv3_v2_maxurwpd = 482, + Instruction_kv3_v2_maxuw = 483, + Instruction_kv3_v2_maxuwp = 484, + Instruction_kv3_v2_maxw = 485, + Instruction_kv3_v2_maxwp = 486, + Instruction_kv3_v2_minbo = 487, + Instruction_kv3_v2_mind = 488, + Instruction_kv3_v2_mind_abase = 489, + Instruction_kv3_v2_minhq = 490, + Instruction_kv3_v2_minrbod = 491, + Instruction_kv3_v2_minrhqd = 492, + Instruction_kv3_v2_minrwpd = 493, + Instruction_kv3_v2_minubo = 494, + Instruction_kv3_v2_minud = 495, + Instruction_kv3_v2_minud_abase = 496, + Instruction_kv3_v2_minuhq = 497, + Instruction_kv3_v2_minurbod = 498, + Instruction_kv3_v2_minurhqd = 499, + Instruction_kv3_v2_minurwpd = 500, + Instruction_kv3_v2_minuw = 501, + Instruction_kv3_v2_minuwp = 502, + Instruction_kv3_v2_minw = 503, + Instruction_kv3_v2_minwp = 504, + Instruction_kv3_v2_mm212w = 505, + Instruction_kv3_v2_mma212w = 506, + Instruction_kv3_v2_mms212w = 507, + Instruction_kv3_v2_msbfd = 508, + Instruction_kv3_v2_msbfdt = 509, + Instruction_kv3_v2_msbfhq = 510, + Instruction_kv3_v2_msbfhwq = 511, + Instruction_kv3_v2_msbfmwq = 512, + Instruction_kv3_v2_msbfsudt = 513, + Instruction_kv3_v2_msbfsuhwq = 514, + Instruction_kv3_v2_msbfsumwq = 515, + Instruction_kv3_v2_msbfsuwd = 516, + Instruction_kv3_v2_msbfsuwdp = 517, + Instruction_kv3_v2_msbfudt = 518, + Instruction_kv3_v2_msbfuhwq = 519, + Instruction_kv3_v2_msbfumwq = 520, + Instruction_kv3_v2_msbfuwd = 521, + Instruction_kv3_v2_msbfuwdp = 522, + Instruction_kv3_v2_msbfuzdt = 523, + Instruction_kv3_v2_msbfw = 524, + Instruction_kv3_v2_msbfwd = 525, + Instruction_kv3_v2_msbfwdp = 526, + Instruction_kv3_v2_msbfwp = 527, + Instruction_kv3_v2_msbfwq = 528, + Instruction_kv3_v2_muld = 529, + Instruction_kv3_v2_muldt = 530, + Instruction_kv3_v2_mulhq = 531, + Instruction_kv3_v2_mulhwq = 532, + Instruction_kv3_v2_mulmwq = 533, + Instruction_kv3_v2_mulsudt = 534, + Instruction_kv3_v2_mulsuhwq = 535, + Instruction_kv3_v2_mulsumwq = 536, + Instruction_kv3_v2_mulsuwd = 537, + Instruction_kv3_v2_mulsuwdp = 538, + Instruction_kv3_v2_muludt = 539, + Instruction_kv3_v2_muluhwq = 540, + Instruction_kv3_v2_mulumwq = 541, + Instruction_kv3_v2_muluwd = 542, + Instruction_kv3_v2_muluwdp = 543, + Instruction_kv3_v2_mulw = 544, + Instruction_kv3_v2_mulwd = 545, + Instruction_kv3_v2_mulwdp = 546, + Instruction_kv3_v2_mulwp = 547, + Instruction_kv3_v2_mulwq = 548, + Instruction_kv3_v2_nandd = 549, + Instruction_kv3_v2_nandd_abase = 550, + Instruction_kv3_v2_nandw = 551, + Instruction_kv3_v2_negbo = 552, + Instruction_kv3_v2_negd = 553, + Instruction_kv3_v2_neghq = 554, + Instruction_kv3_v2_negsbo = 555, + Instruction_kv3_v2_negsd = 556, + Instruction_kv3_v2_negshq = 557, + Instruction_kv3_v2_negsw = 558, + Instruction_kv3_v2_negswp = 559, + Instruction_kv3_v2_negw = 560, + Instruction_kv3_v2_negwp = 561, + Instruction_kv3_v2_nop = 562, + Instruction_kv3_v2_nord = 563, + Instruction_kv3_v2_nord_abase = 564, + Instruction_kv3_v2_norw = 565, + Instruction_kv3_v2_notd = 566, + Instruction_kv3_v2_notw = 567, + Instruction_kv3_v2_nxord = 568, + Instruction_kv3_v2_nxord_abase = 569, + Instruction_kv3_v2_nxorw = 570, + Instruction_kv3_v2_ord = 571, + Instruction_kv3_v2_ord_abase = 572, + Instruction_kv3_v2_ornd = 573, + Instruction_kv3_v2_ornd_abase = 574, + Instruction_kv3_v2_ornw = 575, + Instruction_kv3_v2_orrbod = 576, + Instruction_kv3_v2_orrhqd = 577, + Instruction_kv3_v2_orrwpd = 578, + Instruction_kv3_v2_orw = 579, + Instruction_kv3_v2_pcrel = 580, + Instruction_kv3_v2_ret = 581, + Instruction_kv3_v2_rfe = 582, + Instruction_kv3_v2_rolw = 583, + Instruction_kv3_v2_rolwps = 584, + Instruction_kv3_v2_rorw = 585, + Instruction_kv3_v2_rorwps = 586, + Instruction_kv3_v2_rswap = 587, + Instruction_kv3_v2_sb = 588, + Instruction_kv3_v2_sbfbo = 589, + Instruction_kv3_v2_sbfcd = 590, + Instruction_kv3_v2_sbfcd_i = 591, + Instruction_kv3_v2_sbfd = 592, + Instruction_kv3_v2_sbfd_abase = 593, + Instruction_kv3_v2_sbfhq = 594, + Instruction_kv3_v2_sbfsbo = 595, + Instruction_kv3_v2_sbfsd = 596, + Instruction_kv3_v2_sbfshq = 597, + Instruction_kv3_v2_sbfsw = 598, + Instruction_kv3_v2_sbfswp = 599, + Instruction_kv3_v2_sbfusbo = 600, + Instruction_kv3_v2_sbfusd = 601, + Instruction_kv3_v2_sbfushq = 602, + Instruction_kv3_v2_sbfusw = 603, + Instruction_kv3_v2_sbfuswp = 604, + Instruction_kv3_v2_sbfuwd = 605, + Instruction_kv3_v2_sbfw = 606, + Instruction_kv3_v2_sbfwd = 607, + Instruction_kv3_v2_sbfwp = 608, + Instruction_kv3_v2_sbfx16bo = 609, + Instruction_kv3_v2_sbfx16d = 610, + Instruction_kv3_v2_sbfx16hq = 611, + Instruction_kv3_v2_sbfx16uwd = 612, + Instruction_kv3_v2_sbfx16w = 613, + Instruction_kv3_v2_sbfx16wd = 614, + Instruction_kv3_v2_sbfx16wp = 615, + Instruction_kv3_v2_sbfx2bo = 616, + Instruction_kv3_v2_sbfx2d = 617, + Instruction_kv3_v2_sbfx2hq = 618, + Instruction_kv3_v2_sbfx2uwd = 619, + Instruction_kv3_v2_sbfx2w = 620, + Instruction_kv3_v2_sbfx2wd = 621, + Instruction_kv3_v2_sbfx2wp = 622, + Instruction_kv3_v2_sbfx32d = 623, + Instruction_kv3_v2_sbfx32uwd = 624, + Instruction_kv3_v2_sbfx32w = 625, + Instruction_kv3_v2_sbfx32wd = 626, + Instruction_kv3_v2_sbfx4bo = 627, + Instruction_kv3_v2_sbfx4d = 628, + Instruction_kv3_v2_sbfx4hq = 629, + Instruction_kv3_v2_sbfx4uwd = 630, + Instruction_kv3_v2_sbfx4w = 631, + Instruction_kv3_v2_sbfx4wd = 632, + Instruction_kv3_v2_sbfx4wp = 633, + Instruction_kv3_v2_sbfx64d = 634, + Instruction_kv3_v2_sbfx64uwd = 635, + Instruction_kv3_v2_sbfx64w = 636, + Instruction_kv3_v2_sbfx64wd = 637, + Instruction_kv3_v2_sbfx8bo = 638, + Instruction_kv3_v2_sbfx8d = 639, + Instruction_kv3_v2_sbfx8hq = 640, + Instruction_kv3_v2_sbfx8uwd = 641, + Instruction_kv3_v2_sbfx8w = 642, + Instruction_kv3_v2_sbfx8wd = 643, + Instruction_kv3_v2_sbfx8wp = 644, + Instruction_kv3_v2_sbmm8 = 645, + Instruction_kv3_v2_sbmm8_abase = 646, + Instruction_kv3_v2_sbmmt8 = 647, + Instruction_kv3_v2_sbmmt8_abase = 648, + Instruction_kv3_v2_scall = 649, + Instruction_kv3_v2_sd = 650, + Instruction_kv3_v2_set = 651, + Instruction_kv3_v2_sh = 652, + Instruction_kv3_v2_sleep = 653, + Instruction_kv3_v2_sllbos = 654, + Instruction_kv3_v2_slld = 655, + Instruction_kv3_v2_sllhqs = 656, + Instruction_kv3_v2_sllw = 657, + Instruction_kv3_v2_sllwps = 658, + Instruction_kv3_v2_slsbos = 659, + Instruction_kv3_v2_slsd = 660, + Instruction_kv3_v2_slshqs = 661, + Instruction_kv3_v2_slsw = 662, + Instruction_kv3_v2_slswps = 663, + Instruction_kv3_v2_slusbos = 664, + Instruction_kv3_v2_slusd = 665, + Instruction_kv3_v2_slushqs = 666, + Instruction_kv3_v2_slusw = 667, + Instruction_kv3_v2_sluswps = 668, + Instruction_kv3_v2_so = 669, + Instruction_kv3_v2_sq = 670, + Instruction_kv3_v2_srabos = 671, + Instruction_kv3_v2_srad = 672, + Instruction_kv3_v2_srahqs = 673, + Instruction_kv3_v2_sraw = 674, + Instruction_kv3_v2_srawps = 675, + Instruction_kv3_v2_srlbos = 676, + Instruction_kv3_v2_srld = 677, + Instruction_kv3_v2_srlhqs = 678, + Instruction_kv3_v2_srlw = 679, + Instruction_kv3_v2_srlwps = 680, + Instruction_kv3_v2_srsbos = 681, + Instruction_kv3_v2_srsd = 682, + Instruction_kv3_v2_srshqs = 683, + Instruction_kv3_v2_srsw = 684, + Instruction_kv3_v2_srswps = 685, + Instruction_kv3_v2_stop = 686, + Instruction_kv3_v2_stsud = 687, + Instruction_kv3_v2_stsuhq = 688, + Instruction_kv3_v2_stsuw = 689, + Instruction_kv3_v2_stsuwp = 690, + Instruction_kv3_v2_sw = 691, + Instruction_kv3_v2_sxbd = 692, + Instruction_kv3_v2_sxhd = 693, + Instruction_kv3_v2_sxlbhq = 694, + Instruction_kv3_v2_sxlhwp = 695, + Instruction_kv3_v2_sxmbhq = 696, + Instruction_kv3_v2_sxmhwp = 697, + Instruction_kv3_v2_sxwd = 698, + Instruction_kv3_v2_syncgroup = 699, + Instruction_kv3_v2_tlbdinval = 700, + Instruction_kv3_v2_tlbiinval = 701, + Instruction_kv3_v2_tlbprobe = 702, + Instruction_kv3_v2_tlbread = 703, + Instruction_kv3_v2_tlbwrite = 704, + Instruction_kv3_v2_waitit = 705, + Instruction_kv3_v2_wfxl = 706, + Instruction_kv3_v2_wfxm = 707, + Instruction_kv3_v2_xaccesso = 708, + Instruction_kv3_v2_xaligno = 709, + Instruction_kv3_v2_xandno = 710, + Instruction_kv3_v2_xando = 711, + Instruction_kv3_v2_xclampwo = 712, + Instruction_kv3_v2_xcopyo = 713, + Instruction_kv3_v2_xcopyv = 714, + Instruction_kv3_v2_xcopyx = 715, + Instruction_kv3_v2_xffma44hw = 716, + Instruction_kv3_v2_xfmaxhx = 717, + Instruction_kv3_v2_xfminhx = 718, + Instruction_kv3_v2_xfmma484hw = 719, + Instruction_kv3_v2_xfnarrow44wh = 720, + Instruction_kv3_v2_xfscalewo = 721, + Instruction_kv3_v2_xlo = 722, + Instruction_kv3_v2_xmadd44bw0 = 723, + Instruction_kv3_v2_xmadd44bw1 = 724, + Instruction_kv3_v2_xmaddifwo = 725, + Instruction_kv3_v2_xmaddsu44bw0 = 726, + Instruction_kv3_v2_xmaddsu44bw1 = 727, + Instruction_kv3_v2_xmaddu44bw0 = 728, + Instruction_kv3_v2_xmaddu44bw1 = 729, + Instruction_kv3_v2_xmma4164bw = 730, + Instruction_kv3_v2_xmma484bw = 731, + Instruction_kv3_v2_xmmasu4164bw = 732, + Instruction_kv3_v2_xmmasu484bw = 733, + Instruction_kv3_v2_xmmau4164bw = 734, + Instruction_kv3_v2_xmmau484bw = 735, + Instruction_kv3_v2_xmmaus4164bw = 736, + Instruction_kv3_v2_xmmaus484bw = 737, + Instruction_kv3_v2_xmovefd = 738, + Instruction_kv3_v2_xmovefo = 739, + Instruction_kv3_v2_xmovefq = 740, + Instruction_kv3_v2_xmovetd = 741, + Instruction_kv3_v2_xmovetq = 742, + Instruction_kv3_v2_xmsbfifwo = 743, + Instruction_kv3_v2_xmt44d = 744, + Instruction_kv3_v2_xnando = 745, + Instruction_kv3_v2_xnoro = 746, + Instruction_kv3_v2_xnxoro = 747, + Instruction_kv3_v2_xord = 748, + Instruction_kv3_v2_xord_abase = 749, + Instruction_kv3_v2_xorno = 750, + Instruction_kv3_v2_xoro = 751, + Instruction_kv3_v2_xorrbod = 752, + Instruction_kv3_v2_xorrhqd = 753, + Instruction_kv3_v2_xorrwpd = 754, + Instruction_kv3_v2_xorw = 755, + Instruction_kv3_v2_xrecvo = 756, + Instruction_kv3_v2_xsbmm8dq = 757, + Instruction_kv3_v2_xsbmmt8dq = 758, + Instruction_kv3_v2_xsendo = 759, + Instruction_kv3_v2_xsendrecvo = 760, + Instruction_kv3_v2_xso = 761, + Instruction_kv3_v2_xsplatdo = 762, + Instruction_kv3_v2_xsplatov = 763, + Instruction_kv3_v2_xsplatox = 764, + Instruction_kv3_v2_xsx48bw = 765, + Instruction_kv3_v2_xtrunc48wb = 766, + Instruction_kv3_v2_xxoro = 767, + Instruction_kv3_v2_xzx48bw = 768, + Instruction_kv3_v2_zxbd = 769, + Instruction_kv3_v2_zxhd = 770, + Instruction_kv3_v2_zxlbhq = 771, + Instruction_kv3_v2_zxlhwp = 772, + Instruction_kv3_v2_zxmbhq = 773, + Instruction_kv3_v2_zxmhwp = 774, + Instruction_kv3_v2_zxwd = 775, + Separator_kv3_v2_comma = 776, + Separator_kv3_v2_equal = 777, + Separator_kv3_v2_qmark = 778, + Separator_kv3_v2_rsbracket = 779, + Separator_kv3_v2_lsbracket = 780 +}; + +enum Modifier_kv3_v2_exunum_enum { + Modifier_kv3_v2_exunum_ALU0=0, + Modifier_kv3_v2_exunum_ALU1=1, + Modifier_kv3_v2_exunum_MAU=2, + Modifier_kv3_v2_exunum_LSU=3, +}; + +extern const char *mod_kv3_v2_exunum[]; +extern const char *mod_kv3_v2_scalarcond[]; +extern const char *mod_kv3_v2_lsomask[]; +extern const char *mod_kv3_v2_lsumask[]; +extern const char *mod_kv3_v2_lsupack[]; +extern const char *mod_kv3_v2_simplecond[]; +extern const char *mod_kv3_v2_comparison[]; +extern const char *mod_kv3_v2_floatcomp[]; +extern const char *mod_kv3_v2_rounding[]; +extern const char *mod_kv3_v2_silent[]; +extern const char *mod_kv3_v2_variant[]; +extern const char *mod_kv3_v2_speculate[]; +extern const char *mod_kv3_v2_doscale[]; +extern const char *mod_kv3_v2_qindex[]; +extern const char *mod_kv3_v2_hindex[]; +extern const char *mod_kv3_v2_cachelev[]; +extern const char *mod_kv3_v2_coherency[]; +extern const char *mod_kv3_v2_boolcas[]; +extern const char *mod_kv3_v2_accesses[]; +extern const char *mod_kv3_v2_channel[]; +extern const char *mod_kv3_v2_conjugate[]; +extern const char *mod_kv3_v2_transpose[]; +extern const char *mod_kv3_v2_shuffleV[]; +extern const char *mod_kv3_v2_shuffleX[]; +extern const char *mod_kv3_v2_splat32[]; +typedef enum { + Bundling_kv3_v2_ALL, + Bundling_kv3_v2_BCU, + Bundling_kv3_v2_TCA, + Bundling_kv3_v2_FULL, + Bundling_kv3_v2_FULL_X, + Bundling_kv3_v2_FULL_Y, + Bundling_kv3_v2_LITE, + Bundling_kv3_v2_LITE_X, + Bundling_kv3_v2_LITE_Y, + Bundling_kv3_v2_MAU, + Bundling_kv3_v2_MAU_X, + Bundling_kv3_v2_MAU_Y, + Bundling_kv3_v2_LSU, + Bundling_kv3_v2_LSU_X, + Bundling_kv3_v2_LSU_Y, + Bundling_kv3_v2_TINY, + Bundling_kv3_v2_TINY_X, + Bundling_kv3_v2_TINY_Y, + Bundling_kv3_v2_NOP, +} Bundling_kv3_v2; + + +static const char *bundling_kv3_v2_names(Bundling_kv3_v2 bundling) __attribute__((unused)); +static const char *bundling_kv3_v2_names(Bundling_kv3_v2 bundling) { + switch(bundling) { + case Bundling_kv3_v2_ALL: return "Bundling_kv3_v2_ALL"; + case Bundling_kv3_v2_BCU: return "Bundling_kv3_v2_BCU"; + case Bundling_kv3_v2_TCA: return "Bundling_kv3_v2_TCA"; + case Bundling_kv3_v2_FULL: return "Bundling_kv3_v2_FULL"; + case Bundling_kv3_v2_FULL_X: return "Bundling_kv3_v2_FULL_X"; + case Bundling_kv3_v2_FULL_Y: return "Bundling_kv3_v2_FULL_Y"; + case Bundling_kv3_v2_LITE: return "Bundling_kv3_v2_LITE"; + case Bundling_kv3_v2_LITE_X: return "Bundling_kv3_v2_LITE_X"; + case Bundling_kv3_v2_LITE_Y: return "Bundling_kv3_v2_LITE_Y"; + case Bundling_kv3_v2_MAU: return "Bundling_kv3_v2_MAU"; + case Bundling_kv3_v2_MAU_X: return "Bundling_kv3_v2_MAU_X"; + case Bundling_kv3_v2_MAU_Y: return "Bundling_kv3_v2_MAU_Y"; + case Bundling_kv3_v2_LSU: return "Bundling_kv3_v2_LSU"; + case Bundling_kv3_v2_LSU_X: return "Bundling_kv3_v2_LSU_X"; + case Bundling_kv3_v2_LSU_Y: return "Bundling_kv3_v2_LSU_Y"; + case Bundling_kv3_v2_TINY: return "Bundling_kv3_v2_TINY"; + case Bundling_kv3_v2_TINY_X: return "Bundling_kv3_v2_TINY_X"; + case Bundling_kv3_v2_TINY_Y: return "Bundling_kv3_v2_TINY_Y"; + case Bundling_kv3_v2_NOP: return "Bundling_kv3_v2_NOP"; + }; + return "unknown bundling"; +}; + +/* Resources list */ +#define Resource_kv3_v2_ISSUE 0 +#define Resource_kv3_v2_TINY 1 +#define Resource_kv3_v2_LITE 2 +#define Resource_kv3_v2_FULL 3 +#define Resource_kv3_v2_LSU 4 +#define Resource_kv3_v2_MAU 5 +#define Resource_kv3_v2_BCU 6 +#define Resource_kv3_v2_TCA 7 +#define Resource_kv3_v2_AUXR 8 +#define Resource_kv3_v2_AUXW 9 +#define Resource_kv3_v2_CRRP 10 +#define Resource_kv3_v2_CRWL 11 +#define Resource_kv3_v2_CRWH 12 +#define Resource_kv3_v2_NOP 13 +#define kvx_kv3_v2_RESOURCE_MAX 14 + + +/* Reservations list */ +#define Reservation_kv3_v2_ALL 0 +#define Reservation_kv3_v2_ALU_NOP 1 +#define Reservation_kv3_v2_ALU_TINY 2 +#define Reservation_kv3_v2_ALU_TINY_X 3 +#define Reservation_kv3_v2_ALU_TINY_Y 4 +#define Reservation_kv3_v2_ALU_TINY_CRRP 5 +#define Reservation_kv3_v2_ALU_TINY_CRWL_CRWH 6 +#define Reservation_kv3_v2_ALU_TINY_CRWL_CRWH_X 7 +#define Reservation_kv3_v2_ALU_TINY_CRWL_CRWH_Y 8 +#define Reservation_kv3_v2_ALU_TINY_CRRP_CRWL_CRWH 9 +#define Reservation_kv3_v2_ALU_TINY_CRWL 10 +#define Reservation_kv3_v2_ALU_TINY_CRWH 11 +#define Reservation_kv3_v2_ALU_LITE 12 +#define Reservation_kv3_v2_ALU_LITE_X 13 +#define Reservation_kv3_v2_ALU_LITE_Y 14 +#define Reservation_kv3_v2_ALU_LITE_CRWL 15 +#define Reservation_kv3_v2_ALU_LITE_CRWH 16 +#define Reservation_kv3_v2_ALU_FULL 17 +#define Reservation_kv3_v2_ALU_FULL_X 18 +#define Reservation_kv3_v2_ALU_FULL_Y 19 +#define Reservation_kv3_v2_BCU 20 +#define Reservation_kv3_v2_BCU_CRRP_CRWL_CRWH 21 +#define Reservation_kv3_v2_BCU_TINY_AUXW_CRRP 22 +#define Reservation_kv3_v2_BCU_TINY_TINY_MAU_XNOP 23 +#define Reservation_kv3_v2_TCA 24 +#define Reservation_kv3_v2_LSU 25 +#define Reservation_kv3_v2_LSU_X 26 +#define Reservation_kv3_v2_LSU_Y 27 +#define Reservation_kv3_v2_LSU_CRRP 28 +#define Reservation_kv3_v2_LSU_CRRP_X 29 +#define Reservation_kv3_v2_LSU_CRRP_Y 30 +#define Reservation_kv3_v2_LSU_AUXR 31 +#define Reservation_kv3_v2_LSU_AUXR_X 32 +#define Reservation_kv3_v2_LSU_AUXR_Y 33 +#define Reservation_kv3_v2_LSU_AUXW 34 +#define Reservation_kv3_v2_LSU_AUXW_X 35 +#define Reservation_kv3_v2_LSU_AUXW_Y 36 +#define Reservation_kv3_v2_LSU_AUXR_AUXW 37 +#define Reservation_kv3_v2_LSU_AUXR_AUXW_X 38 +#define Reservation_kv3_v2_LSU_AUXR_AUXW_Y 39 +#define Reservation_kv3_v2_MAU 40 +#define Reservation_kv3_v2_MAU_X 41 +#define Reservation_kv3_v2_MAU_Y 42 +#define Reservation_kv3_v2_MAU_AUXR 43 +#define Reservation_kv3_v2_MAU_AUXR_X 44 +#define Reservation_kv3_v2_MAU_AUXR_Y 45 + + +extern struct kvx_reloc kv3_v2_rel16_reloc; +extern struct kvx_reloc kv3_v2_rel32_reloc; +extern struct kvx_reloc kv3_v2_rel64_reloc; +extern struct kvx_reloc kv3_v2_pcrel_signed16_reloc; +extern struct kvx_reloc kv3_v2_pcrel17_reloc; +extern struct kvx_reloc kv3_v2_pcrel27_reloc; +extern struct kvx_reloc kv3_v2_pcrel32_reloc; +extern struct kvx_reloc kv3_v2_pcrel_signed37_reloc; +extern struct kvx_reloc kv3_v2_pcrel_signed43_reloc; +extern struct kvx_reloc kv3_v2_pcrel_signed64_reloc; +extern struct kvx_reloc kv3_v2_pcrel64_reloc; +extern struct kvx_reloc kv3_v2_signed16_reloc; +extern struct kvx_reloc kv3_v2_signed32_reloc; +extern struct kvx_reloc kv3_v2_signed37_reloc; +extern struct kvx_reloc kv3_v2_gotoff_signed37_reloc; +extern struct kvx_reloc kv3_v2_gotoff_signed43_reloc; +extern struct kvx_reloc kv3_v2_gotoff_32_reloc; +extern struct kvx_reloc kv3_v2_gotoff_64_reloc; +extern struct kvx_reloc kv3_v2_got_32_reloc; +extern struct kvx_reloc kv3_v2_got_signed37_reloc; +extern struct kvx_reloc kv3_v2_got_signed43_reloc; +extern struct kvx_reloc kv3_v2_got_64_reloc; +extern struct kvx_reloc kv3_v2_glob_dat_reloc; +extern struct kvx_reloc kv3_v2_copy_reloc; +extern struct kvx_reloc kv3_v2_jump_slot_reloc; +extern struct kvx_reloc kv3_v2_relative_reloc; +extern struct kvx_reloc kv3_v2_signed43_reloc; +extern struct kvx_reloc kv3_v2_signed64_reloc; +extern struct kvx_reloc kv3_v2_gotaddr_signed37_reloc; +extern struct kvx_reloc kv3_v2_gotaddr_signed43_reloc; +extern struct kvx_reloc kv3_v2_gotaddr_signed64_reloc; +extern struct kvx_reloc kv3_v2_dtpmod64_reloc; +extern struct kvx_reloc kv3_v2_dtpoff64_reloc; +extern struct kvx_reloc kv3_v2_dtpoff_signed37_reloc; +extern struct kvx_reloc kv3_v2_dtpoff_signed43_reloc; +extern struct kvx_reloc kv3_v2_tlsgd_signed37_reloc; +extern struct kvx_reloc kv3_v2_tlsgd_signed43_reloc; +extern struct kvx_reloc kv3_v2_tlsld_signed37_reloc; +extern struct kvx_reloc kv3_v2_tlsld_signed43_reloc; +extern struct kvx_reloc kv3_v2_tpoff64_reloc; +extern struct kvx_reloc kv3_v2_tlsie_signed37_reloc; +extern struct kvx_reloc kv3_v2_tlsie_signed43_reloc; +extern struct kvx_reloc kv3_v2_tlsle_signed37_reloc; +extern struct kvx_reloc kv3_v2_tlsle_signed43_reloc; +extern struct kvx_reloc kv3_v2_rel8_reloc; + +#define KVX_REGFILE_FIRST_GPR 0 +#define KVX_REGFILE_LAST_GPR 1 +#define KVX_REGFILE_DEC_GPR 2 +#define KVX_REGFILE_FIRST_PGR 3 +#define KVX_REGFILE_LAST_PGR 4 +#define KVX_REGFILE_DEC_PGR 5 +#define KVX_REGFILE_FIRST_QGR 6 +#define KVX_REGFILE_LAST_QGR 7 +#define KVX_REGFILE_DEC_QGR 8 +#define KVX_REGFILE_FIRST_SFR 9 +#define KVX_REGFILE_LAST_SFR 10 +#define KVX_REGFILE_DEC_SFR 11 +#define KVX_REGFILE_FIRST_X16R 12 +#define KVX_REGFILE_LAST_X16R 13 +#define KVX_REGFILE_DEC_X16R 14 +#define KVX_REGFILE_FIRST_X2R 15 +#define KVX_REGFILE_LAST_X2R 16 +#define KVX_REGFILE_DEC_X2R 17 +#define KVX_REGFILE_FIRST_X32R 18 +#define KVX_REGFILE_LAST_X32R 19 +#define KVX_REGFILE_DEC_X32R 20 +#define KVX_REGFILE_FIRST_X4R 21 +#define KVX_REGFILE_LAST_X4R 22 +#define KVX_REGFILE_DEC_X4R 23 +#define KVX_REGFILE_FIRST_X64R 24 +#define KVX_REGFILE_LAST_X64R 25 +#define KVX_REGFILE_DEC_X64R 26 +#define KVX_REGFILE_FIRST_X8R 27 +#define KVX_REGFILE_LAST_X8R 28 +#define KVX_REGFILE_DEC_X8R 29 +#define KVX_REGFILE_FIRST_XBR 30 +#define KVX_REGFILE_LAST_XBR 31 +#define KVX_REGFILE_DEC_XBR 32 +#define KVX_REGFILE_FIRST_XCR 33 +#define KVX_REGFILE_LAST_XCR 34 +#define KVX_REGFILE_DEC_XCR 35 +#define KVX_REGFILE_FIRST_XMR 36 +#define KVX_REGFILE_LAST_XMR 37 +#define KVX_REGFILE_DEC_XMR 38 +#define KVX_REGFILE_FIRST_XTR 39 +#define KVX_REGFILE_LAST_XTR 40 +#define KVX_REGFILE_DEC_XTR 41 +#define KVX_REGFILE_FIRST_XVR 42 +#define KVX_REGFILE_LAST_XVR 43 +#define KVX_REGFILE_DEC_XVR 44 +#define KVX_REGFILE_REGISTERS 45 +#define KVX_REGFILE_DEC_REGISTERS 46 + + +extern int kvx_kv4_v1_regfiles[]; +extern const char **kvx_kv4_v1_modifiers[]; +extern struct kvx_Register kvx_kv4_v1_registers[]; + +extern int kvx_kv4_v1_dec_registers[]; + +enum Method_kvx_kv4_v1_enum { + Immediate_kv4_v1_brknumber = 1, + Immediate_kv4_v1_pcrel17 = 2, + Immediate_kv4_v1_pcrel27 = 3, + Immediate_kv4_v1_signed10 = 4, + Immediate_kv4_v1_signed16 = 5, + Immediate_kv4_v1_signed27 = 6, + Immediate_kv4_v1_signed37 = 7, + Immediate_kv4_v1_signed43 = 8, + Immediate_kv4_v1_signed54 = 9, + Immediate_kv4_v1_sysnumber = 10, + Immediate_kv4_v1_unsigned6 = 11, + Immediate_kv4_v1_wrapped32 = 12, + Immediate_kv4_v1_wrapped64 = 13, + Immediate_kv4_v1_wrapped8 = 14, + Modifier_kv4_v1_accesses = 15, + Modifier_kv4_v1_boolcas = 16, + Modifier_kv4_v1_cachelev = 17, + Modifier_kv4_v1_channel = 18, + Modifier_kv4_v1_coherency = 19, + Modifier_kv4_v1_comparison = 20, + Modifier_kv4_v1_conjugate = 21, + Modifier_kv4_v1_doscale = 22, + Modifier_kv4_v1_exunum = 23, + Modifier_kv4_v1_floatcomp = 24, + Modifier_kv4_v1_hindex = 25, + Modifier_kv4_v1_lsomask = 26, + Modifier_kv4_v1_lsumask = 27, + Modifier_kv4_v1_lsupack = 28, + Modifier_kv4_v1_qindex = 29, + Modifier_kv4_v1_rounding = 30, + Modifier_kv4_v1_scalarcond = 31, + Modifier_kv4_v1_shuffleV = 32, + Modifier_kv4_v1_shuffleX = 33, + Modifier_kv4_v1_silent = 34, + Modifier_kv4_v1_simplecond = 35, + Modifier_kv4_v1_speculate = 36, + Modifier_kv4_v1_splat32 = 37, + Modifier_kv4_v1_transpose = 38, + Modifier_kv4_v1_variant = 39, + RegClass_kv4_v1_aloneReg = 40, + RegClass_kv4_v1_blockReg = 41, + RegClass_kv4_v1_blockRegE = 42, + RegClass_kv4_v1_blockRegO = 43, + RegClass_kv4_v1_blockReg_0 = 44, + RegClass_kv4_v1_blockReg_1 = 45, + RegClass_kv4_v1_buffer16Reg = 46, + RegClass_kv4_v1_buffer2Reg = 47, + RegClass_kv4_v1_buffer32Reg = 48, + RegClass_kv4_v1_buffer4Reg = 49, + RegClass_kv4_v1_buffer64Reg = 50, + RegClass_kv4_v1_buffer8Reg = 51, + RegClass_kv4_v1_coproReg = 52, + RegClass_kv4_v1_coproReg0M4 = 53, + RegClass_kv4_v1_coproReg1M4 = 54, + RegClass_kv4_v1_coproReg2M4 = 55, + RegClass_kv4_v1_coproReg3M4 = 56, + RegClass_kv4_v1_matrixReg = 57, + RegClass_kv4_v1_matrixReg_0 = 58, + RegClass_kv4_v1_matrixReg_1 = 59, + RegClass_kv4_v1_matrixReg_2 = 60, + RegClass_kv4_v1_matrixReg_3 = 61, + RegClass_kv4_v1_onlyfxReg = 62, + RegClass_kv4_v1_onlygetReg = 63, + RegClass_kv4_v1_onlyraReg = 64, + RegClass_kv4_v1_onlysetReg = 65, + RegClass_kv4_v1_onlyswapReg = 66, + RegClass_kv4_v1_pairedReg = 67, + RegClass_kv4_v1_pairedReg_0 = 68, + RegClass_kv4_v1_pairedReg_1 = 69, + RegClass_kv4_v1_quadReg = 70, + RegClass_kv4_v1_quadReg_0 = 71, + RegClass_kv4_v1_quadReg_1 = 72, + RegClass_kv4_v1_quadReg_2 = 73, + RegClass_kv4_v1_quadReg_3 = 74, + RegClass_kv4_v1_singleReg = 75, + RegClass_kv4_v1_systemReg = 76, + RegClass_kv4_v1_tileReg = 77, + RegClass_kv4_v1_tileReg_0 = 78, + RegClass_kv4_v1_tileReg_1 = 79, + RegClass_kv4_v1_vectorReg = 80, + RegClass_kv4_v1_vectorReg_0 = 81, + RegClass_kv4_v1_vectorReg_1 = 82, + RegClass_kv4_v1_vectorReg_2 = 83, + RegClass_kv4_v1_vectorReg_3 = 84, + Instruction_kv4_v1_abdbo = 85, + Instruction_kv4_v1_abdd = 86, + Instruction_kv4_v1_abdd_abase = 87, + Instruction_kv4_v1_abdhq = 88, + Instruction_kv4_v1_abdsbo = 89, + Instruction_kv4_v1_abdsd = 90, + Instruction_kv4_v1_abdshq = 91, + Instruction_kv4_v1_abdsw = 92, + Instruction_kv4_v1_abdswp = 93, + Instruction_kv4_v1_abdubo = 94, + Instruction_kv4_v1_abdud = 95, + Instruction_kv4_v1_abduhq = 96, + Instruction_kv4_v1_abduw = 97, + Instruction_kv4_v1_abduwp = 98, + Instruction_kv4_v1_abdw = 99, + Instruction_kv4_v1_abdwp = 100, + Instruction_kv4_v1_absbo = 101, + Instruction_kv4_v1_absd = 102, + Instruction_kv4_v1_abshq = 103, + Instruction_kv4_v1_abssbo = 104, + Instruction_kv4_v1_abssd = 105, + Instruction_kv4_v1_absshq = 106, + Instruction_kv4_v1_abssw = 107, + Instruction_kv4_v1_absswp = 108, + Instruction_kv4_v1_absw = 109, + Instruction_kv4_v1_abswp = 110, + Instruction_kv4_v1_acswapd = 111, + Instruction_kv4_v1_acswapq = 112, + Instruction_kv4_v1_acswapw = 113, + Instruction_kv4_v1_addbo = 114, + Instruction_kv4_v1_addcd = 115, + Instruction_kv4_v1_addcd_i = 116, + Instruction_kv4_v1_addd = 117, + Instruction_kv4_v1_addd_abase = 118, + Instruction_kv4_v1_addhq = 119, + Instruction_kv4_v1_addrbod = 120, + Instruction_kv4_v1_addrhqd = 121, + Instruction_kv4_v1_addrwpd = 122, + Instruction_kv4_v1_addsbo = 123, + Instruction_kv4_v1_addsd = 124, + Instruction_kv4_v1_addshq = 125, + Instruction_kv4_v1_addsw = 126, + Instruction_kv4_v1_addswp = 127, + Instruction_kv4_v1_addurbod = 128, + Instruction_kv4_v1_addurhqd = 129, + Instruction_kv4_v1_addurwpd = 130, + Instruction_kv4_v1_addusbo = 131, + Instruction_kv4_v1_addusd = 132, + Instruction_kv4_v1_addushq = 133, + Instruction_kv4_v1_addusw = 134, + Instruction_kv4_v1_adduswp = 135, + Instruction_kv4_v1_adduwd = 136, + Instruction_kv4_v1_addw = 137, + Instruction_kv4_v1_addwd = 138, + Instruction_kv4_v1_addwp = 139, + Instruction_kv4_v1_addx16bo = 140, + Instruction_kv4_v1_addx16d = 141, + Instruction_kv4_v1_addx16hq = 142, + Instruction_kv4_v1_addx16uwd = 143, + Instruction_kv4_v1_addx16w = 144, + Instruction_kv4_v1_addx16wd = 145, + Instruction_kv4_v1_addx16wp = 146, + Instruction_kv4_v1_addx2bo = 147, + Instruction_kv4_v1_addx2d = 148, + Instruction_kv4_v1_addx2hq = 149, + Instruction_kv4_v1_addx2uwd = 150, + Instruction_kv4_v1_addx2w = 151, + Instruction_kv4_v1_addx2wd = 152, + Instruction_kv4_v1_addx2wp = 153, + Instruction_kv4_v1_addx32d = 154, + Instruction_kv4_v1_addx32uwd = 155, + Instruction_kv4_v1_addx32w = 156, + Instruction_kv4_v1_addx32wd = 157, + Instruction_kv4_v1_addx4bo = 158, + Instruction_kv4_v1_addx4d = 159, + Instruction_kv4_v1_addx4hq = 160, + Instruction_kv4_v1_addx4uwd = 161, + Instruction_kv4_v1_addx4w = 162, + Instruction_kv4_v1_addx4wd = 163, + Instruction_kv4_v1_addx4wp = 164, + Instruction_kv4_v1_addx64d = 165, + Instruction_kv4_v1_addx64uwd = 166, + Instruction_kv4_v1_addx64w = 167, + Instruction_kv4_v1_addx64wd = 168, + Instruction_kv4_v1_addx8bo = 169, + Instruction_kv4_v1_addx8d = 170, + Instruction_kv4_v1_addx8hq = 171, + Instruction_kv4_v1_addx8uwd = 172, + Instruction_kv4_v1_addx8w = 173, + Instruction_kv4_v1_addx8wd = 174, + Instruction_kv4_v1_addx8wp = 175, + Instruction_kv4_v1_aladdd = 176, + Instruction_kv4_v1_aladdw = 177, + Instruction_kv4_v1_alclrd = 178, + Instruction_kv4_v1_alclrw = 179, + Instruction_kv4_v1_ald = 180, + Instruction_kv4_v1_alw = 181, + Instruction_kv4_v1_andd = 182, + Instruction_kv4_v1_andd_abase = 183, + Instruction_kv4_v1_andnd = 184, + Instruction_kv4_v1_andnd_abase = 185, + Instruction_kv4_v1_andnw = 186, + Instruction_kv4_v1_andrbod = 187, + Instruction_kv4_v1_andrhqd = 188, + Instruction_kv4_v1_andrwpd = 189, + Instruction_kv4_v1_andw = 190, + Instruction_kv4_v1_asd = 191, + Instruction_kv4_v1_asw = 192, + Instruction_kv4_v1_avgbo = 193, + Instruction_kv4_v1_avghq = 194, + Instruction_kv4_v1_avgrbo = 195, + Instruction_kv4_v1_avgrhq = 196, + Instruction_kv4_v1_avgrubo = 197, + Instruction_kv4_v1_avgruhq = 198, + Instruction_kv4_v1_avgruw = 199, + Instruction_kv4_v1_avgruwp = 200, + Instruction_kv4_v1_avgrw = 201, + Instruction_kv4_v1_avgrwp = 202, + Instruction_kv4_v1_avgubo = 203, + Instruction_kv4_v1_avguhq = 204, + Instruction_kv4_v1_avguw = 205, + Instruction_kv4_v1_avguwp = 206, + Instruction_kv4_v1_avgw = 207, + Instruction_kv4_v1_avgwp = 208, + Instruction_kv4_v1_await = 209, + Instruction_kv4_v1_barrier = 210, + Instruction_kv4_v1_break = 211, + Instruction_kv4_v1_call = 212, + Instruction_kv4_v1_cb = 213, + Instruction_kv4_v1_cbsd = 214, + Instruction_kv4_v1_cbsw = 215, + Instruction_kv4_v1_cbswp = 216, + Instruction_kv4_v1_clrf = 217, + Instruction_kv4_v1_clsd = 218, + Instruction_kv4_v1_clsw = 219, + Instruction_kv4_v1_clswp = 220, + Instruction_kv4_v1_clzd = 221, + Instruction_kv4_v1_clzw = 222, + Instruction_kv4_v1_clzwp = 223, + Instruction_kv4_v1_cmovebo = 224, + Instruction_kv4_v1_cmoved = 225, + Instruction_kv4_v1_cmovehq = 226, + Instruction_kv4_v1_cmovewp = 227, + Instruction_kv4_v1_cmuldt = 228, + Instruction_kv4_v1_cmulghxdt = 229, + Instruction_kv4_v1_cmulglxdt = 230, + Instruction_kv4_v1_cmulgmxdt = 231, + Instruction_kv4_v1_cmulxdt = 232, + Instruction_kv4_v1_compd = 233, + Instruction_kv4_v1_compnbo = 234, + Instruction_kv4_v1_compnd = 235, + Instruction_kv4_v1_compnhq = 236, + Instruction_kv4_v1_compnw = 237, + Instruction_kv4_v1_compnwp = 238, + Instruction_kv4_v1_compuwd = 239, + Instruction_kv4_v1_compw = 240, + Instruction_kv4_v1_compwd = 241, + Instruction_kv4_v1_copyd = 242, + Instruction_kv4_v1_copyo = 243, + Instruction_kv4_v1_copyq = 244, + Instruction_kv4_v1_copyw = 245, + Instruction_kv4_v1_crcbellw = 246, + Instruction_kv4_v1_crcbelmw = 247, + Instruction_kv4_v1_crclellw = 248, + Instruction_kv4_v1_crclelmw = 249, + Instruction_kv4_v1_ctzd = 250, + Instruction_kv4_v1_ctzw = 251, + Instruction_kv4_v1_ctzwp = 252, + Instruction_kv4_v1_d1inval = 253, + Instruction_kv4_v1_dflushl = 254, + Instruction_kv4_v1_dflushsw = 255, + Instruction_kv4_v1_dinvall = 256, + Instruction_kv4_v1_dinvalsw = 257, + Instruction_kv4_v1_dot2suwd = 258, + Instruction_kv4_v1_dot2suwdp = 259, + Instruction_kv4_v1_dot2uwd = 260, + Instruction_kv4_v1_dot2uwdp = 261, + Instruction_kv4_v1_dot2w = 262, + Instruction_kv4_v1_dot2wd = 263, + Instruction_kv4_v1_dot2wdp = 264, + Instruction_kv4_v1_dot2wzp = 265, + Instruction_kv4_v1_dpurgel = 266, + Instruction_kv4_v1_dpurgesw = 267, + Instruction_kv4_v1_dtouchl = 268, + Instruction_kv4_v1_errop = 269, + Instruction_kv4_v1_extfs = 270, + Instruction_kv4_v1_extfz = 271, + Instruction_kv4_v1_fabsd = 272, + Instruction_kv4_v1_fabshq = 273, + Instruction_kv4_v1_fabsw = 274, + Instruction_kv4_v1_fabswp = 275, + Instruction_kv4_v1_faddd = 276, + Instruction_kv4_v1_fadddc = 277, + Instruction_kv4_v1_fadddc_c = 278, + Instruction_kv4_v1_fadddp = 279, + Instruction_kv4_v1_faddho = 280, + Instruction_kv4_v1_faddhq = 281, + Instruction_kv4_v1_faddw = 282, + Instruction_kv4_v1_faddwc = 283, + Instruction_kv4_v1_faddwc_c = 284, + Instruction_kv4_v1_faddwcp = 285, + Instruction_kv4_v1_faddwcp_c = 286, + Instruction_kv4_v1_faddwp = 287, + Instruction_kv4_v1_faddwq = 288, + Instruction_kv4_v1_fcdivd = 289, + Instruction_kv4_v1_fcdivw = 290, + Instruction_kv4_v1_fcdivwp = 291, + Instruction_kv4_v1_fcompd = 292, + Instruction_kv4_v1_fcompnd = 293, + Instruction_kv4_v1_fcompnhq = 294, + Instruction_kv4_v1_fcompnw = 295, + Instruction_kv4_v1_fcompnwp = 296, + Instruction_kv4_v1_fcompw = 297, + Instruction_kv4_v1_fdot2w = 298, + Instruction_kv4_v1_fdot2wd = 299, + Instruction_kv4_v1_fdot2wdp = 300, + Instruction_kv4_v1_fdot2wzp = 301, + Instruction_kv4_v1_fence = 302, + Instruction_kv4_v1_ffdmasw = 303, + Instruction_kv4_v1_ffdmaswp = 304, + Instruction_kv4_v1_ffdmaswq = 305, + Instruction_kv4_v1_ffdmaw = 306, + Instruction_kv4_v1_ffdmawp = 307, + Instruction_kv4_v1_ffdmawq = 308, + Instruction_kv4_v1_ffdmdaw = 309, + Instruction_kv4_v1_ffdmdawp = 310, + Instruction_kv4_v1_ffdmdawq = 311, + Instruction_kv4_v1_ffdmdsw = 312, + Instruction_kv4_v1_ffdmdswp = 313, + Instruction_kv4_v1_ffdmdswq = 314, + Instruction_kv4_v1_ffdmsaw = 315, + Instruction_kv4_v1_ffdmsawp = 316, + Instruction_kv4_v1_ffdmsawq = 317, + Instruction_kv4_v1_ffdmsw = 318, + Instruction_kv4_v1_ffdmswp = 319, + Instruction_kv4_v1_ffdmswq = 320, + Instruction_kv4_v1_ffmad = 321, + Instruction_kv4_v1_ffmaho = 322, + Instruction_kv4_v1_ffmahq = 323, + Instruction_kv4_v1_ffmahw = 324, + Instruction_kv4_v1_ffmahwq = 325, + Instruction_kv4_v1_ffmaw = 326, + Instruction_kv4_v1_ffmawc = 327, + Instruction_kv4_v1_ffmawcp = 328, + Instruction_kv4_v1_ffmawd = 329, + Instruction_kv4_v1_ffmawdp = 330, + Instruction_kv4_v1_ffmawp = 331, + Instruction_kv4_v1_ffmawq = 332, + Instruction_kv4_v1_ffmsd = 333, + Instruction_kv4_v1_ffmsho = 334, + Instruction_kv4_v1_ffmshq = 335, + Instruction_kv4_v1_ffmshw = 336, + Instruction_kv4_v1_ffmshwq = 337, + Instruction_kv4_v1_ffmsw = 338, + Instruction_kv4_v1_ffmswc = 339, + Instruction_kv4_v1_ffmswcp = 340, + Instruction_kv4_v1_ffmswd = 341, + Instruction_kv4_v1_ffmswdp = 342, + Instruction_kv4_v1_ffmswp = 343, + Instruction_kv4_v1_ffmswq = 344, + Instruction_kv4_v1_fixedd = 345, + Instruction_kv4_v1_fixedud = 346, + Instruction_kv4_v1_fixeduw = 347, + Instruction_kv4_v1_fixeduwp = 348, + Instruction_kv4_v1_fixedw = 349, + Instruction_kv4_v1_fixedwp = 350, + Instruction_kv4_v1_floatd = 351, + Instruction_kv4_v1_floatud = 352, + Instruction_kv4_v1_floatuw = 353, + Instruction_kv4_v1_floatuwp = 354, + Instruction_kv4_v1_floatw = 355, + Instruction_kv4_v1_floatwp = 356, + Instruction_kv4_v1_fmaxd = 357, + Instruction_kv4_v1_fmaxhq = 358, + Instruction_kv4_v1_fmaxw = 359, + Instruction_kv4_v1_fmaxwp = 360, + Instruction_kv4_v1_fmind = 361, + Instruction_kv4_v1_fminhq = 362, + Instruction_kv4_v1_fminw = 363, + Instruction_kv4_v1_fminwp = 364, + Instruction_kv4_v1_fmm212w = 365, + Instruction_kv4_v1_fmm222w = 366, + Instruction_kv4_v1_fmma212w = 367, + Instruction_kv4_v1_fmma222w = 368, + Instruction_kv4_v1_fmms212w = 369, + Instruction_kv4_v1_fmms222w = 370, + Instruction_kv4_v1_fmuld = 371, + Instruction_kv4_v1_fmulho = 372, + Instruction_kv4_v1_fmulhq = 373, + Instruction_kv4_v1_fmulhw = 374, + Instruction_kv4_v1_fmulhwq = 375, + Instruction_kv4_v1_fmulw = 376, + Instruction_kv4_v1_fmulwc = 377, + Instruction_kv4_v1_fmulwcp = 378, + Instruction_kv4_v1_fmulwd = 379, + Instruction_kv4_v1_fmulwdp = 380, + Instruction_kv4_v1_fmulwp = 381, + Instruction_kv4_v1_fmulwq = 382, + Instruction_kv4_v1_fnarrowdw = 383, + Instruction_kv4_v1_fnarrowdwp = 384, + Instruction_kv4_v1_fnarrowwh = 385, + Instruction_kv4_v1_fnarrowwhq = 386, + Instruction_kv4_v1_fnegd = 387, + Instruction_kv4_v1_fneghq = 388, + Instruction_kv4_v1_fnegw = 389, + Instruction_kv4_v1_fnegwp = 390, + Instruction_kv4_v1_frecw = 391, + Instruction_kv4_v1_frsrw = 392, + Instruction_kv4_v1_fsbfd = 393, + Instruction_kv4_v1_fsbfdc = 394, + Instruction_kv4_v1_fsbfdc_c = 395, + Instruction_kv4_v1_fsbfdp = 396, + Instruction_kv4_v1_fsbfho = 397, + Instruction_kv4_v1_fsbfhq = 398, + Instruction_kv4_v1_fsbfw = 399, + Instruction_kv4_v1_fsbfwc = 400, + Instruction_kv4_v1_fsbfwc_c = 401, + Instruction_kv4_v1_fsbfwcp = 402, + Instruction_kv4_v1_fsbfwcp_c = 403, + Instruction_kv4_v1_fsbfwp = 404, + Instruction_kv4_v1_fsbfwq = 405, + Instruction_kv4_v1_fsdivd = 406, + Instruction_kv4_v1_fsdivw = 407, + Instruction_kv4_v1_fsdivwp = 408, + Instruction_kv4_v1_fsrecd = 409, + Instruction_kv4_v1_fsrecw = 410, + Instruction_kv4_v1_fsrecwp = 411, + Instruction_kv4_v1_fsrsrd = 412, + Instruction_kv4_v1_fsrsrw = 413, + Instruction_kv4_v1_fsrsrwp = 414, + Instruction_kv4_v1_fwidenlhw = 415, + Instruction_kv4_v1_fwidenlhwp = 416, + Instruction_kv4_v1_fwidenlwd = 417, + Instruction_kv4_v1_fwidenmhw = 418, + Instruction_kv4_v1_fwidenmhwp = 419, + Instruction_kv4_v1_fwidenmwd = 420, + Instruction_kv4_v1_get = 421, + Instruction_kv4_v1_goto = 422, + Instruction_kv4_v1_i1inval = 423, + Instruction_kv4_v1_i1invals = 424, + Instruction_kv4_v1_icall = 425, + Instruction_kv4_v1_iget = 426, + Instruction_kv4_v1_igoto = 427, + Instruction_kv4_v1_insf = 428, + Instruction_kv4_v1_landd = 429, + Instruction_kv4_v1_landw = 430, + Instruction_kv4_v1_lbs = 431, + Instruction_kv4_v1_lbz = 432, + Instruction_kv4_v1_ld = 433, + Instruction_kv4_v1_lhs = 434, + Instruction_kv4_v1_lhz = 435, + Instruction_kv4_v1_lnandd = 436, + Instruction_kv4_v1_lnandw = 437, + Instruction_kv4_v1_lnord = 438, + Instruction_kv4_v1_lnorw = 439, + Instruction_kv4_v1_lo = 440, + Instruction_kv4_v1_loopdo = 441, + Instruction_kv4_v1_lord = 442, + Instruction_kv4_v1_lorw = 443, + Instruction_kv4_v1_lq = 444, + Instruction_kv4_v1_lws = 445, + Instruction_kv4_v1_lwz = 446, + Instruction_kv4_v1_maddd = 447, + Instruction_kv4_v1_madddt = 448, + Instruction_kv4_v1_maddhq = 449, + Instruction_kv4_v1_maddhwq = 450, + Instruction_kv4_v1_maddmwq = 451, + Instruction_kv4_v1_maddsudt = 452, + Instruction_kv4_v1_maddsuhwq = 453, + Instruction_kv4_v1_maddsumwq = 454, + Instruction_kv4_v1_maddsuwd = 455, + Instruction_kv4_v1_maddsuwdp = 456, + Instruction_kv4_v1_maddudt = 457, + Instruction_kv4_v1_madduhwq = 458, + Instruction_kv4_v1_maddumwq = 459, + Instruction_kv4_v1_madduwd = 460, + Instruction_kv4_v1_madduwdp = 461, + Instruction_kv4_v1_madduzdt = 462, + Instruction_kv4_v1_maddw = 463, + Instruction_kv4_v1_maddwd = 464, + Instruction_kv4_v1_maddwdp = 465, + Instruction_kv4_v1_maddwp = 466, + Instruction_kv4_v1_maddwq = 467, + Instruction_kv4_v1_make = 468, + Instruction_kv4_v1_maxbo = 469, + Instruction_kv4_v1_maxd = 470, + Instruction_kv4_v1_maxd_abase = 471, + Instruction_kv4_v1_maxhq = 472, + Instruction_kv4_v1_maxrbod = 473, + Instruction_kv4_v1_maxrhqd = 474, + Instruction_kv4_v1_maxrwpd = 475, + Instruction_kv4_v1_maxubo = 476, + Instruction_kv4_v1_maxud = 477, + Instruction_kv4_v1_maxud_abase = 478, + Instruction_kv4_v1_maxuhq = 479, + Instruction_kv4_v1_maxurbod = 480, + Instruction_kv4_v1_maxurhqd = 481, + Instruction_kv4_v1_maxurwpd = 482, + Instruction_kv4_v1_maxuw = 483, + Instruction_kv4_v1_maxuwp = 484, + Instruction_kv4_v1_maxw = 485, + Instruction_kv4_v1_maxwp = 486, + Instruction_kv4_v1_minbo = 487, + Instruction_kv4_v1_mind = 488, + Instruction_kv4_v1_mind_abase = 489, + Instruction_kv4_v1_minhq = 490, + Instruction_kv4_v1_minrbod = 491, + Instruction_kv4_v1_minrhqd = 492, + Instruction_kv4_v1_minrwpd = 493, + Instruction_kv4_v1_minubo = 494, + Instruction_kv4_v1_minud = 495, + Instruction_kv4_v1_minud_abase = 496, + Instruction_kv4_v1_minuhq = 497, + Instruction_kv4_v1_minurbod = 498, + Instruction_kv4_v1_minurhqd = 499, + Instruction_kv4_v1_minurwpd = 500, + Instruction_kv4_v1_minuw = 501, + Instruction_kv4_v1_minuwp = 502, + Instruction_kv4_v1_minw = 503, + Instruction_kv4_v1_minwp = 504, + Instruction_kv4_v1_mm212w = 505, + Instruction_kv4_v1_mma212w = 506, + Instruction_kv4_v1_mms212w = 507, + Instruction_kv4_v1_msbfd = 508, + Instruction_kv4_v1_msbfdt = 509, + Instruction_kv4_v1_msbfhq = 510, + Instruction_kv4_v1_msbfhwq = 511, + Instruction_kv4_v1_msbfmwq = 512, + Instruction_kv4_v1_msbfsudt = 513, + Instruction_kv4_v1_msbfsuhwq = 514, + Instruction_kv4_v1_msbfsumwq = 515, + Instruction_kv4_v1_msbfsuwd = 516, + Instruction_kv4_v1_msbfsuwdp = 517, + Instruction_kv4_v1_msbfudt = 518, + Instruction_kv4_v1_msbfuhwq = 519, + Instruction_kv4_v1_msbfumwq = 520, + Instruction_kv4_v1_msbfuwd = 521, + Instruction_kv4_v1_msbfuwdp = 522, + Instruction_kv4_v1_msbfuzdt = 523, + Instruction_kv4_v1_msbfw = 524, + Instruction_kv4_v1_msbfwd = 525, + Instruction_kv4_v1_msbfwdp = 526, + Instruction_kv4_v1_msbfwp = 527, + Instruction_kv4_v1_msbfwq = 528, + Instruction_kv4_v1_muld = 529, + Instruction_kv4_v1_muldt = 530, + Instruction_kv4_v1_mulhq = 531, + Instruction_kv4_v1_mulhwq = 532, + Instruction_kv4_v1_mulmwq = 533, + Instruction_kv4_v1_mulsudt = 534, + Instruction_kv4_v1_mulsuhwq = 535, + Instruction_kv4_v1_mulsumwq = 536, + Instruction_kv4_v1_mulsuwd = 537, + Instruction_kv4_v1_mulsuwdp = 538, + Instruction_kv4_v1_muludt = 539, + Instruction_kv4_v1_muluhwq = 540, + Instruction_kv4_v1_mulumwq = 541, + Instruction_kv4_v1_muluwd = 542, + Instruction_kv4_v1_muluwdp = 543, + Instruction_kv4_v1_mulw = 544, + Instruction_kv4_v1_mulwd = 545, + Instruction_kv4_v1_mulwdp = 546, + Instruction_kv4_v1_mulwp = 547, + Instruction_kv4_v1_mulwq = 548, + Instruction_kv4_v1_nandd = 549, + Instruction_kv4_v1_nandd_abase = 550, + Instruction_kv4_v1_nandw = 551, + Instruction_kv4_v1_negbo = 552, + Instruction_kv4_v1_negd = 553, + Instruction_kv4_v1_neghq = 554, + Instruction_kv4_v1_negsbo = 555, + Instruction_kv4_v1_negsd = 556, + Instruction_kv4_v1_negshq = 557, + Instruction_kv4_v1_negsw = 558, + Instruction_kv4_v1_negswp = 559, + Instruction_kv4_v1_negw = 560, + Instruction_kv4_v1_negwp = 561, + Instruction_kv4_v1_nop = 562, + Instruction_kv4_v1_nord = 563, + Instruction_kv4_v1_nord_abase = 564, + Instruction_kv4_v1_norw = 565, + Instruction_kv4_v1_notd = 566, + Instruction_kv4_v1_notw = 567, + Instruction_kv4_v1_nxord = 568, + Instruction_kv4_v1_nxord_abase = 569, + Instruction_kv4_v1_nxorw = 570, + Instruction_kv4_v1_ord = 571, + Instruction_kv4_v1_ord_abase = 572, + Instruction_kv4_v1_ornd = 573, + Instruction_kv4_v1_ornd_abase = 574, + Instruction_kv4_v1_ornw = 575, + Instruction_kv4_v1_orrbod = 576, + Instruction_kv4_v1_orrhqd = 577, + Instruction_kv4_v1_orrwpd = 578, + Instruction_kv4_v1_orw = 579, + Instruction_kv4_v1_pcrel = 580, + Instruction_kv4_v1_ret = 581, + Instruction_kv4_v1_rfe = 582, + Instruction_kv4_v1_rolw = 583, + Instruction_kv4_v1_rolwps = 584, + Instruction_kv4_v1_rorw = 585, + Instruction_kv4_v1_rorwps = 586, + Instruction_kv4_v1_rswap = 587, + Instruction_kv4_v1_sb = 588, + Instruction_kv4_v1_sbfbo = 589, + Instruction_kv4_v1_sbfcd = 590, + Instruction_kv4_v1_sbfcd_i = 591, + Instruction_kv4_v1_sbfd = 592, + Instruction_kv4_v1_sbfd_abase = 593, + Instruction_kv4_v1_sbfhq = 594, + Instruction_kv4_v1_sbfsbo = 595, + Instruction_kv4_v1_sbfsd = 596, + Instruction_kv4_v1_sbfshq = 597, + Instruction_kv4_v1_sbfsw = 598, + Instruction_kv4_v1_sbfswp = 599, + Instruction_kv4_v1_sbfusbo = 600, + Instruction_kv4_v1_sbfusd = 601, + Instruction_kv4_v1_sbfushq = 602, + Instruction_kv4_v1_sbfusw = 603, + Instruction_kv4_v1_sbfuswp = 604, + Instruction_kv4_v1_sbfuwd = 605, + Instruction_kv4_v1_sbfw = 606, + Instruction_kv4_v1_sbfwd = 607, + Instruction_kv4_v1_sbfwp = 608, + Instruction_kv4_v1_sbfx16bo = 609, + Instruction_kv4_v1_sbfx16d = 610, + Instruction_kv4_v1_sbfx16hq = 611, + Instruction_kv4_v1_sbfx16uwd = 612, + Instruction_kv4_v1_sbfx16w = 613, + Instruction_kv4_v1_sbfx16wd = 614, + Instruction_kv4_v1_sbfx16wp = 615, + Instruction_kv4_v1_sbfx2bo = 616, + Instruction_kv4_v1_sbfx2d = 617, + Instruction_kv4_v1_sbfx2hq = 618, + Instruction_kv4_v1_sbfx2uwd = 619, + Instruction_kv4_v1_sbfx2w = 620, + Instruction_kv4_v1_sbfx2wd = 621, + Instruction_kv4_v1_sbfx2wp = 622, + Instruction_kv4_v1_sbfx32d = 623, + Instruction_kv4_v1_sbfx32uwd = 624, + Instruction_kv4_v1_sbfx32w = 625, + Instruction_kv4_v1_sbfx32wd = 626, + Instruction_kv4_v1_sbfx4bo = 627, + Instruction_kv4_v1_sbfx4d = 628, + Instruction_kv4_v1_sbfx4hq = 629, + Instruction_kv4_v1_sbfx4uwd = 630, + Instruction_kv4_v1_sbfx4w = 631, + Instruction_kv4_v1_sbfx4wd = 632, + Instruction_kv4_v1_sbfx4wp = 633, + Instruction_kv4_v1_sbfx64d = 634, + Instruction_kv4_v1_sbfx64uwd = 635, + Instruction_kv4_v1_sbfx64w = 636, + Instruction_kv4_v1_sbfx64wd = 637, + Instruction_kv4_v1_sbfx8bo = 638, + Instruction_kv4_v1_sbfx8d = 639, + Instruction_kv4_v1_sbfx8hq = 640, + Instruction_kv4_v1_sbfx8uwd = 641, + Instruction_kv4_v1_sbfx8w = 642, + Instruction_kv4_v1_sbfx8wd = 643, + Instruction_kv4_v1_sbfx8wp = 644, + Instruction_kv4_v1_sbmm8 = 645, + Instruction_kv4_v1_sbmm8_abase = 646, + Instruction_kv4_v1_sbmmt8 = 647, + Instruction_kv4_v1_sbmmt8_abase = 648, + Instruction_kv4_v1_scall = 649, + Instruction_kv4_v1_sd = 650, + Instruction_kv4_v1_set = 651, + Instruction_kv4_v1_sh = 652, + Instruction_kv4_v1_sleep = 653, + Instruction_kv4_v1_sllbos = 654, + Instruction_kv4_v1_slld = 655, + Instruction_kv4_v1_sllhqs = 656, + Instruction_kv4_v1_sllw = 657, + Instruction_kv4_v1_sllwps = 658, + Instruction_kv4_v1_slsbos = 659, + Instruction_kv4_v1_slsd = 660, + Instruction_kv4_v1_slshqs = 661, + Instruction_kv4_v1_slsw = 662, + Instruction_kv4_v1_slswps = 663, + Instruction_kv4_v1_slusbos = 664, + Instruction_kv4_v1_slusd = 665, + Instruction_kv4_v1_slushqs = 666, + Instruction_kv4_v1_slusw = 667, + Instruction_kv4_v1_sluswps = 668, + Instruction_kv4_v1_so = 669, + Instruction_kv4_v1_sq = 670, + Instruction_kv4_v1_srabos = 671, + Instruction_kv4_v1_srad = 672, + Instruction_kv4_v1_srahqs = 673, + Instruction_kv4_v1_sraw = 674, + Instruction_kv4_v1_srawps = 675, + Instruction_kv4_v1_srlbos = 676, + Instruction_kv4_v1_srld = 677, + Instruction_kv4_v1_srlhqs = 678, + Instruction_kv4_v1_srlw = 679, + Instruction_kv4_v1_srlwps = 680, + Instruction_kv4_v1_srsbos = 681, + Instruction_kv4_v1_srsd = 682, + Instruction_kv4_v1_srshqs = 683, + Instruction_kv4_v1_srsw = 684, + Instruction_kv4_v1_srswps = 685, + Instruction_kv4_v1_stop = 686, + Instruction_kv4_v1_stsud = 687, + Instruction_kv4_v1_stsuhq = 688, + Instruction_kv4_v1_stsuw = 689, + Instruction_kv4_v1_stsuwp = 690, + Instruction_kv4_v1_sw = 691, + Instruction_kv4_v1_sxbd = 692, + Instruction_kv4_v1_sxhd = 693, + Instruction_kv4_v1_sxlbhq = 694, + Instruction_kv4_v1_sxlhwp = 695, + Instruction_kv4_v1_sxmbhq = 696, + Instruction_kv4_v1_sxmhwp = 697, + Instruction_kv4_v1_sxwd = 698, + Instruction_kv4_v1_syncgroup = 699, + Instruction_kv4_v1_tlbdinval = 700, + Instruction_kv4_v1_tlbiinval = 701, + Instruction_kv4_v1_tlbprobe = 702, + Instruction_kv4_v1_tlbread = 703, + Instruction_kv4_v1_tlbwrite = 704, + Instruction_kv4_v1_waitit = 705, + Instruction_kv4_v1_wfxl = 706, + Instruction_kv4_v1_wfxm = 707, + Instruction_kv4_v1_xaccesso = 708, + Instruction_kv4_v1_xaligno = 709, + Instruction_kv4_v1_xandno = 710, + Instruction_kv4_v1_xando = 711, + Instruction_kv4_v1_xclampwo = 712, + Instruction_kv4_v1_xcopyo = 713, + Instruction_kv4_v1_xcopyv = 714, + Instruction_kv4_v1_xcopyx = 715, + Instruction_kv4_v1_xffma44hw = 716, + Instruction_kv4_v1_xfmaxhx = 717, + Instruction_kv4_v1_xfminhx = 718, + Instruction_kv4_v1_xfmma484hw = 719, + Instruction_kv4_v1_xfnarrow44wh = 720, + Instruction_kv4_v1_xfscalewo = 721, + Instruction_kv4_v1_xlo = 722, + Instruction_kv4_v1_xmadd44bw0 = 723, + Instruction_kv4_v1_xmadd44bw1 = 724, + Instruction_kv4_v1_xmaddifwo = 725, + Instruction_kv4_v1_xmaddsu44bw0 = 726, + Instruction_kv4_v1_xmaddsu44bw1 = 727, + Instruction_kv4_v1_xmaddu44bw0 = 728, + Instruction_kv4_v1_xmaddu44bw1 = 729, + Instruction_kv4_v1_xmma4164bw = 730, + Instruction_kv4_v1_xmma484bw = 731, + Instruction_kv4_v1_xmmasu4164bw = 732, + Instruction_kv4_v1_xmmasu484bw = 733, + Instruction_kv4_v1_xmmau4164bw = 734, + Instruction_kv4_v1_xmmau484bw = 735, + Instruction_kv4_v1_xmmaus4164bw = 736, + Instruction_kv4_v1_xmmaus484bw = 737, + Instruction_kv4_v1_xmovefd = 738, + Instruction_kv4_v1_xmovefo = 739, + Instruction_kv4_v1_xmovefq = 740, + Instruction_kv4_v1_xmovetd = 741, + Instruction_kv4_v1_xmovetq = 742, + Instruction_kv4_v1_xmsbfifwo = 743, + Instruction_kv4_v1_xmt44d = 744, + Instruction_kv4_v1_xnando = 745, + Instruction_kv4_v1_xnoro = 746, + Instruction_kv4_v1_xnxoro = 747, + Instruction_kv4_v1_xord = 748, + Instruction_kv4_v1_xord_abase = 749, + Instruction_kv4_v1_xorno = 750, + Instruction_kv4_v1_xoro = 751, + Instruction_kv4_v1_xorrbod = 752, + Instruction_kv4_v1_xorrhqd = 753, + Instruction_kv4_v1_xorrwpd = 754, + Instruction_kv4_v1_xorw = 755, + Instruction_kv4_v1_xrecvo = 756, + Instruction_kv4_v1_xsbmm8dq = 757, + Instruction_kv4_v1_xsbmmt8dq = 758, + Instruction_kv4_v1_xsendo = 759, + Instruction_kv4_v1_xsendrecvo = 760, + Instruction_kv4_v1_xso = 761, + Instruction_kv4_v1_xsplatdo = 762, + Instruction_kv4_v1_xsplatov = 763, + Instruction_kv4_v1_xsplatox = 764, + Instruction_kv4_v1_xsx48bw = 765, + Instruction_kv4_v1_xtrunc48wb = 766, + Instruction_kv4_v1_xxoro = 767, + Instruction_kv4_v1_xzx48bw = 768, + Instruction_kv4_v1_zxbd = 769, + Instruction_kv4_v1_zxhd = 770, + Instruction_kv4_v1_zxlbhq = 771, + Instruction_kv4_v1_zxlhwp = 772, + Instruction_kv4_v1_zxmbhq = 773, + Instruction_kv4_v1_zxmhwp = 774, + Instruction_kv4_v1_zxwd = 775, + Separator_kv4_v1_comma = 776, + Separator_kv4_v1_equal = 777, + Separator_kv4_v1_qmark = 778, + Separator_kv4_v1_rsbracket = 779, + Separator_kv4_v1_lsbracket = 780 +}; + +enum Modifier_kv4_v1_exunum_enum { + Modifier_kv4_v1_exunum_ALU0=0, + Modifier_kv4_v1_exunum_ALU1=1, + Modifier_kv4_v1_exunum_MAU=2, + Modifier_kv4_v1_exunum_LSU=3, +}; + +extern const char *mod_kv4_v1_exunum[]; +extern const char *mod_kv4_v1_scalarcond[]; +extern const char *mod_kv4_v1_lsomask[]; +extern const char *mod_kv4_v1_lsumask[]; +extern const char *mod_kv4_v1_lsupack[]; +extern const char *mod_kv4_v1_simplecond[]; +extern const char *mod_kv4_v1_comparison[]; +extern const char *mod_kv4_v1_floatcomp[]; +extern const char *mod_kv4_v1_rounding[]; +extern const char *mod_kv4_v1_silent[]; +extern const char *mod_kv4_v1_variant[]; +extern const char *mod_kv4_v1_speculate[]; +extern const char *mod_kv4_v1_doscale[]; +extern const char *mod_kv4_v1_qindex[]; +extern const char *mod_kv4_v1_hindex[]; +extern const char *mod_kv4_v1_cachelev[]; +extern const char *mod_kv4_v1_coherency[]; +extern const char *mod_kv4_v1_boolcas[]; +extern const char *mod_kv4_v1_accesses[]; +extern const char *mod_kv4_v1_channel[]; +extern const char *mod_kv4_v1_conjugate[]; +extern const char *mod_kv4_v1_transpose[]; +extern const char *mod_kv4_v1_shuffleV[]; +extern const char *mod_kv4_v1_shuffleX[]; +extern const char *mod_kv4_v1_splat32[]; +typedef enum { + Bundling_kv4_v1_ALL, + Bundling_kv4_v1_BCU, + Bundling_kv4_v1_TCA, + Bundling_kv4_v1_FULL, + Bundling_kv4_v1_FULL_X, + Bundling_kv4_v1_FULL_Y, + Bundling_kv4_v1_LITE, + Bundling_kv4_v1_LITE_X, + Bundling_kv4_v1_LITE_Y, + Bundling_kv4_v1_MAU, + Bundling_kv4_v1_MAU_X, + Bundling_kv4_v1_MAU_Y, + Bundling_kv4_v1_LSU, + Bundling_kv4_v1_LSU_X, + Bundling_kv4_v1_LSU_Y, + Bundling_kv4_v1_TINY, + Bundling_kv4_v1_TINY_X, + Bundling_kv4_v1_TINY_Y, + Bundling_kv4_v1_NOP, +} Bundling_kv4_v1; + + +static const char *bundling_kv4_v1_names(Bundling_kv4_v1 bundling) __attribute__((unused)); +static const char *bundling_kv4_v1_names(Bundling_kv4_v1 bundling) { + switch(bundling) { + case Bundling_kv4_v1_ALL: return "Bundling_kv4_v1_ALL"; + case Bundling_kv4_v1_BCU: return "Bundling_kv4_v1_BCU"; + case Bundling_kv4_v1_TCA: return "Bundling_kv4_v1_TCA"; + case Bundling_kv4_v1_FULL: return "Bundling_kv4_v1_FULL"; + case Bundling_kv4_v1_FULL_X: return "Bundling_kv4_v1_FULL_X"; + case Bundling_kv4_v1_FULL_Y: return "Bundling_kv4_v1_FULL_Y"; + case Bundling_kv4_v1_LITE: return "Bundling_kv4_v1_LITE"; + case Bundling_kv4_v1_LITE_X: return "Bundling_kv4_v1_LITE_X"; + case Bundling_kv4_v1_LITE_Y: return "Bundling_kv4_v1_LITE_Y"; + case Bundling_kv4_v1_MAU: return "Bundling_kv4_v1_MAU"; + case Bundling_kv4_v1_MAU_X: return "Bundling_kv4_v1_MAU_X"; + case Bundling_kv4_v1_MAU_Y: return "Bundling_kv4_v1_MAU_Y"; + case Bundling_kv4_v1_LSU: return "Bundling_kv4_v1_LSU"; + case Bundling_kv4_v1_LSU_X: return "Bundling_kv4_v1_LSU_X"; + case Bundling_kv4_v1_LSU_Y: return "Bundling_kv4_v1_LSU_Y"; + case Bundling_kv4_v1_TINY: return "Bundling_kv4_v1_TINY"; + case Bundling_kv4_v1_TINY_X: return "Bundling_kv4_v1_TINY_X"; + case Bundling_kv4_v1_TINY_Y: return "Bundling_kv4_v1_TINY_Y"; + case Bundling_kv4_v1_NOP: return "Bundling_kv4_v1_NOP"; + }; + return "unknown bundling"; +}; + +/* Resources list */ +#define Resource_kv4_v1_ISSUE 0 +#define Resource_kv4_v1_TINY 1 +#define Resource_kv4_v1_LITE 2 +#define Resource_kv4_v1_FULL 3 +#define Resource_kv4_v1_LSU 4 +#define Resource_kv4_v1_MAU 5 +#define Resource_kv4_v1_BCU 6 +#define Resource_kv4_v1_TCA 7 +#define Resource_kv4_v1_AUXR 8 +#define Resource_kv4_v1_AUXW 9 +#define Resource_kv4_v1_CRRP 10 +#define Resource_kv4_v1_CRWL 11 +#define Resource_kv4_v1_CRWH 12 +#define Resource_kv4_v1_NOP 13 +#define kvx_kv4_v1_RESOURCE_MAX 14 + + +/* Reservations list */ +#define Reservation_kv4_v1_ALL 0 +#define Reservation_kv4_v1_ALU_NOP 1 +#define Reservation_kv4_v1_ALU_TINY 2 +#define Reservation_kv4_v1_ALU_TINY_X 3 +#define Reservation_kv4_v1_ALU_TINY_Y 4 +#define Reservation_kv4_v1_ALU_TINY_CRRP 5 +#define Reservation_kv4_v1_ALU_TINY_CRWL_CRWH 6 +#define Reservation_kv4_v1_ALU_TINY_CRWL_CRWH_X 7 +#define Reservation_kv4_v1_ALU_TINY_CRWL_CRWH_Y 8 +#define Reservation_kv4_v1_ALU_TINY_CRRP_CRWL_CRWH 9 +#define Reservation_kv4_v1_ALU_TINY_CRWL 10 +#define Reservation_kv4_v1_ALU_TINY_CRWH 11 +#define Reservation_kv4_v1_ALU_LITE 12 +#define Reservation_kv4_v1_ALU_LITE_X 13 +#define Reservation_kv4_v1_ALU_LITE_Y 14 +#define Reservation_kv4_v1_ALU_LITE_CRWL 15 +#define Reservation_kv4_v1_ALU_LITE_CRWH 16 +#define Reservation_kv4_v1_ALU_FULL 17 +#define Reservation_kv4_v1_ALU_FULL_X 18 +#define Reservation_kv4_v1_ALU_FULL_Y 19 +#define Reservation_kv4_v1_BCU 20 +#define Reservation_kv4_v1_BCU_CRRP_CRWL_CRWH 21 +#define Reservation_kv4_v1_BCU_TINY_AUXW_CRRP 22 +#define Reservation_kv4_v1_BCU_TINY_TINY_MAU_XNOP 23 +#define Reservation_kv4_v1_TCA 24 +#define Reservation_kv4_v1_LSU 25 +#define Reservation_kv4_v1_LSU_X 26 +#define Reservation_kv4_v1_LSU_Y 27 +#define Reservation_kv4_v1_LSU_CRRP 28 +#define Reservation_kv4_v1_LSU_CRRP_X 29 +#define Reservation_kv4_v1_LSU_CRRP_Y 30 +#define Reservation_kv4_v1_LSU_AUXR 31 +#define Reservation_kv4_v1_LSU_AUXR_X 32 +#define Reservation_kv4_v1_LSU_AUXR_Y 33 +#define Reservation_kv4_v1_LSU_AUXW 34 +#define Reservation_kv4_v1_LSU_AUXW_X 35 +#define Reservation_kv4_v1_LSU_AUXW_Y 36 +#define Reservation_kv4_v1_LSU_AUXR_AUXW 37 +#define Reservation_kv4_v1_LSU_AUXR_AUXW_X 38 +#define Reservation_kv4_v1_LSU_AUXR_AUXW_Y 39 +#define Reservation_kv4_v1_MAU 40 +#define Reservation_kv4_v1_MAU_X 41 +#define Reservation_kv4_v1_MAU_Y 42 +#define Reservation_kv4_v1_MAU_AUXR 43 +#define Reservation_kv4_v1_MAU_AUXR_X 44 +#define Reservation_kv4_v1_MAU_AUXR_Y 45 + + +extern struct kvx_reloc kv4_v1_rel16_reloc; +extern struct kvx_reloc kv4_v1_rel32_reloc; +extern struct kvx_reloc kv4_v1_rel64_reloc; +extern struct kvx_reloc kv4_v1_pcrel_signed16_reloc; +extern struct kvx_reloc kv4_v1_pcrel17_reloc; +extern struct kvx_reloc kv4_v1_pcrel27_reloc; +extern struct kvx_reloc kv4_v1_pcrel32_reloc; +extern struct kvx_reloc kv4_v1_pcrel_signed37_reloc; +extern struct kvx_reloc kv4_v1_pcrel_signed43_reloc; +extern struct kvx_reloc kv4_v1_pcrel_signed64_reloc; +extern struct kvx_reloc kv4_v1_pcrel64_reloc; +extern struct kvx_reloc kv4_v1_signed16_reloc; +extern struct kvx_reloc kv4_v1_signed32_reloc; +extern struct kvx_reloc kv4_v1_signed37_reloc; +extern struct kvx_reloc kv4_v1_gotoff_signed37_reloc; +extern struct kvx_reloc kv4_v1_gotoff_signed43_reloc; +extern struct kvx_reloc kv4_v1_gotoff_32_reloc; +extern struct kvx_reloc kv4_v1_gotoff_64_reloc; +extern struct kvx_reloc kv4_v1_got_32_reloc; +extern struct kvx_reloc kv4_v1_got_signed37_reloc; +extern struct kvx_reloc kv4_v1_got_signed43_reloc; +extern struct kvx_reloc kv4_v1_got_64_reloc; +extern struct kvx_reloc kv4_v1_glob_dat_reloc; +extern struct kvx_reloc kv4_v1_copy_reloc; +extern struct kvx_reloc kv4_v1_jump_slot_reloc; +extern struct kvx_reloc kv4_v1_relative_reloc; +extern struct kvx_reloc kv4_v1_signed43_reloc; +extern struct kvx_reloc kv4_v1_signed64_reloc; +extern struct kvx_reloc kv4_v1_gotaddr_signed37_reloc; +extern struct kvx_reloc kv4_v1_gotaddr_signed43_reloc; +extern struct kvx_reloc kv4_v1_gotaddr_signed64_reloc; +extern struct kvx_reloc kv4_v1_dtpmod64_reloc; +extern struct kvx_reloc kv4_v1_dtpoff64_reloc; +extern struct kvx_reloc kv4_v1_dtpoff_signed37_reloc; +extern struct kvx_reloc kv4_v1_dtpoff_signed43_reloc; +extern struct kvx_reloc kv4_v1_tlsgd_signed37_reloc; +extern struct kvx_reloc kv4_v1_tlsgd_signed43_reloc; +extern struct kvx_reloc kv4_v1_tlsld_signed37_reloc; +extern struct kvx_reloc kv4_v1_tlsld_signed43_reloc; +extern struct kvx_reloc kv4_v1_tpoff64_reloc; +extern struct kvx_reloc kv4_v1_tlsie_signed37_reloc; +extern struct kvx_reloc kv4_v1_tlsie_signed43_reloc; +extern struct kvx_reloc kv4_v1_tlsle_signed37_reloc; +extern struct kvx_reloc kv4_v1_tlsle_signed43_reloc; +extern struct kvx_reloc kv4_v1_rel8_reloc; + + +#endif /* OPCODE_KVX_H */ From patchwork Fri Jul 21 07:49:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Iannetta X-Patchwork-Id: 123631 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp38169vqg; Fri, 21 Jul 2023 00:52:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlEI45SS+UsUjFaI57s9qvrn8NbukMkWoPOx66hZj0F5lfRUKXpcOPIYDt8UBo7HaTfHptrd X-Received: by 2002:a17:906:6495:b0:97e:56d5:b885 with SMTP id e21-20020a170906649500b0097e56d5b885mr1059862ejm.60.1689925974816; Fri, 21 Jul 2023 00:52:54 -0700 (PDT) Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id z27-20020a170906241b00b0099b6e6c095csi291706eja.698.2023.07.21.00.52.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 00:52:54 -0700 (PDT) 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=ONFQ0+Tc; 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 6ED6338515D6 for ; Fri, 21 Jul 2023 07:51:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ED6338515D6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689925901; bh=njR+fA90bN7exdf/fhgNtUe+L3PY+lTn9ww9wAGrfn8=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ONFQ0+TcEB0n8AE+Z8EATN8qqAYQ1V9xVtOAh61NJB+KN6qx4augk5jgr/S92r7e7 0Y2+d0N4GOpr42bm7ZVt5wYH2FUHfPzr4pYLyFocL3TDX74teVOr9C0UTk1vtCcQCd TEb1q5zaNP9tPzeePKal7i51D0C92/GG6gnGXVu8= X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from smtpout140.security-mail.net (smtpout140.security-mail.net [85.31.212.149]) by sourceware.org (Postfix) with ESMTPS id EA40F385C6DC for ; Fri, 21 Jul 2023 07:50:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA40F385C6DC Received: from localhost (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 8A511349611 for ; Fri, 21 Jul 2023 09:50:19 +0200 (CEST) Received: from fx409 (fx409.security-mail.net [127.0.0.1]) by fx409.security-mail.net (Postfix) with ESMTP id 733123495DB for ; Fri, 21 Jul 2023 09:50:18 +0200 (CEST) Received: from FRA01-MR2-obe.outbound.protection.outlook.com (mail-mr2fra01lp0108.outbound.protection.outlook.com [104.47.25.108]) by fx409.security-mail.net (Postfix) with ESMTPS id DDC55349711 for ; Fri, 21 Jul 2023 09:50:14 +0200 (CEST) Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) by MR1P264MB1731.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.25; Fri, 21 Jul 2023 07:50:16 +0000 Received: from MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d]) by MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM ([fe80::e37a:10dd:d14d:a28d%7]) with mapi id 15.20.6609.026; Fri, 21 Jul 2023 07:50:16 +0000 X-Virus-Scanned: E-securemail Secumail-id: <12564.64ba38b6.dd1ba.2> ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZmyWqarihJJr9ODCYlG1/0UwBnqRznr5f4iMbQnZGxgYRrclcTtsSfgC+a8L5MzMtKC1iwbHxe4YbmXiRlRPD7qlhTtoqOwgs7sK/X8vzdH2STwNx77D6XbwEGYg2U2ILDzXullFUjFV1282MNiguB6YeYYe76mBTLTWRtjAcEXXKmG1vk4BhK9Zb615/RSwkPd7yFLOYjvAHWFEh9yQJBZSfYfQsqT6/UDLYukqcoBlygr9fiuxq/0JuwV3nsokZ9j5mczGDds+mK2nXR4QESeO1m4cxYxdY4CTyQ3Fik8oJaQg16a9QijZKAYfZQNuvAP6dumPA/zsn27kISIgGQ== 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=njR+fA90bN7exdf/fhgNtUe+L3PY+lTn9ww9wAGrfn8=; b=T0Mmz7OA+hpP5nwPR4LPJL4sjtEz11I3RG1aftpFLwogvPX9wIrRBTrGD/lyFnvxEZ8bksif9NRnrE6GIr1GImGXsmnSdw5zFoR6qYzdVFYWw489N4Lsz4UA472rhUsgesTU5CwYlshGGS/gxBkL9i5zV7TSo7LefeX/eELmUCzvpjTvRkOC6+hYdkerWTDFijz0KnJGx8R8naSDRKdgnIKnSq79UECAIwbySOdI4OObS16Z4w6xbKAa04Cul1FxYQVrkCQBPnKtrrgVwni3Qu1kyHHX/oXMClPLXRnrGwIC7IFry7T8VzpvqLQqP0sn2M9MOliS/ElG4twSIYtKiA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=kalrayinc.com; dmarc=pass action=none header.from=kalrayinc.com; dkim=pass header.d=kalrayinc.com; arc=none To: binutils@sourceware.org Cc: Paul Iannetta Subject: [PATCH 7/7] kvx: Add toplevel files. Date: Fri, 21 Jul 2023 09:49:56 +0200 Message-ID: <20230721074956.7188-8-piannetta@kalrayinc.com> X-Mailer: git-send-email 2.35.1.500.gb896f729e2 In-Reply-To: <20230721074956.7188-1-piannetta@kalrayinc.com> References: <20230721074956.7188-1-piannetta@kalrayinc.com> X-ClientProxiedBy: LO2P265CA0109.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::25) To MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM (2603:10a6:501:33::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MR1P264MB2482:EE_|MR1P264MB1731:EE_ X-MS-Office365-Filtering-Correlation-Id: 05c7ac51-18e7-4f7a-abc3-08db89bf1f90 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +o6INlKSCHyDrYrUjy57sHoPJ9HVg0UhzuUDu9on8WZWH7GtUrvZ4TA5pJu2mmWkgMEx95NpE+z5StueLMqdWPWCCMHPxlPEvtCeMwcF7ZPdVfUtNnkHOeueY0MEwp+IeGUD7mfNFUbvTc3zRfjjGiR7vIyZlxxrfGQ+mUeGPQBg3l5bH+YDMByyRBlSpS+xvaWS+MQymfklxzd3GKUVV1y8gfpfh6tsxJxQmpvudZyMFxg9X94Q9517AVFw9/x8iglIaw3ZgoNyAgQMkOhvqo+Db4lvaDfy9Ti/UEPC1B0rldx1g8nSHMRvnhL3OUy4W/86k/lcFT50iJ8O5nP7F6C8WwAhKATPaMh1JZPr4ihiX0F6LXLsYfqvgcmwXcYt8Ifzb7uKPSO47yBzx/mzqMJYBFhCo+SNWnskY7qgS0Ntnvwmtqf16bFkGydkwYGGzpL55mLD1PThIhKUabGzPBDOTNTdj1EDAOfnIe2o1XI3RuBRZDzq4C3hqqOTyqPh/3xim8VIj00YyYCUEVXXC9DloMccU3tAEZomU+EKyZJoA96fsvWSlLVbkBp6wcT6grKXNlGPpfIUOu3K8A93yV5CWLbad9VOmYybRxcbx2X8JeMyU96k6pWYDZW2ujWt X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(366004)(39850400004)(346002)(376002)(451199021)(6666004)(6486002)(478600001)(83380400001)(6916009)(26005)(6506007)(1076003)(107886003)(6512007)(4326008)(38100700002)(66556008)(66476007)(66946007)(186003)(2616005)(5660300002)(8676002)(8936002)(2906002)(41300700001)(316002)(86362001)(36756003)(2004002)(473944003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A2BaJEXnIUjj4G08ng8biOEt0qq9hcwpYmu9GSe81kBDuxfKt7XVOvjALxqui9aqyS14wLZdcRjn+HMinlcr+sasY6GeTO+tlWvpi1LLuIhlPW/Zn/4Y0Cf24wKLKyAEXI91xA/xDovg9thvBUGASTZmA3oWzhaUgIWvmnpSN36LFKo2FtpPw8xYUs24Qfb2J+bCZmhqiFrbSrD35bojeaXmoKQ+8nyqNcnSyMyUXvRhmoRK8kTJUUPYrS/FOvwEKBfcaHw6OQtWV+qZ6jx9guTqwGcw1psJZUxZRiHyx4zM7vWL9cCfcDzPFH9bBmLr0MpHSgOoYtae8WhwSOM5e/HMhnSA9R9pEBRI0iymU5UhXEP42aH22RA2dvXk39o2sDyhoJ+Oync3k21liFaBCOeqM7u35dkhZnzkUpks7jGE056PYS3enKcan/U6xh0F1qSepeHriWu+JFKuf8qLaC586+h6dBkR9Wm2nF1YxAm1VGYy4KwuhhJxjtzxt40v9M+4lkcfmrI3ZxHtaDGY8w9ppBg/43o1SU9h+2kPQd7qmWViQBnF8rnXBHU0m1zwxC/rHxw8zp92+GHJsXVotJiVQ2w5hSPIF8e4ZwWKt5qlYX0sAZL/ERtKDGXh6kFizrq1dnyUqAwfTrVr6SlMuutI0sfv/P+hbuQZjHVbFFAZunHIsdzC7YnPxm9s3SJDOqSaeJ8hNMFkTZ+kwU7CQVXHIPOK87kIZra+14QRiItoDi+PGOdR/SmIw4AO9ScYddFIdOL7XU7hnxrYUHBU7Ij+UrkZP2xldr/5pf5bEfehAcxR9HsZpZHdgvG8PU5vns/wbD8uTmprbkkIBtnRLsyOdEjuMAKGM1FvIcxCg6XxBzLWp+gf2sfxiegtIYOa5EPJWsaoy8G9du23sazWlbCC2TxbFgRfZ9ZKPMx/6M/O3r+aUBIGmPDLjyVRIjoE VQ4iIEpKQGfE6X/vypWr8OahllOL8QB5qfSea2WorTeh7JH1SKognIcIg4nY4YdyO/eo8kBb3vtN78C1SBwdLPLfDHuCf8dYTsir0Yku1F3PeI4WuWYBrKN2BfivvlTAiifELfchNaoX+aQG3Cfwpx4ye6CGB/YLOjoj8DkURDQX6SeK+Ku6eD0I1AkF5tU5p5Q9bF/Q0C/6OnrQwvJ8sLcL/QpQFE3ab071kWmxlJjt/vubB/XASyheseILGb2+W3gd7lKYQdEXeJLJp1WYgoCuJP5RtSGmw1UksAQDrvNJCG4s8GXUUHJCE+6uexfval7C08ptkrlDP1vv5OEQZ4etAQLvUX1ESL7cqx8ntYl3b6wtRgKTOJ56aFgQcHRcFzagX+dn/5apq06PX3ky8kNhzbaIxa+77vri/h9zjCmXpsN935Z+2D5tp7uH1nnoLizCrv4k8U8LhfMoKEpwk88SJR6VhRywtr1ug72cLk3Q957W5kIC1tOccBPUnP8111Mc4DBJfbGhCxSYJU7Nm2vmg3rj10Mom81QnwvPzIWiXxAwiSWI5omdXPvHvCJy6Hi3OxjO5FxAPw94zMkjv47Z/zDg/UeA+qN83o0ZC8mo4OSdHllRtirLXBxUkZ/uv98+mHPRjYM1Bb+7qpb6yQ== X-OriginatorOrg: kalrayinc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 05c7ac51-18e7-4f7a-abc3-08db89bf1f90 X-MS-Exchange-CrossTenant-AuthSource: MR1P264MB2482.FRAP264.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jul 2023 07:50:16.5712 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8931925d-7620-4a64-b7fe-20afd86363d3 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: WhOzCluEzglrd7vFpnvTvIX9RhiuJQ/tjHhLAuR5Zs3ADW6YXltufFeU1CMyBqiQwJzJ4NzwnKCneH2TQMybCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MR1P264MB1731 X-ALTERMIMEV2_out: done X-Spam-Status: No, score=-11.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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: Paul Iannetta via Binutils From: Paul Iannetta Reply-To: Paul Iannetta Errors-To: binutils-bounces+ouuuleilei=gmail.com@sourceware.org Sender: "Binutils" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772015819161606741 X-GMAIL-MSGID: 1772015819161606741 ChangeLog: 2023-07-20 Paul Iannetta * config.guess: Add kvx support. * config.sub: Likewise. * configure: Likewise. * configure.ac: Likewise. --- config.guess | 9 +++++++++ config.sub | 16 ++++++++++++---- configure | 12 ++++++++++++ configure.ac | 12 ++++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/config.guess b/config.guess index 354a8ccde42..72d235025ed 100755 --- a/config.guess +++ b/config.guess @@ -1042,6 +1042,15 @@ EOF k1om:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; + kvx:Linux:*:*) + GUESS=$UNAME_MACHINE-unknown-linux-$LIBC + ;; + kvx:cos:*:*) + GUESS=$UNAME_MACHINE-unknown-cos + ;; + kvx:mbr:*:*) + GUESS=$UNAME_MACHINE-unknown-mbr + ;; loongarch32:Linux:*:* | loongarch64:Linux:*:*) GUESS=$UNAME_MACHINE-unknown-linux-$LIBC ;; diff --git a/config.sub b/config.sub index f6ede1d0dc0..9a7a3ed642d 100755 --- a/config.sub +++ b/config.sub @@ -4,7 +4,7 @@ # shellcheck disable=SC2006,SC2268 # see below for rationale -timestamp='2023-06-23' +timestamp='2023-06-26' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -145,7 +145,8 @@ case $1 in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ - | storm-chaos* | os2-emx* | rtmk-nova* | managarm-*) + | storm-chaos* | os2-emx* | rtmk-nova* | managarm-* \ + | windows-* ) basic_machine=$field1 basic_os=$maybe_os ;; @@ -1205,6 +1206,7 @@ case $cpu-$vendor in | i370 | i*86 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ | k1om \ + | kvx \ | le32 | le64 \ | lm32 \ | loongarch32 | loongarch64 \ @@ -1758,7 +1760,7 @@ case $os in | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \ - | fiwix* | mlibc* ) + | fiwix* | mlibc* | cos* | mbr* ) ;; # This one is extra strict with allowed versions sco3.2v2 | sco3.2v[4-9]* | sco5v6*) @@ -1766,7 +1768,7 @@ case $os in ;; none) ;; - kernel* ) + kernel* | msvc* ) # Restricted further below ;; *) @@ -1785,6 +1787,8 @@ case $kernel-$os in ;; managarm-mlibc* | managarm-kernel* ) ;; + windows*-gnu* | windows*-msvc*) + ;; -dietlibc* | -newlib* | -musl* | -relibc* | -uclibc* | -mlibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. @@ -1799,6 +1803,10 @@ case $kernel-$os in echo "Invalid configuration '$1': '$kernel' does not support '$os'." 1>&2 exit 1 ;; + *-msvc* ) + echo "Invalid configuration '$1': '$os' needs 'windows'." 1>&2 + exit 1 + ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; vxworks-simlinux | vxworks-simwindows | vxworks-spe) diff --git a/configure b/configure index 9cb953a197e..e290504918c 100755 --- a/configure +++ b/configure @@ -3702,6 +3702,15 @@ case "${target}" in cris-*-* | crisv32-*-*) libgloss_dir=cris ;; + kvx-*-elf) + libgloss_dir=kvx-elf + ;; + kvx-*-mbr) + libgloss_dir=kvx-mbr + ;; + kvx-*-cos) + libgloss_dir=kvx-cos + ;; hppa*-*-*) libgloss_dir=pa ;; @@ -3996,6 +4005,9 @@ case "${target}" in i[3456789]86-*-rdos*) noconfigdirs="$noconfigdirs gdb" ;; + kvx-*-*) + noconfigdirs="$noconfigdirs gdb sim" + ;; mmix-*-*) noconfigdirs="$noconfigdirs gdb" ;; diff --git a/configure.ac b/configure.ac index e95a9ed116e..2444a774e02 100644 --- a/configure.ac +++ b/configure.ac @@ -935,6 +935,15 @@ case "${target}" in cris-*-* | crisv32-*-*) libgloss_dir=cris ;; + kvx-*-elf) + libgloss_dir=kvx-elf + ;; + kvx-*-mbr) + libgloss_dir=kvx-mbr + ;; + kvx-*-cos) + libgloss_dir=kvx-cos + ;; hppa*-*-*) libgloss_dir=pa ;; @@ -1229,6 +1238,9 @@ case "${target}" in i[[3456789]]86-*-rdos*) noconfigdirs="$noconfigdirs gdb" ;; + kvx-*-*) + noconfigdirs="$noconfigdirs gdb sim" + ;; mmix-*-*) noconfigdirs="$noconfigdirs gdb" ;;