From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=kalrayinc.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=kalrayinc.com 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kalrayinc.com; s=sec-sig-email; t=1689925817; bh=0X5QhLCpXe74m6aLB4Bv4f/YzdoIg+8MK8YvwbpjB7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=CZEtHGMpiyLIdQCKThox3v2sLUKdw/ZNve811y6sCm2oVVZmXVAgEU9q7HzUoKxzh VjM6NxmRhipGHlRyp0Ty3mR3J8OQ0qJnGDIukiGkrSqszcSc3vAzMlwuJqgDLufaS8 hGBxY9OBOJKYy6WQ3zPji3ZXKmtnA4rd70DrsgmY= 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalrayinc.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9u2FyLy0B+uQGiqBrFzYgzm3ANo7f2wDR1fS1ZDpcFs=; b=b8Y/TGV43f8hIlVKoBzfSec3CPzSdSx9Ne+rHZ5BaT5GspDSS3mmZEI1HLaVWY85t07L3Cm8lyC2AXPId07Nx/frL62Z5IQkfPrUyJiYRRooemS0tAXFlaQMj5TBP1bI/u5x+uDdxp4jz48UpN3roba0yZoe6LyM24QSkImv9mTwkmXNF3s1wK6i4bh/N8RcblIMO6UjgZLmabRNS4Y7voLhJbCBlIaMz4FcCRA2Dg1xK9mfH8cIhMwt3X4ENgAiF2M4qXjsfYVwiP/I1ThApuVlJaxculd/kwrQfzOcg/Yrdgq6jFexEDeho5a5a9ybcdzmPqyVHXkd/+R6JSQcCQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=kalrayinc.com; From: Paul Iannetta 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> Content-Transfer-Encoding: 8bit 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 Content-Type: text/plain; charset=utf-8 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 List-Id: 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 + ;; -- 2.35.1.500.gb896f729e2