From patchwork Mon Feb 15 12:02:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42042 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 12FE63951C2B; Mon, 15 Feb 2021 12:03:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 12FE63951C2B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1613390599; bh=fY510zbhBdiSBRlQ62iKecyabl2GFv4tUqzYcDusAsM=; 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=Vwpt5GulaK5Epj+hg4fdENpepTnmI7NOrUXO3lzBJzWGYsIBGzdHHPxXDQ9GOro3c D2kY8VOqYJaemTPSULESN7UMO1kkQoHB1tQl/ex4vDUn1js9UjILVg1+qSg/hNeJwA frmxvsy0MC8GJs58inf1CbN30f1m0WJmqLRDkj88= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0631.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::631]) by sourceware.org (Postfix) with ESMTPS id 2A1273951835 for ; Mon, 15 Feb 2021 12:03:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2A1273951835 Received: from DB7PR05CA0052.eurprd05.prod.outlook.com (2603:10a6:10:2e::29) by AM0PR08MB3489.eurprd08.prod.outlook.com (2603:10a6:208:de::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.29; Mon, 15 Feb 2021 12:02:58 +0000 Received: from DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2e:cafe::41) by DB7PR05CA0052.outlook.office365.com (2603:10a6:10:2e::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27 via Frontend Transport; Mon, 15 Feb 2021 12:02:58 +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 DB5EUR03FT005.mail.protection.outlook.com (10.152.20.122) 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:02:58 +0000 Received: ("Tessian outbound 28c96a6c9d2e:v71"); Mon, 15 Feb 2021 12:02:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: c15fa76bad4fd313 X-CR-MTA-TID: 64aa7808 Received: from de9d9db2db97.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 1770B473-3306-42F3-9824-C950E57B95C6.1; Mon, 15 Feb 2021 12:02:53 +0000 Received: from FRA01-MR2-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id de9d9db2db97.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 15 Feb 2021 12:02:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NkMxSln7DFcNk6BFxWTjnCrVfcyN++sBds4VKC6JBd+lkWN5tXG4VZ5PPu58bZJDbgfKF2Ffept9zJWrlo60mD+p8jA1wYFePlWTxMOz3TXOArIlUqznVeVkSUwkzXHoMZ1mgd56wg/5RrIPPFv4IjwbvbctgCx++VvJiH/eR+zDun4ktu3eQV2Q5WYNOG+x6ZbgUxlGtyFRsLZg5JsBRQAE/mfbFlshKwmNZMB8MakyHTXr4quR1zZgzp85xUrgGTEllbQVh7UPMaz/SzV9wj6l0R3V/qtvdM4C7Z92d2brdgks1OXOyWG3a+/ny9bCkaLbHAHfkFNW6ydNSf7tIA== 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=fY510zbhBdiSBRlQ62iKecyabl2GFv4tUqzYcDusAsM=; b=RNRjd4rtInSIlSNbJBiAGpWXY+bmoJf8xr3S3znFUVbXnwoomaCVbFoob8JTyfseAIhbGm5igQxr5aK7V7p+uaIJJM/j3JJBoTAFOz4+VxNx/gkI8ZlA0gviY2AYD2CJat3yd9QD2Xax9rJ4rE8bwoWlT+BqRo5H5tqbHK5RXQ2HMMF1lc6JbcYWXDyiVYZFwJOAdeJzrhi3RRjQppa7ADg9Vg/sDWFgtafMqXdDSJoDUJdLjSBDmVQtMCgu2OuVl9zSuu/moNxx5rLiiKthCaUWEHX8DOWlEc27u9PbmQhK1WbbsUvsiqbjv+X9wXBrgPsrFDCvL/K8VgHTEwSWjg== 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 PR2PR08MB4809.eurprd08.prod.outlook.com (2603:10a6:101:1a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3846.27; Mon, 15 Feb 2021 12:02:51 +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:02:51 +0000 To: libc-alpha@sourceware.org Subject: [PATCH 13/15] x86_64: Remove lazy tlsdesc relocation related code Date: Mon, 15 Feb 2021 12:02:45 +0000 Message-Id: <59686e4319f63d809adfb03cd7fbd0d0bb323b70.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: LO2P123CA0071.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::35) 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 LO2P123CA0071.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1::35) 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:02:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: eaae9e8f-0346-4c00-b07e-08d8d1a9a2dd X-MS-TrafficTypeDiagnostic: PR2PR08MB4809:|AM0PR08MB3489: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LscKRxGpXJHnduVo/fwsXQwvXYE8eoccnntIFGwTanjPxUeK2+EzI3wgAlEMN3ZBdjq0qYOfLYdiRMSy6SbKIuWXoyATyH6vELioNUJkuRVnnXZHmLGFpSjcf0mY8J6aOnIfHFceqAYVhnR2EBVEmJa2R5PrGbNuRrxGCsb8kLm/OGxIBPCL7etwbgSjSCoq7xRw/JRZStKgFN5V4aqmLYqNUJI8OYbUV0EG10XqN3ivuYpf1u7npyZtY6hh2ziQ8o2fTCub/IMMWmS5C2hspnEq54rkn1S0sZNrmdy8vnFsLo5Msf2ee/y+if/TDy8m4nGkVJ6BVO6paw+66H5IFqSmEq9Fzl8OiQgqa3MaoT8O3QF0PSTP7K0pVUTTpXOa85EIiRXFQEsk379+edJaEpilqU9Co665cMMQ4RFBnNXw594QQnUUSvUtIXhvEjYMqHTPTP12LuM5tU562eiYz94RrqOTGjR/DxnMtkaxRkHTnuFq5tk1y9nwCavF7E8mNl0QXQhfnIxO3TLfQdrEJ+DGt1EOd9nkbK0Z/WenAXotixJEcvHfK9zrXLqRyIhz/jNSNDU2Df7jwQ/EBeBUl+ENFEDuPgPGRRjqKY+j8fVPhc1WZQz1M2O5ag6f/U1N97tmSMxek4pADew251sNVUEVSSSkLrrOgOxua1TrOr4= 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)(396003)(39850400004)(136003)(376002)(366004)(346002)(44832011)(52116002)(26005)(186003)(83380400001)(5660300002)(316002)(16526019)(956004)(36756003)(6506007)(6916009)(2616005)(66556008)(8936002)(66946007)(6486002)(6512007)(8676002)(478600001)(66476007)(69590400012)(6666004)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: /8chiXGsaCByW4gz4gK44CrvLMsMqUTPpWDwfeNtuC+MONU4qOh8JrbtU6v1ntXvq/dk0Gp15/OXzGbEAmDaYNVQLvE4a6YsyRTF7B2evfXoO/M72s0ZNjXRx3eg68TVl3fhVF3yRyG11tIAh209bcNhNc6NzxrCotyqa+UnDOJTB90GJtaj2DFggq6yLQ78vFRgfj8Ymeya33TACZ0Ae3rsKgSsdmhncLUE1UKHupuGkTxQv1u41sLCxxFiIn18uwMwZDYxhuipOXyCmHvknX+XbuJzJ7zgqr+NftBv7kEQKMH9CPmkWpDH0CD6atEKxvaxTSWcoKV+cfKNnIbYCBJbziFnkcQL+FRsmpX6JhK0rGUHO30pHzsLU7aZenrczeKOJmiua9mnzvbwy8l5aCDyOp3CRa7ggKQZhTZaQzEgZyT0ObtGzQSOXpyOCam7dgp4e5JBqSNsYviQjATtPnG6iDyH/HvPTwIAbecD2Orw93tmb28JqgTXMCy721/o4MX/mWg+zHN9dWE6Cq6nnSa9jn46odqjPPkO4bGXy6ot+dEO+6bZUGqaZZiNU4DoN7JGuUx/XPCPNvEWFF+simNnKf6vLKRPHvnQALg2qiRXLIlVkNgUEKr0C1RDjHQ8ugHg/rQJBmbtV0JYpLzTOAqLK3Rt6pDiDP4CfEcBm9mzrMriKWRNsRA5t4M1xlLD+1sR0W9zTZ4gpeRMU1TYg0Hy8cq9MOaLqUCwlxzh8FZqco0a3P+xe8ESttyUlQGdmWHVM1tTRM+9EbFXVmrDgwO/tyvZY0/lloX3BBqKJXCLdj17yIxebCXm78M+PFVHA8M9EU6KTysTTk3ahAnXt86kQVQIG6n+aG+RlR75shaM5UGtoex+7VpeO4tTYxhkFmMek8odL8p/jOrZI/a5hfmdTlJfP34ntqaGFGT75vvtNC00I4NfwPgr31/jKWs4q3Y9HUFvR/3JTIxD6BOQAo5CLuWtlxj1rjg5acGhXD/c7+trgFyA53KJCUPYbaJDJo3qqL4kdcEXWW5nbkbRGDwCjth9GoVD8McgtxjPcj4jIHRMWPF4M5CcQ5KHYzaQgVap2AluylJVxjrdbga8hN8dASRS9gy3iJ2oAa1tEul8oiwO4sH1ZkayDxCTTfGPJvqvInvayH/qgibcG7K/p+l+rLWkolFOMYl8mHHuItRH0FPH8ZIUvj2b0TOBxJ2EzbiEQbXTmoAmi+b9bM6JVuoCAyitOepn8lClCs5w5t6NYANsXIqqL8Z+M9quSmDC4P65cg3FQqPiWDFoOEv/MQ8I4DHyAXsWhoGhyu86nY3MDvG9SSgC3Kf3FHPcywpY X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4809 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: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4800881d-6dfd-4c5e-7194-08d8d1a99e8f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9lEz8pa24NqCD1XnYpzatDxvFyjtClEP+Czr1ii0+pbQshJBx8+E8UJwx3rQuDl9oriGFzWIqjy1Bi40cg52auMzZmGnpy89OjgaV18lI58NBil/Gg5rpdlzrj+6v1K3kj2/yjmuyqjBfYaevTNVNwCShKv0EZfGIkhsiOy1u0LDARKSY6ZdtRuB+iVT/CqcKXtzRd9YHGF3awojtiZ47FzAWQ+i5aKBZMUVzll5LTZYQUV6k0IB9PheduRIJ/5bE5o/r0Qqijnai45ceIB0iHe6+XYKANJlv8Jenrb4WuQEhdQnAEbKqMbyKBdZafj7zWRJ+FjOC/cqLk5yaDEbQcF7mRpXstJE9E+gSTu4hEeq1G+IcHSpsTrmbfp7QxyL0OG8PjZxG4xzEYjS+u/fM0UITpD5lu0SicqBERf8WRDoGhfa8p7mGdUTnPLZGX5TH+72hr1W6JK3pFMkfA5QIY9npfmtJE97nAiUMZRYX3qkQM6s+4bqft00tn+Fu7Avumix/adNNfraz88M4Hrxn0X1SJKCdNiP5AGK5Spmu/EHoqsdgERtzedFsHjlGeBnn87WUqONJOmi8sB5+RmovGLQ/dV8OXjyGlUeOMMGCB0USfoPSiNaALEV71Sblhoq81aC1T/Lb2Z4h5TNECOEzFDtSbNxO/W/UDXfYbB1OLME/MyO5Pr4eV0K2pisblmRy/80+DrFlP8nTN+kSNe0SGk/MCBz0V2Gtvu9qjvt1ytRMRo+6ShbNLpZqIIj66YGkWhVbtmONr5492BHNV8CHg== 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)(346002)(396003)(39850400004)(136003)(376002)(46966006)(36840700001)(8676002)(69590400012)(6916009)(83380400001)(186003)(6486002)(336012)(26005)(16526019)(6506007)(82310400003)(6666004)(478600001)(8936002)(2906002)(5660300002)(47076005)(6512007)(86362001)(36860700001)(82740400003)(81166007)(70586007)(70206006)(316002)(44832011)(356005)(36756003)(956004)(2616005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Feb 2021 12:02:58.4961 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eaae9e8f-0346-4c00-b07e-08d8d1a9a2dd 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: DB5EUR03FT005.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3489 X-Spam-Status: No, score=-13.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, 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" _dl_tlsdesc_resolve_rela and _dl_tlsdesc_resolve_hold are only used for lazy tlsdesc relocation processing which is no longer supported. --- sysdeps/x86_64/dl-tlsdesc.S | 104 ---------------------------------- sysdeps/x86_64/dl-tlsdesc.h | 4 +- sysdeps/x86_64/tlsdesc.c | 109 +----------------------------------- 3 files changed, 2 insertions(+), 215 deletions(-) diff --git a/sysdeps/x86_64/dl-tlsdesc.S b/sysdeps/x86_64/dl-tlsdesc.S index 1d055adadd..ca9236bed8 100644 --- a/sysdeps/x86_64/dl-tlsdesc.S +++ b/sysdeps/x86_64/dl-tlsdesc.S @@ -144,107 +144,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 - RELA relocations. The incoming 0(%rsp) points to the caller's - link map, pushed by the dynamic object's internal lazy TLS - resolver front-end before tail-calling us. We need to pop it - ourselves. %rax points to a TLS descriptor, such that 0(%rax) - holds the address of the internal resolver front-end (unless - some other thread beat us to resolving it) and 8(%rax) 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 - /* The PLT entry will have pushed the link_map pointer. */ -_dl_tlsdesc_resolve_rela: - _CET_ENDBR - cfi_adjust_cfa_offset (8) - /* Save all call-clobbered registers. Add 8 bytes for push in - the PLT entry to align the stack. */ - subq $80, %rsp - cfi_adjust_cfa_offset (80) - movq %rax, (%rsp) - movq %rdi, 8(%rsp) - movq %rax, %rdi /* Pass tlsdesc* in %rdi. */ - movq %rsi, 16(%rsp) - movq 80(%rsp), %rsi /* Pass link_map* in %rsi. */ - movq %r8, 24(%rsp) - movq %r9, 32(%rsp) - movq %r10, 40(%rsp) - movq %r11, 48(%rsp) - movq %rdx, 56(%rsp) - movq %rcx, 64(%rsp) - call _dl_tlsdesc_resolve_rela_fixup - movq (%rsp), %rax - movq 8(%rsp), %rdi - movq 16(%rsp), %rsi - movq 24(%rsp), %r8 - movq 32(%rsp), %r9 - movq 40(%rsp), %r10 - movq 48(%rsp), %r11 - movq 56(%rsp), %rdx - movq 64(%rsp), %rcx - addq $88, %rsp - cfi_adjust_cfa_offset (-88) - jmp *(%rax) - 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 - /* Save all call-clobbered registers. */ - subq $72, %rsp - cfi_adjust_cfa_offset (72) - movq %rax, (%rsp) - movq %rdi, 8(%rsp) - movq %rax, %rdi /* Pass tlsdesc* in %rdi. */ - movq %rsi, 16(%rsp) - /* Pass _dl_tlsdesc_resolve_hold's address in %rsi. */ - leaq . - _dl_tlsdesc_resolve_hold(%rip), %rsi - movq %r8, 24(%rsp) - movq %r9, 32(%rsp) - movq %r10, 40(%rsp) - movq %r11, 48(%rsp) - movq %rdx, 56(%rsp) - movq %rcx, 64(%rsp) - call _dl_tlsdesc_resolve_hold_fixup -1: - movq (%rsp), %rax - movq 8(%rsp), %rdi - movq 16(%rsp), %rsi - movq 24(%rsp), %r8 - movq 32(%rsp), %r9 - movq 40(%rsp), %r10 - movq 48(%rsp), %r11 - movq 56(%rsp), %rdx - movq 64(%rsp), %rcx - addq $72, %rsp - cfi_adjust_cfa_offset (-72) - jmp *(%rax) - cfi_endproc - .size _dl_tlsdesc_resolve_hold, .-_dl_tlsdesc_resolve_hold diff --git a/sysdeps/x86_64/dl-tlsdesc.h b/sysdeps/x86_64/dl-tlsdesc.h index d134b3f4db..03d5ac7a54 100644 --- a/sysdeps/x86_64/dl-tlsdesc.h +++ b/sysdeps/x86_64/dl-tlsdesc.h @@ -55,9 +55,7 @@ struct tlsdesc_dynamic_arg extern ptrdiff_t attribute_hidden _dl_tlsdesc_return(struct tlsdesc *on_rax), - _dl_tlsdesc_undefweak(struct tlsdesc *on_rax), - _dl_tlsdesc_resolve_rela(struct tlsdesc *on_rax), - _dl_tlsdesc_resolve_hold(struct tlsdesc *on_rax); + _dl_tlsdesc_undefweak(struct tlsdesc *on_rax); # ifdef SHARED extern void *_dl_make_tlsdesc_dynamic (struct link_map *map, diff --git a/sysdeps/x86_64/tlsdesc.c b/sysdeps/x86_64/tlsdesc.c index 4083849f22..ecf864d6ee 100644 --- a/sysdeps/x86_64/tlsdesc.c +++ b/sysdeps/x86_64/tlsdesc.c @@ -16,120 +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 2 functions take a caller argument, that contains the - address expected to be in the TLS descriptor. If it's changed, we - want to return immediately. */ - -/* 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_hidden -_dl_tlsdesc_resolve_rela_fixup (struct tlsdesc volatile *td, - struct link_map *l) -{ - const ElfW(Rela) *reloc = td->arg; - - if (_dl_tlsdesc_resolve_early_return_p - (td, (void*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_PLT)]) + l->l_addr))) - return; - - /* The code below was borrowed from _dl_fixup(). */ - 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_hidden -_dl_tlsdesc_resolve_hold_fixup (struct tlsdesc volatile *td, - void *caller) -{ - /* Maybe we're lucky and can return early. */ - if (caller != 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. */