From patchwork Mon Feb 15 12:03:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42043 X-Patchwork-Delegate: azanella@linux.vnet.ibm.com 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 1253A3951C1D; Mon, 15 Feb 2021 12:03:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1253A3951C1D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390602; bh=YuJrvpT5gwhaz+358P/wSQY9SEOO/KLMwa7K0Er3SxE=; 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=NkWW2yZgl6OLJDCMzpnMwN19V8gXYUeSPsUBBouf9207sVP+3GFecNdx6h/p9+E5J Mj6P/rvlsYky29E0HYo94+lIL/oqHmRWDqYk+TUAxA9Rja4jTyF0NMD1fCZH/lFrwD lJdHtSckTWHrVJUt4aEOK5hRgbGCKYr/K3TpX46A= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60085.outbound.protection.outlook.com [40.107.6.85]) by sourceware.org (Postfix) with ESMTPS id EEE1C3951C1D for ; Mon, 15 Feb 2021 12:03:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EEE1C3951C1D Received: from AM6P191CA0019.EURP191.PROD.OUTLOOK.COM (2603:10a6:209:8b::32) by AM0PR08MB3266.eurprd08.prod.outlook.com (2603:10a6:208:66::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.26; Mon, 15 Feb 2021 12:03:16 +0000 Received: from AM5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8b:cafe::f7) by AM6P191CA0019.outlook.office365.com (2603:10a6:209:8b::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 12:03:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;sourceware.org; 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 AM5EUR03FT042.mail.protection.outlook.com (10.152.17.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.25 via Frontend Transport; Mon, 15 Feb 2021 12:03:15 +0000 Received: ("Tessian outbound af289585f0f4:v71"); Mon, 15 Feb 2021 12:03:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 7c927ee53020855e X-CR-MTA-TID: 64aa7808 Received: from f050e3d88eed.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 44B0F551-BFBF-4FCF-A112-1810C3B565BD.1; Mon, 15 Feb 2021 12:03:10 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id f050e3d88eed.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 12:03:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S8TY6YsuSyaoMsZW1pXk46Flo0a9AhJBd3PyJTLMg9YObi8JL7ALgHbXyKpdkm7z/jjjmMDEEHv32PhZfYw3zKtD8Qd10McghNSA5PSwq/T0VQf/kt7QtJV0EWtCe4qw1iX2Ip1ZWRkUzWurKcV29QB3XfBPyYyzZ7hfNU9/dPPMfM6I0NYghxOTdXsejePLXQWmRt3I8IW8kbgnoP8/TvcJWwArnSEY4R0KBs8T3DfSolwjaia4gIAnYKGydPBDbCEA3wbqAqvZ8ekdbDvulyKII7VtYaGBTF4CFHqdlQtTUq2KKs/mXuCGw1gnh4C6XAR/8OgO+6PSwia3EPzUsw== 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-SenderADCheck; bh=YuJrvpT5gwhaz+358P/wSQY9SEOO/KLMwa7K0Er3SxE=; b=Inx/Vr0X845T11Z8/FuCEhWDJGZ4BJeFJf1GXdYVHF8/6YkkMLUro3pGwAOlQ8ysgyY25iy3gUy284b5b2fmVK1VXNEIzA2+jp3Iho+LwQ/0S+lK6dhhjO4NUGPtaLFwTEAunk7bClfhoXJfiEHufet2ZLwHU5fbDt7tQss8Oh2HMv6Njz96PdghA7AN8wJfHYVTdETOnX8KM5OdMKmQzINTj//Y8fDKwKIPhIjc9CX5V0MNCLmPIdf5WjpFQJCRm5QJCYI16TcG8oAzSH3Ppv3FIbt4eHu+wUN+Ww4SCM9bWlQev6cv5Xub+0k2uteajbALA9O/M3hoQ7DSfwm2gQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) by PA4PR08MB6208.eurprd08.prod.outlook.com (2603:10a6:102:e5::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.28; Mon, 15 Feb 2021 12:03:08 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::60f0:3773:69b8:e336%2]) with mapi id 15.20.3846.042; Mon, 15 Feb 2021 12:03:08 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 14/15] i386: Remove lazy tlsdesc relocation related code Date: Mon, 15 Feb 2021 12:03:02 +0000 Message-Id: <9a60780a0f26c6bd124f0e06b8e1e25cce7728b3.1613390045.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: LO2P123CA0108.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::23) To PA4PR08MB6320.eurprd08.prod.outlook.com (2603:10a6:102:e5::9) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.49) by LO2P123CA0108.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.38 via Frontend Transport; Mon, 15 Feb 2021 12:03:08 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9b42a71d-9337-4b2e-7a2b-08d8d1a9ad41 X-MS-TrafficTypeDiagnostic: PA4PR08MB6208:|AM0PR08MB3266: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: zXO3GMS/1pYKwwVLptSFSMu+53ZOZAIgkk4bX4bHqhtYWfGn6J7FNf8409LNc/m4BcLYIH9Mk8e71QMwDRezmWPvesZZVgzgZKPa0HFthR7I1pWeQ++VhsGmXa9ORi14kXEo4OQ1pvmsOHN2jkIrVfWUtIjYI9mEKyuyCw2I36me+bsx92pS8c6hn4S66Icz6sTidfVSiot4VNsZEGZWwYWmDeubaVcCYJT43bFtjcw1kDiQciO+o9ix8soadn61Ol+N/Piz2FDaT01DBeRQqggUnAm9AfaloBjUe7zKI36bw7YtycyMkbUVIZp8EUuW8fnyVp3yu4m8XCbo8jGdHLCJLtB8lqtYDw5nW9bDF6kvo9Sn6KQxdXh5Q2bfHj0tfU0K5RTF1Qx9xWY6anEe9zjxyDWC4T0tJ9MW7Ar1tjlraH1kCS3ZmQ8zUgHrzbb8SryawBAy5QGzLb3Ltd58kuWnbhguoVIqQnvrH7DPQ0U8QdgZ/r9U8k1Zh9wUdhLrcPPKutdRql8IQUeAIq1XSDk/sDQo6/yT0bPnCFxzQVXuU4okPHQKjiJnoEUChXxeIjp+Go272ZEDZAkmiNGwkNJesJsDcxYfcLGtaK+NWCKIuJQcoutp2BPci3QLEz/o/cI5yokS2eFxHfSeNewBXg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PA4PR08MB6320.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(396003)(346002)(136003)(376002)(39850400004)(2616005)(956004)(44832011)(66476007)(2906002)(16526019)(66946007)(66556008)(6916009)(186003)(36756003)(6486002)(478600001)(30864003)(5660300002)(26005)(6666004)(86362001)(6506007)(69590400012)(316002)(83380400001)(8936002)(8676002)(52116002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zKIHgNFhO/1W7/1OtMNwPSmc415gYSxu1XXRXs6pH7DeJm6r2CIT3ouqwx3f9K2i9G5PBZqOUryGJ2xtyI/YhBgR9/mdqifkAtjrY5KV4zfY6VU9m9OYajXgH5F50SRRQAaECTHHWCR8NuPjqAszUuebde1ZoFVam0vbmHHRmF0+YYG5833Z8AyBnof76tIc6Hai7oqHPBgDc46vEo9ZYPTdKLrqk2o17D3ZMfPBmoqzSaw033Oj0UBxuPu0cU0kEybUelBv0OR2MEnhXMZloTGpbymWYXOmzeZY/9bXGcVABL8gujt/lM9p0ZnBkqqOB93vzNAd2/CD07+HWHn8xes+ed08uOIM/9AdA+KmrAebHh9jDQVcOnO6qoY6Dw0UR6ffUT6NQjIP28QpduKtu1aKxyRfeSeAhWJ2dvk5AVkPlXDn8hUU+tuE1EWtW/DzOLhp896uxOG5b2SP+RkTog4nRm68JP8Xf9Z6Suh24+w9tMMT4rmBSy1htT8u3hHRRDW4HUmplFJrMPLGGxbCHza/KiMRBFwKYScPgak9YtlMBCCSTF+XxkOmRCRiRwfPEC64KDuYKj8u6X3lE/6lpSFDVJMHkhmzMgDa7Yv/bVnTiOvhdpWEB5M1ZlNt03JFPRng2QHUCQ2EjyXKOs04GhVYzD0egrVoT81i4qsUwbxz5zFzykG+fkDGRR9XAHe9umXygjy8tgOOG/DYw+NoKRbWAR9hc+LRr448bEplyLG2dQPd4KuFMw0gNa18Q2xbtUaAUDdPWavE7KzerK4Mfbn2EWU/h8mwOSBPhRtwiYIWPWTYowqGXughwsE+uAgYyPjuLu/nPpmX/Sa9qlP2TsGAXmxH23FXN+ldgCirYE6dJr1t4ZFkqDWFU3a2XsCuvGJliuZGO41IyaxZaHtrPx26kNkAPiaftDTf/VIn1J6g76dMRrLTKS05Yq3wVufkmhENYidtDBQ8yWWwpD5k2VQlFSO73zv7CGJzRDqB79QTvlgUDD28g3hIsBOWLaeZfsN9hhnn86KXHkOTMhJg/h/nxIZk7fEnNpsSRyO3iRaIs90bunYW9bSw0CHGeR822MsuRgDla2JDwh51oBreH8Ny977K7qbjRt1BV6tA+L+GFa3igeL9CQP8vf6GZ91ff0PYjDANbn+0ny+M6AEVMmgQZTdeQpz2hef7rCHTDZL3EQPo1A2nU6aNFK/8wB7N+Qput+sp3yJ80dMt7FA7FEaRbolI2/vNwoXNwxzijfea7Q7W/SbpiHzuvoTvgqrB4ofByp3GzmP0UVQcbzitbCqput8PzPdH3jG3aMrl7MZYUGyQ5Oa1T0084IDx6tiw X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB6208 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 89d3693d-ea52-4247-b076-08d8d1a9a89a X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +5Nu8hHmqDYnB1Fwh1dVpNURlXNZOICfgwcVts0Ba+okM1hZV40Q4b02akPwh1ocSxLtTZn+yAIn4MsdYXQ1Z6rrLoexFks86Q+5NBKYyevvsBY2ET4W6YWAHFBOmrWiuDZhlYlm2dnh7nctW9vq/dZsbsY+JRjE1lVIkizD9t0bSTomnc+OjBinysGFEHqOSy/NLl+favCGTE2vnModLs8GcesGuarHE5Sp0Qwb7ejvhH6wXdww87ytnvjKb64QhWMqIqwRLVU8smen/kc+BAwDs7zy210Hf5sVR16F5y1AYTmhuake4+2XNWp6vAZw8agDZ9t4rVGwWWpXQvnJLPx4FSXeSIcxAHm33l2u/fUMJbZv7q+iSwOUE8pA3X7sxDYL9UkHdGJrMlWhLQe5b0GS+mMrDTWWlKcjNzx47kPzJh0QsjzhxHz1EJPVI21URWL8guhv8o4kwMTPa8Va8apsmZOcWgtkCqgLV2D77o3tv3HrP7iFfB4ER+Q5eHH41MSt+YXFb0kdgGlqRRj9uOjERiwBe6xGMkUham0QEnpmPthEZJNgWyJo+eS/LP3yDpYNIus3/w7kyV6x4qS/l2LCnaADLYSRhk6C3ThVw0P1x/jHI8oUNvx3/OhT8IYiYGeQv79t5IEa40b47z69dAzfkBAkDZqICWGcOxHL+gkf0ttI2m2Od/KzfQjt4o+KH/wh2vi1qpHs/mtUSMIn294hn0I6MKS7E1tuGnfYloMYL5dJIEWbe5Xmw6Y3KzHA2puoihGfmqHVZuo/96B8GQ== 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:(4636009)(136003)(39850400004)(346002)(376002)(396003)(46966006)(36840700001)(6506007)(2906002)(83380400001)(16526019)(2616005)(186003)(336012)(82740400003)(8936002)(26005)(8676002)(82310400003)(6916009)(956004)(5660300002)(86362001)(30864003)(36860700001)(70206006)(70586007)(36756003)(356005)(478600001)(6486002)(6512007)(6666004)(316002)(44832011)(69590400012)(81166007)(47076005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 12:03:15.8573 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b42a71d-9337-4b2e-7a2b-08d8d1a9ad41 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: AM5EUR03FT042.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3266 X-Spam-Status: No, score=-14.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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@sourceware.org Sender: "Libc-alpha" Like in commit e75711ebfa976d5468ec292282566a18b07e4d67 for x86_64, remove unused lazy tlsdesc relocation processing code: _dl_tlsdesc_resolve_abs_plus_addend _dl_tlsdesc_resolve_rel _dl_tlsdesc_resolve_rela _dl_tlsdesc_resolve_hold --- sysdeps/i386/dl-tlsdesc.S | 156 ------------------------- sysdeps/i386/dl-tlsdesc.h | 6 +- sysdeps/i386/tlsdesc.c | 231 +------------------------------------- 3 files changed, 2 insertions(+), 391 deletions(-) diff --git a/sysdeps/i386/dl-tlsdesc.S b/sysdeps/i386/dl-tlsdesc.S index e781d973b7..255fe88651 100644 --- a/sysdeps/i386/dl-tlsdesc.S +++ b/sysdeps/i386/dl-tlsdesc.S @@ -134,159 +134,3 @@ _dl_tlsdesc_dynamic: cfi_endproc .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic #endif /* SHARED */ - - /* This function is a wrapper for a lazy resolver for TLS_DESC - REL relocations that reference the *ABS* segment in their own - link maps. %ebx points to the caller's GOT. %eax points to a - TLS descriptor, such that 0(%eax) holds the address of the - resolver wrapper itself (unless some other thread beat us to - it) and 4(%eax) holds the addend in the relocation. - - When the actual resolver returns, it will have adjusted the - TLS descriptor such that we can tail-call it for it to return - the TP offset of the symbol. */ - - .hidden _dl_tlsdesc_resolve_abs_plus_addend - .global _dl_tlsdesc_resolve_abs_plus_addend - .type _dl_tlsdesc_resolve_abs_plus_addend,@function - cfi_startproc - .align 16 -_dl_tlsdesc_resolve_abs_plus_addend: -0: - _CET_ENDBR - pushl %eax - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %edx - cfi_adjust_cfa_offset (4) - movl $1f - 0b, %ecx - movl 4(%ebx), %edx - call _dl_tlsdesc_resolve_abs_plus_addend_fixup -1: - popl %edx - cfi_adjust_cfa_offset (-4) - popl %ecx - cfi_adjust_cfa_offset (-4) - popl %eax - cfi_adjust_cfa_offset (-4) - jmp *(%eax) - cfi_endproc - .size _dl_tlsdesc_resolve_abs_plus_addend, .-_dl_tlsdesc_resolve_abs_plus_addend - - /* This function is a wrapper for a lazy resolver for TLS_DESC - REL relocations that had zero addends. %ebx points to the - caller's GOT. %eax points to a TLS descriptor, such that - 0(%eax) holds the address of the resolver wrapper itself - (unless some other thread beat us to it) and 4(%eax) holds a - pointer to the relocation. - - When the actual resolver returns, it will have adjusted the - TLS descriptor such that we can tail-call it for it to return - the TP offset of the symbol. */ - - .hidden _dl_tlsdesc_resolve_rel - .global _dl_tlsdesc_resolve_rel - .type _dl_tlsdesc_resolve_rel,@function - cfi_startproc - .align 16 -_dl_tlsdesc_resolve_rel: -0: - _CET_ENDBR - pushl %eax - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %edx - cfi_adjust_cfa_offset (4) - movl $1f - 0b, %ecx - movl 4(%ebx), %edx - call _dl_tlsdesc_resolve_rel_fixup -1: - popl %edx - cfi_adjust_cfa_offset (-4) - popl %ecx - cfi_adjust_cfa_offset (-4) - popl %eax - cfi_adjust_cfa_offset (-4) - jmp *(%eax) - cfi_endproc - .size _dl_tlsdesc_resolve_rel, .-_dl_tlsdesc_resolve_rel - - /* This function is a wrapper for a lazy resolver for TLS_DESC - RELA relocations. %ebx points to the caller's GOT. %eax - points to a TLS descriptor, such that 0(%eax) holds the - address of the resolver wrapper itself (unless some other - thread beat us to it) and 4(%eax) holds a pointer to the - relocation. - - When the actual resolver returns, it will have adjusted the - TLS descriptor such that we can tail-call it for it to return - the TP offset of the symbol. */ - - .hidden _dl_tlsdesc_resolve_rela - .global _dl_tlsdesc_resolve_rela - .type _dl_tlsdesc_resolve_rela,@function - cfi_startproc - .align 16 -_dl_tlsdesc_resolve_rela: -0: - _CET_ENDBR - pushl %eax - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %edx - cfi_adjust_cfa_offset (4) - movl $1f - 0b, %ecx - movl 4(%ebx), %edx - call _dl_tlsdesc_resolve_rela_fixup -1: - popl %edx - cfi_adjust_cfa_offset (-4) - popl %ecx - cfi_adjust_cfa_offset (-4) - popl %eax - cfi_adjust_cfa_offset (-4) - jmp *(%eax) - cfi_endproc - .size _dl_tlsdesc_resolve_rela, .-_dl_tlsdesc_resolve_rela - - /* This function is a placeholder for lazy resolving of TLS - relocations. Once some thread starts resolving a TLS - relocation, it sets up the TLS descriptor to use this - resolver, such that other threads that would attempt to - resolve it concurrently may skip the call to the original lazy - resolver and go straight to a condition wait. - - When the actual resolver returns, it will have adjusted the - TLS descriptor such that we can tail-call it for it to return - the TP offset of the symbol. */ - - .hidden _dl_tlsdesc_resolve_hold - .global _dl_tlsdesc_resolve_hold - .type _dl_tlsdesc_resolve_hold,@function - cfi_startproc - .align 16 -_dl_tlsdesc_resolve_hold: -0: - _CET_ENDBR - pushl %eax - cfi_adjust_cfa_offset (4) - pushl %ecx - cfi_adjust_cfa_offset (4) - pushl %edx - cfi_adjust_cfa_offset (4) - movl $1f - 0b, %ecx - movl 4(%ebx), %edx - call _dl_tlsdesc_resolve_hold_fixup -1: - popl %edx - cfi_adjust_cfa_offset (-4) - popl %ecx - cfi_adjust_cfa_offset (-4) - popl %eax - cfi_adjust_cfa_offset (-4) - jmp *(%eax) - cfi_endproc - .size _dl_tlsdesc_resolve_hold, .-_dl_tlsdesc_resolve_hold diff --git a/sysdeps/i386/dl-tlsdesc.h b/sysdeps/i386/dl-tlsdesc.h index 753c03e79c..12e90da3a8 100644 --- a/sysdeps/i386/dl-tlsdesc.h +++ b/sysdeps/i386/dl-tlsdesc.h @@ -43,11 +43,7 @@ struct tlsdesc_dynamic_arg extern ptrdiff_t attribute_hidden __attribute__ ((regparm (1))) _dl_tlsdesc_return (struct tlsdesc *), - _dl_tlsdesc_undefweak (struct tlsdesc *), - _dl_tlsdesc_resolve_abs_plus_addend (struct tlsdesc *), - _dl_tlsdesc_resolve_rel (struct tlsdesc *), - _dl_tlsdesc_resolve_rela (struct tlsdesc *), - _dl_tlsdesc_resolve_hold (struct tlsdesc *); + _dl_tlsdesc_undefweak (struct tlsdesc *); # ifdef SHARED extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, diff --git a/sysdeps/i386/tlsdesc.c b/sysdeps/i386/tlsdesc.c index 0bc646541f..436a21f66b 100644 --- a/sysdeps/i386/tlsdesc.c +++ b/sysdeps/i386/tlsdesc.c @@ -16,242 +16,13 @@ License along with the GNU C Library; if not, see . */ -#include #include -#include #include #include #include +#define _dl_tlsdesc_resolve_hold 0 #include -/* The following 4 functions take an entry_check_offset argument. - It's computed by the caller as an offset between its entry point - and the call site, such that by adding the built-in return address - that is implicitly passed to the function with this offset, we can - easily obtain the caller's entry point to compare with the entry - point given in the TLS descriptor. If it's changed, we want to - return immediately. */ - -/* This function is used to lazily resolve TLS_DESC REL relocations - that reference the *ABS* segment in their own link maps. The - argument is the addend originally stored there. */ - -void -__attribute__ ((regparm (3))) attribute_hidden -_dl_tlsdesc_resolve_abs_plus_addend_fixup (struct tlsdesc volatile *td, - struct link_map *l, - ptrdiff_t entry_check_offset) -{ - ptrdiff_t addend = (ptrdiff_t) td->arg; - - if (_dl_tlsdesc_resolve_early_return_p (td, __builtin_return_address (0) - - entry_check_offset)) - return; - -#ifndef SHARED - CHECK_STATIC_TLS (l, l); -#else - if (!TRY_STATIC_TLS (l, l)) - { - td->arg = _dl_make_tlsdesc_dynamic (l, addend); - td->entry = _dl_tlsdesc_dynamic; - } - else -#endif - { - td->arg = (void*) (addend - l->l_tls_offset); - td->entry = _dl_tlsdesc_return; - } - - _dl_tlsdesc_wake_up_held_fixups (); -} - -/* This function is used to lazily resolve TLS_DESC REL relocations - that originally had zero addends. The argument location, that - originally held the addend, is used to hold a pointer to the - relocation, but it has to be restored before we call the function - that applies relocations. */ - -void -__attribute__ ((regparm (3))) attribute_hidden -_dl_tlsdesc_resolve_rel_fixup (struct tlsdesc volatile *td, - struct link_map *l, - ptrdiff_t entry_check_offset) -{ - const ElfW(Rel) *reloc = td->arg; - - if (_dl_tlsdesc_resolve_early_return_p (td, __builtin_return_address (0) - - entry_check_offset)) - return; - - /* The code below was borrowed from _dl_fixup(), - except for checking for STB_LOCAL. */ - const ElfW(Sym) *const symtab - = (const void *) D_PTR (l, l_info[DT_SYMTAB]); - const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); - const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)]; - lookup_t result; - - /* Look up the target symbol. If the normal lookup rules are not - used don't look in the global scope. */ - if (ELFW(ST_BIND) (sym->st_info) != STB_LOCAL - && __builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0) - { - const struct r_found_version *version = NULL; - - if (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL) - { - const ElfW(Half) *vernum = - (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]); - ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)] & 0x7fff; - version = &l->l_versions[ndx]; - if (version->hash == 0) - version = NULL; - } - - result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, - l->l_scope, version, ELF_RTYPE_CLASS_PLT, - DL_LOOKUP_ADD_DEPENDENCY, NULL); - } - else - { - /* We already found the symbol. The module (and therefore its load - address) is also known. */ - result = l; - } - - if (!sym) - { - td->arg = 0; - td->entry = _dl_tlsdesc_undefweak; - } - else - { -# ifndef SHARED - CHECK_STATIC_TLS (l, result); -# else - if (!TRY_STATIC_TLS (l, result)) - { - td->arg = _dl_make_tlsdesc_dynamic (result, sym->st_value); - td->entry = _dl_tlsdesc_dynamic; - } - else -# endif - { - td->arg = (void*)(sym->st_value - result->l_tls_offset); - td->entry = _dl_tlsdesc_return; - } - } - - _dl_tlsdesc_wake_up_held_fixups (); -} - -/* This function is used to lazily resolve TLS_DESC RELA relocations. - The argument location is used to hold a pointer to the relocation. */ - -void -__attribute__ ((regparm (3))) attribute_hidden -_dl_tlsdesc_resolve_rela_fixup (struct tlsdesc volatile *td, - struct link_map *l, - ptrdiff_t entry_check_offset) -{ - const ElfW(Rela) *reloc = td->arg; - - if (_dl_tlsdesc_resolve_early_return_p (td, __builtin_return_address (0) - - entry_check_offset)) - return; - - /* The code below was borrowed from _dl_fixup(), - except for checking for STB_LOCAL. */ - const ElfW(Sym) *const symtab - = (const void *) D_PTR (l, l_info[DT_SYMTAB]); - const char *strtab = (const void *) D_PTR (l, l_info[DT_STRTAB]); - const ElfW(Sym) *sym = &symtab[ELFW(R_SYM) (reloc->r_info)]; - lookup_t result; - - /* Look up the target symbol. If the normal lookup rules are not - used don't look in the global scope. */ - if (ELFW(ST_BIND) (sym->st_info) != STB_LOCAL - && __builtin_expect (ELFW(ST_VISIBILITY) (sym->st_other), 0) == 0) - { - const struct r_found_version *version = NULL; - - if (l->l_info[VERSYMIDX (DT_VERSYM)] != NULL) - { - const ElfW(Half) *vernum = - (const void *) D_PTR (l, l_info[VERSYMIDX (DT_VERSYM)]); - ElfW(Half) ndx = vernum[ELFW(R_SYM) (reloc->r_info)] & 0x7fff; - version = &l->l_versions[ndx]; - if (version->hash == 0) - version = NULL; - } - - result = _dl_lookup_symbol_x (strtab + sym->st_name, l, &sym, - l->l_scope, version, ELF_RTYPE_CLASS_PLT, - DL_LOOKUP_ADD_DEPENDENCY, NULL); - } - else - { - /* We already found the symbol. The module (and therefore its load - address) is also known. */ - result = l; - } - - if (!sym) - { - td->arg = (void*) reloc->r_addend; - td->entry = _dl_tlsdesc_undefweak; - } - else - { -# ifndef SHARED - CHECK_STATIC_TLS (l, result); -# else - if (!TRY_STATIC_TLS (l, result)) - { - td->arg = _dl_make_tlsdesc_dynamic (result, sym->st_value - + reloc->r_addend); - td->entry = _dl_tlsdesc_dynamic; - } - else -# endif - { - td->arg = (void*) (sym->st_value - result->l_tls_offset - + reloc->r_addend); - td->entry = _dl_tlsdesc_return; - } - } - - _dl_tlsdesc_wake_up_held_fixups (); -} - -/* This function is used to avoid busy waiting for other threads to - complete the lazy relocation. Once another thread wins the race to - relocate a TLS descriptor, it sets the descriptor up such that this - function is called to wait until the resolver releases the - lock. */ - -void -__attribute__ ((regparm (3))) attribute_hidden -_dl_tlsdesc_resolve_hold_fixup (struct tlsdesc volatile *td, - struct link_map *l __attribute__((__unused__)), - ptrdiff_t entry_check_offset) -{ - /* Maybe we're lucky and can return early. */ - if (__builtin_return_address (0) - entry_check_offset != td->entry) - return; - - /* Locking here will stop execution until the running resolver runs - _dl_tlsdesc_wake_up_held_fixups(), releasing the lock. - - FIXME: We'd be better off waiting on a condition variable, such - that we didn't have to hold the lock throughout the relocation - processing. */ - __rtld_lock_lock_recursive (GL(dl_load_lock)); - __rtld_lock_unlock_recursive (GL(dl_load_lock)); -} - - /* Unmap the dynamic object, but also release its TLS descriptor table if there is one. */