From patchwork Wed Apr 13 11:20:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 52848 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E55113858C54 for ; Wed, 13 Apr 2022 11:21:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E55113858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649848894; bh=PU9uWdG5PN+8CVamUl+w7cjdU0wR0+lM0tJlkccPpcQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=S4AKmZia+Gv4fADRFliGcvroR8+5pJ+rwZIi6HOKVWXUhps8+TTK8vdcYYE6Ho7Qt W7X2htT9Wo/fZ6jOYMPjJTZLgRl7pT81agW/Spd/Y3Grb1Qtlq1HOb+svaj+DyQbgJ ZNt29dJADxLFQgO3nDkOAd5kav8FADO396c4nqX4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40086.outbound.protection.outlook.com [40.107.4.86]) by sourceware.org (Postfix) with ESMTPS id 839FF385843E for ; Wed, 13 Apr 2022 11:20:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 839FF385843E Received: from AM6PR10CA0063.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:209:80::40) by VI1PR0801MB2000.eurprd08.prod.outlook.com (2603:10a6:800:8e::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 11:20:35 +0000 Received: from AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:80:cafe::49) by AM6PR10CA0063.outlook.office365.com (2603:10a6:209:80::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29 via Frontend Transport; Wed, 13 Apr 2022 11:20:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT051.mail.protection.outlook.com (10.152.16.246) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Wed, 13 Apr 2022 11:20:34 +0000 Received: ("Tessian outbound 9511859e950a:v118"); Wed, 13 Apr 2022 11:20:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 356034002813dfbd X-CR-MTA-TID: 64aa7808 Received: from 42dea5e54733.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0397DFDD-AB33-4439-B0F6-79CAE236FB28.1; Wed, 13 Apr 2022 11:20:28 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 42dea5e54733.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Apr 2022 11:20:28 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PRZ146pSbMAfljG947XaIrdCe9VMLdBytsGHc9YeiNwwYiNZGhsYtHzeA3fTXLVbUidVCJy2M2rG9HSCe7fewb1Cj45j7DO486ttXtjudAvJzkPixMQnN6RmM+vJDhMh2TNOQZdtPGFmZ1VQde/rGVKAELX0OI73ypK+14kNTyOqV9d1PVk9CT9+kM+4w6KEqCW/ni8dQMiU2D0CcIcEwJZoFrOT8fyuQSgSz/Ld+MrAjtt1LzDH6mWUXgeAzDC6uNf5zyrVREmR1+Kd+bWDrRcAM/x21v+UJyEnUnxL/q+DVV0HGaF0/dWxa12BAM/oMKJmx01+lz5AqwwTTfdtNA== 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=PU9uWdG5PN+8CVamUl+w7cjdU0wR0+lM0tJlkccPpcQ=; b=aWTwvqwBAEpvfN9ks/dTgNqLLmgdeBvtgxvf4DHpP6sNgsEo60NX2lTiVlupeEy8CBynpAMCvtPJ+0N0DBqT3nzvnWu6HJ4BXpq18npMTgjjC4VhhtXDAk0n9Ya9lclWr9k31EM8bUkiTDDwDTcQSULpT1nRxNMb8HVcCBdII1TP6r8GC8XRuANF+zyJxbXz6B6HrZPSoLGdzOFpqll8HcYSInnN755r8ijduh4zNRA1IBzer0JlX5PdXkC96pLbSO516dhWJ8RTIXCjoU0MRNRpJK/aI6/QByGwQBZCBm87YPtplDWWD6oQ04J7cJteIcoDiJ+e8zTlw/jZnGeu3w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6PR04CA0014.eurprd04.prod.outlook.com (2603:10a6:20b:92::27) by AM4PR0802MB2210.eurprd08.prod.outlook.com (2603:10a6:200:5f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 11:20:20 +0000 Received: from VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::94) by AM6PR04CA0014.outlook.office365.com (2603:10a6:20b:92::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Wed, 13 Apr 2022 11:20:20 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT007.mail.protection.outlook.com (10.152.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Wed, 13 Apr 2022 11:20:19 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.27; Wed, 13 Apr 2022 11:20:26 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.27; Wed, 13 Apr 2022 11:20:18 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 13 Apr 2022 11:20:26 +0000 To: Subject: [PATCH v2 1/2] aarch64: Use generic argv adjustment in ld.so [BZ #23293] Date: Wed, 13 Apr 2022 12:20:18 +0100 Message-ID: <4a157fa95462503bd1b6c3218644a0334ae52325.1649848608.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: b9344a87-e135-4eb9-f2a0-08da1d3fa125 X-MS-TrafficTypeDiagnostic: AM4PR0802MB2210:EE_|AM5EUR03FT051:EE_|VI1PR0801MB2000:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: pPC5HEe0EMQ+2KE5fytl4OIwmVGOmvW6dbfDBuMUq/jDiqYC1FQ7qeX4HBM99Ja19+d8VrDyW9GS2DuGPrBSLcELljlYRR8zUQfHNCZq0P3Vd2EF7jRNAc4Sw8jJmYTs0ueOiHqJsF0GCPDu/ukX7o+mVwNwnKcgXDwDY3SWVPiL6hCsDRvgvF3F0ssF5To0obyBJ/27rDHgLxNWgyiqurqEKKaqIASiyCO0mrTNpkzCj1JNkqPJTRvE7pP1QISjz8xdHWAfnSCAnlY3NhZrhcjivD7wsF/z6nN3pw5P7f/fT0HVgSyZ5hnVC/4azRtZvmyX+8M/k8mVu0rco2IlkFf4MUE6q6spWuNGteI3dkDXgrdOjx7e2XZPdpJGLR1kypPuCuZ95blniIFQR4yZ5xP/0ymPEsyaRhQ5l0An+IV8Asay9UgN7JYRXnmBx06FCih7dQ389TQe9+XZyl22tTQWvLbr+bY2V6382JGQl2lynuCGbzYkDU6J4s5n3qYqdeF/XGbz1iFY4VxL23SzmfclA/xlWwDA2mlHh+ZYBFDtSRISGLVXrhkcvkdsV94l8YaGBC0uLzfPLrFFko1/CHY4FHM8N33zuOfJfYD+xdyaE4s1KVjYds02cRiyEQICWonanF3cOwpBsI0k2CV+HaIrw/xQmX39xpwSLVOxclRt+UD5+fmN6SVCrtzGlzTQ96jMemuZ3D0cvf6qpTTvIm51jT5qIZkklagSvs+pwqo= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(46966006)(36840700001)(356005)(86362001)(83380400001)(47076005)(5660300002)(40460700003)(6666004)(81166007)(36860700001)(2906002)(508600001)(7696005)(8936002)(82310400005)(44832011)(26005)(186003)(426003)(336012)(316002)(6916009)(8676002)(70586007)(70206006)(2616005)(36756003)(41533002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0802MB2210 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 37b7ffbb-1a73-413c-fa27-08da1d3f97e4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NoTWZta3q6yPi6qvLWD7pnJ5xfI7EKqHg2bnYmyDH6Ci249e5SlwbEAHd2bzYyxkYR4amB8Q5T4+Oqeu66Ger52kuoFjfsAVwhTxqcilF69a9V4H+y40DAzX1zdgB30Yj20kfZFimEOOuPEPSpQRVtMn/B5Byay0pPpf1QO/bEbel64dVC9dSF8qaE/ntDYIVd+bmNJrkBK9A0bIUMFmo57p+P5rVwu1SXliG33Vk5uTLGTsuWWQHb1Hk9l8opcpNhz7695Y8kh/M0tw3VVb4W7KsVE/YT9j7gxU/TAecemi2R2t6+Di0Y/E7jbDX9ap727NwP+7WuR6UPU78W6YmzKicIS6UsWzN28nZ++BRzGFD/+ZwN++sJyjmmxPx9j1PDBO493ohzemAWngdSkqoxEAy7wlieptRB37BjCZyt+55Nvq8crWD7yVdg5OQKTN/Fi7ton2TJF7sDMH26QrBdeN1bBvpYP1fy5w4VM0L9g7QuNiiMQNG3pGI7ohg0titIzPuVRz9S3yzAoFMVpG60Tjw9MJwFiyWC4NUyY/YLrsmA2gqa+vFGoQbU9achgmjpjKsHkmsP8WzGFxKbimL1sNJubJztiD+qliMySazu+ru3KAOB6QMiQa0x3XQvMBuRXpNxEivusOYTDxY4uUQDzw8Q2x9APnAopAUqmvTZQeg8pkWBZ1g30Q/7NLacO8aySqhbQzM7T7UBHY+EZmHg== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(44832011)(5660300002)(36860700001)(8676002)(6916009)(316002)(83380400001)(36756003)(81166007)(8936002)(508600001)(40460700003)(70206006)(70586007)(2906002)(6666004)(7696005)(82310400005)(26005)(2616005)(47076005)(336012)(186003)(426003)(86362001)(41533002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2022 11:20:34.9476 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9344a87-e135-4eb9-f2a0-08da1d3fa125 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT051.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0801MB2000 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" When an executable is invoked as ./ld.so [ld.so-args] ./exe [exe-args] then the argv is adujusted in ld.so before calling the entry point of the executable so ld.so args are not visible to it. On most targets this requires moving argv, env and auxv on the stack to ensure correct stack alignment at the entry point. This had several issues: - The code for this adjustment on the stack is written in asm as part of the target specific ld.so _start code which is hard to maintain. - The adjustment is done after _dl_start returns, where it's too late to update GLRO(dl_auxv), as it is already readonly, so it points to memory that was clobbered by the adjustment. This is bug 23293. - _environ is also wrong in ld.so after the adjustment, but it is likely not used after _dl_start returns so this is not user visible. - _dl_argv was updated, but for this it was moved out of relro, which changes security properties across targets unnecessarily. This patch introduces a generic _dl_start_args_adjust function that handles the argument adjustments after ld.so processed its own args and before relro protection is applied. It sets _dl_skip_args to 0 so the existing adjustment in asm is not invoked. Each target has to opt-in to use this new adjustment since some targets don't need it. Once all targets are updated, _dl_argv declaration can be simplified. A new _dl_start_argptr was introduced because the original sp is not passed to dl_main which now has to do the adjustments. --- v2: - use p != NULL, and a_type != AT_NULL - remove the confusing paragraph from the commit message. --- elf/rtld.c | 58 +++++++++++++++++++++++++++++ sysdeps/aarch64/dl-sysdep.h | 2 +- sysdeps/generic/ldsodefs.h | 3 ++ sysdeps/unix/sysv/linux/dl-sysdep.c | 10 +++++ 4 files changed, 72 insertions(+), 1 deletion(-) diff --git a/elf/rtld.c b/elf/rtld.c index 19e328f89e..bc4d59f5d6 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1311,6 +1311,60 @@ rtld_setup_main_map (struct link_map *main_map) return has_interp; } +#ifdef DL_NEED_START_ARGS_ADJUST +static void +_dl_start_args_adjust (void) +{ + void **sp; + void **p; + long argc; + char **argv; + ElfW(auxv_t) *auxv; + + if (_dl_skip_args == 0) + return; + + sp = _dl_start_argptr; + + /* Adjust argc on stack. */ + argc = (long) sp[0] - _dl_skip_args; + sp[0] = (void *) argc; + + argv = (char **) (sp + 1); /* Necessary aliasing violation. */ + p = sp + _dl_skip_args; + /* Shuffle argv down. */ + do + *++sp = *++p; + while (*p != NULL); + + /* Shuffle envp down. */ + do + *++sp = *++p; + while (*p != NULL); + + auxv = (ElfW(auxv_t) *) (sp + 1); /* Necessary aliasing violation. */ + /* Shuffle auxv down. */ + void *a, *b; /* Use a pair of pointers for an auxv entry. */ + unsigned long a_type; + do + { + a_type = ((ElfW(auxv_t) *) (p + 1))->a_type; + a = *++p; + b = *++p; + *++sp = a; + *++sp = b; + } + while (a_type != AT_NULL); + + /* Update globals in rtld. */ + _dl_argv = argv; + _environ = argv + argc + 1; + GLRO(dl_auxv) = auxv; + /* No longer need to skip args. */ + _dl_skip_args = 0; +} +#endif + static void dl_main (const ElfW(Phdr) *phdr, ElfW(Word) phnum, @@ -1615,6 +1669,10 @@ dl_main (const ElfW(Phdr) *phdr, /* Set the argv[0] string now that we've processed the executable. */ if (argv0 != NULL) _dl_argv[0] = argv0; +#ifdef DL_NEED_START_ARGS_ADJUST + /* Adjust arguments for the application entry point. */ + _dl_start_args_adjust (); +#endif } else { diff --git a/sysdeps/aarch64/dl-sysdep.h b/sysdeps/aarch64/dl-sysdep.h index 667786671c..1df4c2c528 100644 --- a/sysdeps/aarch64/dl-sysdep.h +++ b/sysdeps/aarch64/dl-sysdep.h @@ -20,6 +20,6 @@ /* _dl_argv cannot be attribute_relro, because _dl_start_user might write into it after _dl_start returns. */ -#define DL_ARGV_NOT_RELRO 1 +#define DL_NEED_START_ARGS_ADJUST 1 #define DL_EXTERN_PROTECTED_DATA diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index 29f005499b..f322d36570 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -785,6 +785,9 @@ extern unsigned int _dl_skip_args attribute_hidden attribute_relro # endif ; +# ifdef DL_NEED_START_ARGS_ADJUST +extern void **_dl_start_argptr attribute_hidden attribute_relro; +# endif #endif #define rtld_progname _dl_argv[0] diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index c90f109b11..66f003e2a3 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -58,6 +58,12 @@ void *__libc_stack_end attribute_relro = NULL; rtld_hidden_data_def(__libc_stack_end) void *_dl_random attribute_relro = NULL; +#ifdef DL_NEED_START_ARGS_ADJUST +/* Original sp at ELF entry, used when rtld is executed explicitly + and needs to adjust arg components for the actual application. */ +void **_dl_start_argptr attribute_hidden attribute_relro = NULL; +#endif + #ifndef DL_STACK_END # define DL_STACK_END(cookie) ((void *) (cookie)) #endif @@ -114,6 +120,10 @@ _dl_sysdep_start (void **start_argptr, __brk (0); /* Initialize the break. */ +#ifdef DL_NEED_START_ARGS_ADJUST + _dl_start_argptr = start_argptr; +#endif + #ifdef DL_PLATFORM_INIT DL_PLATFORM_INIT; #endif From patchwork Wed Apr 13 11:20:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 52849 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B8E3F385781A for ; Wed, 13 Apr 2022 11:22:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8E3F385781A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649848943; bh=q+QEoXKip4HpOwb+W5woJyupkWrCELHJnV7W8tVWjnE=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=HnT8SnmrbbDsQ06NlSXZlP9KGZ+mxHrr6ynxq5/qMwMtmLDjBgi57JvvKzMizv2MZ bXxOmyBntjWoOu+qt/75eYQ4mi5jogIK40Jqm/FLo5+nkGpsCinEkdmr5NyJv3vL3C 33GtJQwTT6tiQgivy7i3ekuF3yD1suHr9e3U2MOA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60044.outbound.protection.outlook.com [40.107.6.44]) by sourceware.org (Postfix) with ESMTPS id 638DE385843E for ; Wed, 13 Apr 2022 11:20:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 638DE385843E Received: from AM0PR05CA0096.eurprd05.prod.outlook.com (2603:10a6:208:136::36) by AM9PR08MB6241.eurprd08.prod.outlook.com (2603:10a6:20b:281::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 11:20:43 +0000 Received: from VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:136:cafe::3c) by AM0PR05CA0096.outlook.office365.com (2603:10a6:208:136::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.30 via Frontend Transport; Wed, 13 Apr 2022 11:20:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT044.mail.protection.outlook.com (10.152.19.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.19 via Frontend Transport; Wed, 13 Apr 2022 11:20:43 +0000 Received: ("Tessian outbound ac9bb5dd84f6:v118"); Wed, 13 Apr 2022 11:20:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 616b607c96e7a026 X-CR-MTA-TID: 64aa7808 Received: from 177547799cce.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 2CD1EB42-0A0C-4465-BA41-D72635C8EDFB.1; Wed, 13 Apr 2022 11:20:35 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 177547799cce.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 13 Apr 2022 11:20:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b02DpULhLtdCVeTKLntP3cmVk3m8vLyanmmNaCsxWQ5Be8TkdE3hhTEU/stRoRHSRks7jSNS9Foyw86+RcmlBQCtcjVBpPJFqP/67YbxuiUPsOaPEho/NV86ft3zjbys4qqm4Mp2o5F+dnFLwxCro6/zvca0qzdoFksIEvBcHMsW3wfWtjTvmNYzHxA3A909e9hQwAlLv/DAduAjAl+ADxHGeglHaqN1s6X4Obxv/HDHMXXMFLNCq1AKDXe9I2oD18rFx+xweY+C9gJHsVMomWDIuNBxnR21ToMJ5Le3c8eZcOioitoPP2YM5gU7B7rKC5e5HUd8oV9joAZ6k1PGPQ== 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=q+QEoXKip4HpOwb+W5woJyupkWrCELHJnV7W8tVWjnE=; b=Lc1W6OKKhusxJRDVSOSl1JhpuTYnN1draw3MzdgNfqgqnYi+r0SzYKpFS26GkFn0JS27g1o8f+p93CuILh1OU28ikQLWefO3oZ/Ke6dVsggA2tweLBzMbCXQ5Pn+bxEh66zV0/Ob/Tlf6nlE7bdN2kTw9Li9TNR85iF8ZqvtrZjOTCOL1tWXKMMdSCcXR4j9w/dqusj9MNEze0pxZA4Ms/yJ51nyBbcT7CJstb1lsXug2nGG/tc5qmUKb0O/2gGW9SoAbaxsNdp63Jbm7/xaj2tg4hPjeXJTR6IlvqEksXEvpEPnou7yWPmY200fjzgTUUxA00D/v/qfdA551OqvLg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none Received: from AM6PR04CA0029.eurprd04.prod.outlook.com (2603:10a6:20b:92::42) by DB9PR08MB6991.eurprd08.prod.outlook.com (2603:10a6:10:2c5::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5144.29; Wed, 13 Apr 2022 11:20:33 +0000 Received: from VE1EUR03FT007.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:92:cafe::10) by AM6PR04CA0029.outlook.office365.com (2603:10a6:20b:92::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5164.20 via Frontend Transport; Wed, 13 Apr 2022 11:20:33 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; Received: from nebula.arm.com (40.67.248.234) by VE1EUR03FT007.mail.protection.outlook.com (10.152.18.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5164.19 via Frontend Transport; Wed, 13 Apr 2022 11:20:33 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 13 Apr 2022 11:20:37 +0000 Received: from armchair.cambridge.arm.com (10.2.80.71) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Wed, 13 Apr 2022 11:20:37 +0000 To: Subject: [PATCH v2 2/2] aarch64: Move ld.so _start to separate file Date: Wed, 13 Apr 2022 12:20:29 +0100 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 1b2b6884-95e0-4d43-267c-08da1d3fa613 X-MS-TrafficTypeDiagnostic: DB9PR08MB6991:EE_|VE1EUR03FT044:EE_|AM9PR08MB6241:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: DY87hKGVFllEbg0GsWEOwi2SpSHnBA/qqbSWDn6MXfg1ipbxA6Wz1zTUhLcCGdSlO1F+8XWf+zDF6iPMbfM8cmrY1t/8GYJFU04/1cqNrU1TbfJ9r4lFaohvIAyIgzkjqdJaluIrmNgjAwtvrDLcppg85YTi8e3JLfJR14do5TR25yP6hUIIjHq2ih9HRLNqdCEmEOyVR8CvnTYGIoBvlqxOl6op6KzQcWfWEvX2d/kRkZo7lCEyW+rCc5OBSYFHmo3D6iu6eWwxrXdfjMvJnPVoLojZBbDRfKSkbqws6q/wqaRn0NEbRqkz2EQ+hNnfH7BfyVc8do83ezGcVHslIClINXdx3qAseyt1LuAPWvK3zKNkjW56tJTPUqS5PADkuKc/Q+CdK7Nm1meDFuaRmV/XM6nUQhyO/L972sbMPRraCE3x5IKPQUO/LbTdArfrQgXB2jZ3C2uwpDSQW0IwZFYnJaQ08C5wMkEFJ5//lowlfSqavzjjB1KvZAOiQ+lt+TVqKDfbCoUqV1CEmLRlOmixkXGoh/6zlfdi02DIwn2ZhECKWpzU7JtsW/NYDNA2LEuiJsscpZgIyiD44r4jgw2YXPOakIu8XfGXQE+SMvWEhE7S+8fYkS6M9XO+Bz8pPafgnF7rnKJ3km/tc7wDYf8Brab4NXqx8Gu/JMy6FYU7sMF4isVshdxEeH8pgk34ycB0NiGdtT8hHZO4ibximpRXrBrhP0yEYGsN0hvSqfwT3F08hW9DbH6d9pCimvqrTEbZSqSIQSGlHzWBlHyQHuJEsw+e5OffvU81yEKf6J2a+3yjts9As5Vydgcgaq5S X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230001)(4636009)(40470700004)(36840700001)(46966006)(2616005)(186003)(426003)(40460700003)(81166007)(2906002)(70586007)(6916009)(8676002)(70206006)(316002)(5660300002)(82310400005)(36860700001)(508600001)(336012)(26005)(44832011)(36756003)(47076005)(8936002)(356005)(7696005)(83380400001)(6666004)(86362001)(2004002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6991 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 0778feb5-8d6d-4fd5-296a-08da1d3fa019 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7FYzcnjfYowlV8mOJA01rlJgmnQQHIq7wPyvuiFvMqFHhVb33PAOPo8vmFCnlbJQOESnv2wIeOkBuFvFns8ShNONZwuo+DFFE10x39rNUa0rONEuwii2Im5CAqme36JCOgZZDXt2vo8BdtU01/A/WIQD3dveDazvtOgd7FqXo5Z97nPc3qT9rUIfiB3vznRMRZtTGOMN4uzjjUuvKrzXf5056QCOQYchdkaf9zAlfpAKpbdE4bPsTrz69zMVvhCh38shZEMVX7Th2vn6+DuVproYk94Zkk+03KdE0jG8/25vupFyfVexzBV5t67wgPhWTCdb/y2MBTbUWPzqo1S0IVGyHOhizXfbld06iJcnNrJ9ryyTP3qEcCgDpBq5Ey7VNE/usa7P8BaSDpmvJTWzHdBhGabhueC6eosTiwE+xs8Llw+COBi7iqtN79oboMUKrcJUox8p23mIU5JQ6S5ByJ5HAsGKs4KWb5fB5OpoB26QJd+VpstuS8dd1CLLpQtFtoYXohmtbr9sEVM8g/eqqX748ZlXqpqdjzGHm/Hxx6gaKz6+Pu7omGJ3xwpRT6DLbvAEsnSx10vWkyt2lYauh9pUD0Vc+tp/Vosilqvmg3MbQmDPKoI4z8pXLRZAB/3F2Lyd/90qSeV+a0tibrjSYBKZ0Y2sE/nytuslUk6RXfpgVEhSKCGinZq8euLYUybcDpOmlu/jyxCsntCoCzNw9S1NG/4r752ymXDKEduwPofXmJEAXDQaSSpcIVfoy47TTw1+DIMtCl6IZrD2H+rD2g== X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFS:(13230001)(4636009)(46966006)(36840700001)(40470700004)(6666004)(82310400005)(7696005)(508600001)(336012)(47076005)(70206006)(2616005)(316002)(36756003)(5660300002)(44832011)(83380400001)(26005)(186003)(2906002)(40460700003)(70586007)(426003)(86362001)(8676002)(36860700001)(6916009)(81166007)(8936002)(2004002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2022 11:20:43.1649 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1b2b6884-95e0-4d43-267c-08da1d3fa613 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: VE1EUR03FT044.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB6241 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Szabolcs Nagy via Libc-alpha From: Szabolcs Nagy Reply-To: Szabolcs Nagy Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" A separate asm file is easier to maintain than a macro that expands to inline asm. The RTLD_START macro is only needed now because _dl_start is local in rtld.c, but _start has to call it, if _dl_start was made hidden then it could be empty. --- v2: - fix typo in commit message. --- sysdeps/aarch64/Makefile | 1 + sysdeps/aarch64/dl-machine.h | 77 +----------------------------------- sysdeps/aarch64/dl-start.S | 53 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 75 deletions(-) create mode 100644 sysdeps/aarch64/dl-start.S diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 7183895d04..17fb1c5b72 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -33,6 +33,7 @@ tst-audit27-ENV = LD_AUDIT=$(objpfx)tst-auditmod27.so endif ifeq ($(subdir),elf) +sysdep-rtld-routines += dl-start sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index b40050a981..fe120bb507 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -105,81 +105,8 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], return lazy; } -/* Initial entry point for the dynamic linker. The C function - _dl_start is the real entry point, its return value is the user - program's entry point */ -#ifdef __LP64__ -# define RTLD_START RTLD_START_1 ("x", "3", "sp") -#else -# define RTLD_START RTLD_START_1 ("w", "2", "wsp") -#endif - - -#define RTLD_START_1(PTR, PTR_SIZE_LOG, PTR_SP) asm ("\ -.text \n\ -.globl _start \n\ -.type _start, %function \n\ -.globl _dl_start_user \n\ -.type _dl_start_user, %function \n\ -_start: \n\ - // bti c \n\ - hint 34 \n\ - mov " PTR "0, " PTR_SP " \n\ - bl _dl_start \n\ - // returns user entry point in x0 \n\ - mov x21, x0 \n\ -_dl_start_user: \n\ - // get the original arg count \n\ - ldr " PTR "1, [sp] \n\ - // get the argv address \n\ - add " PTR "2, " PTR_SP ", #(1<<" PTR_SIZE_LOG ") \n\ - // get _dl_skip_args to see if we were \n\ - // invoked as an executable \n\ - adrp x4, _dl_skip_args \n\ - ldr w4, [x4, #:lo12:_dl_skip_args] \n\ - // do we need to adjust argc/argv \n\ - cmp w4, 0 \n\ - beq .L_done_stack_adjust \n\ - // subtract _dl_skip_args from original arg count \n\ - sub " PTR "1, " PTR "1, " PTR "4 \n\ - // store adjusted argc back to stack \n\ - str " PTR "1, [sp] \n\ - // find the first unskipped argument \n\ - mov " PTR "3, " PTR "2 \n\ - add " PTR "4, " PTR "2, " PTR "4, lsl #" PTR_SIZE_LOG " \n\ - // shuffle argv down \n\ -1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\ - str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "5, #0 \n\ - bne 1b \n\ - // shuffle envp down \n\ -1: ldr " PTR "5, [x4], #(1<<" PTR_SIZE_LOG ") \n\ - str " PTR "5, [x3], #(1<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "5, #0 \n\ - bne 1b \n\ - // shuffle auxv down \n\ -1: ldp " PTR "0, " PTR "5, [x4, #(2<<" PTR_SIZE_LOG ")]! \n\ - stp " PTR "0, " PTR "5, [x3], #(2<<" PTR_SIZE_LOG ") \n\ - cmp " PTR "0, #0 \n\ - bne 1b \n\ - // Update _dl_argv \n\ - adrp x3, __GI__dl_argv \n\ - str " PTR "2, [x3, #:lo12:__GI__dl_argv] \n\ -.L_done_stack_adjust: \n\ - // compute envp \n\ - add " PTR "3, " PTR "2, " PTR "1, lsl #" PTR_SIZE_LOG " \n\ - add " PTR "3, " PTR "3, #(1<<" PTR_SIZE_LOG ") \n\ - adrp x16, _rtld_local \n\ - add " PTR "16, " PTR "16, #:lo12:_rtld_local \n\ - ldr " PTR "0, [x16] \n\ - bl _dl_init \n\ - // load the finalizer function \n\ - adrp x0, _dl_fini \n\ - add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ - // jump to the user_s entry point \n\ - mov x16, x21 \n\ - br x16 \n\ -"); +/* In elf/rtld.c _dl_start should be global so dl-start.S can reference it. */ +#define RTLD_START asm (".globl _dl_start"); #define elf_machine_type_class(type) \ ((((type) == AARCH64_R(JUMP_SLOT) \ diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S new file mode 100644 index 0000000000..a3a57bd5a1 --- /dev/null +++ b/sysdeps/aarch64/dl-start.S @@ -0,0 +1,53 @@ +/* ld.so _start code. + Copyright (C) 2022 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +ENTRY (_start) + /* Create an initial frame with 0 LR and FP */ + cfi_undefined (x30) + mov x29, #0 + mov x30, #0 + + mov x0, sp + PTR_ARG (0) + bl _dl_start + /* Returns user entry point in x0. */ + mov PTR_REG (21), PTR_REG (0) +.globl _dl_start_user +.type _dl_start_user, %function +_dl_start_user: + /* Get argc. */ + ldr PTR_REG (1), [sp] + /* Get argv. */ + add x2, sp, PTR_SIZE + /* Compute envp. */ + add PTR_REG (3), PTR_REG (2), PTR_REG (1), lsl PTR_LOG_SIZE + add PTR_REG (3), PTR_REG (3), PTR_SIZE + adrp x16, _rtld_local + add PTR_REG (16), PTR_REG (16), :lo12:_rtld_local + ldr PTR_REG (0), [x16] + bl _dl_init + /* Load the finalizer function. */ + adrp x0, _dl_fini + add PTR_REG (0), PTR_REG (0), :lo12:_dl_fini + /* Jump to the user's entry point. */ + mov x16, x21 + br x16 +END (_start)