From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60078.outbound.protection.outlook.com [40.107.6.78]) by sourceware.org (Postfix) with ESMTPS id 9D895393C868 for ; Tue, 13 Apr 2021 08:21:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9D895393C868 Received: from AM6P194CA0096.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::37) by AM0PR08MB4931.eurprd08.prod.outlook.com (2603:10a6:208:15e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21; Tue, 13 Apr 2021 08:21:37 +0000 Received: from VE1EUR03FT026.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::c4) by AM6P194CA0096.outlook.office365.com (2603:10a6:209:8f::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 08:21:36 +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 VE1EUR03FT026.mail.protection.outlook.com (10.152.18.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17 via Frontend Transport; Tue, 13 Apr 2021 08:21:36 +0000 Received: ("Tessian outbound 82c2d58b350b:v90"); Tue, 13 Apr 2021 08:21:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ed31d2ec2c469e56 X-CR-MTA-TID: 64aa7808 Received: from 36d8ebbcaa49.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F5BC4A1E-1B24-44EF-A2E9-14F18556A1E3.1; Tue, 13 Apr 2021 08:21:20 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 36d8ebbcaa49.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 13 Apr 2021 08:21:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gcau+AkP374/XAP/3hLCzWg/7foNTWZGiwf9KyHyLIdxVyYbTD4lJwqL+qTuE3nFd6eF5LLdj79doeXOboSOvgE2lXc+yagDwOLPtfGZTTKz/PapLoFjDkVeb/sjz0qQEhMamtLar/BXqYPUShT+azZYREWBGIhYxkIH537rik+Mf1I8fnILdHofpsYwcilKK7+H/uZ2xYLbkar4z1EI3EbQgxIm+3M4MJ2GJyEPmCSDXgyah0G1Dh027gALD+u0lCGR2VbVu1kZL7RmuXBrf8ngJhi18ttj4vZi0K4UFj6jWcgLj7bpPVroPtlfvqiWFUp9g0kt8lSwBoBRp74tTQ== 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=duycyx5W5vBu6cnCIjxOfv6X0T9L8z2U3SGZgNjP5dw=; b=QSIfxadGYNHX/7qmddVEPL7jpWctGVq2qGlTiZ5DJVnsFugHgxX117za8oRK2hAM+eHfUQJTp0JcaKGb+Uh7+DSkbaON4R+uHRMW8BV27pWt5tgNnhASZ0tEZzK9NY8GR2fTgvXIcAnZ8wS5TkiEcewuKFCBz6zbvAD9ZmL/Uaw4YVFPzkVt6mOMHfP2b0B+Oc2qvNxRR7HpGc3yk6EFZVewq2cbjQkfCYJkevmc4OACaZ2IU6Imcc2iGWoEJWjnETljPr2UhxtZjbOqcgrtH5DTnD0X1xW8SWQNPOEJSX58CWlgBvGQBEgxDdMxj2pGdD26n5RoirUxGwtqt8cWoA== 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 PAXPR08MB6986.eurprd08.prod.outlook.com (2603:10a6:102:1de::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.17; Tue, 13 Apr 2021 08:21:13 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::c99f:671d:bb2c:f20b%7]) with mapi id 15.20.4020.022; Tue, 13 Apr 2021 08:21:13 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v2 11/14] x86_64: Remove lazy tlsdesc relocation related code Date: Tue, 13 Apr 2021 09:21:07 +0100 Message-Id: <5419c82f25996f3887c541352e26a09446e66a3d.1618301209.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: Content-Type: text/plain X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LNXP265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::36) 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.55) by LNXP265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4020.21 via Frontend Transport; Tue, 13 Apr 2021 08:21:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 422e7013-6aa0-4a06-5f6c-08d8fe5527c2 X-MS-TrafficTypeDiagnostic: PAXPR08MB6986:|AM0PR08MB4931: 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: r/7gtyUKaZmK0dPfcUk8CjSqhBh6OkYu3rA2R7iVVPOMoZp3g9N4l5REzo5ZWKtXON3/ezI6RKze0DRXWILTf/8vXce5SZKLlGoQ5GqMegXPH1NCLxK0+qLz/fmx50O5V4UMOUcMICFMc++OTsM/kouAOwLnBQPlGJFZSxBBReRvMwcRdz/4w2lBnSFRGVeYw4SV9YhZtqym8iGIzJ5pm9vEM+x/M4E3QnzjVF81BEbT7e03YDLYPARA/E1LVBb9+LAmgu5rVasabJ91Bo5jrQjiiugD+qL/gPTBH4l2foi6e68K2v5vn+XaoAdw5kpE3V+oMMAW4n9Kw7MVXJ6oTl4vkPp2A73ekS+b9+HoN0UAbaSysWpXLCrID5NIFfDUuUEKlHV72zEXdBoEeR7NDYp1hRcvt75yG9C4O7709RGiDeksCcn78q8Tv7kmXbfL6upKGgTaaEJt+IJJYAFWc8b3eN3t365MG9G+25ymGtR2Zw159QFixFaWzw5gZ84ms9ppd+ORd5F35SRPXHg8p+LxfgPiSeQ/K1PSm1OTAhTPXfjj0sAmJFrj1ORNGGADWKWDGK7Exo4t81RKBtDuuqd4i6/lyq+l8ctuBdjNv78mMpjr1AUCCkVmDOa2xAwt6xvW1/yYny6lS/mn0b6zLHX0Xqlb9HFu/K0WxptgcEB/CWHqXyC7W5n2/fkuSNERl4tHsnVypb4q88h1e+EEXmVjK+XH8R2AVGuS383rUMlAKswEXSbuC5hThuWI6vq9P1+u2pcFsahADOTtBZ4Wmg== 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)(376002)(396003)(366004)(136003)(39860400002)(346002)(26005)(16526019)(478600001)(186003)(5660300002)(8676002)(6666004)(6512007)(52116002)(6486002)(6916009)(38100700002)(2906002)(6506007)(316002)(66946007)(66556008)(44832011)(66476007)(86362001)(956004)(2616005)(69590400012)(8936002)(83380400001)(36756003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?6ZITJwubQDo5Vg1cEC+1Lki9DUllSNSArsAdpdHsWtytJbDAi7TBiKVbWSoD?= =?us-ascii?Q?dYndpzcC9VbMqdltGcyR0LB8eRlmu18TbV9bGJv9mtsjT5gHzXApUq/UfNN6?= =?us-ascii?Q?U/mqmhIln4KaB0yPDqhmjlPPhnNEd1n7C33mOIzUpY4Ev9tXfY7TKeHLCYqy?= =?us-ascii?Q?YsFJK+TUZNAyH3U1C3bJHVAEXVosVwJjeY8nroDb3WOib9ifXhpmITZCPvDi?= =?us-ascii?Q?Ht6arkiQ7UWAPViwYa3Mv7zZHnJdBw8ajEZIo8N+sZwU9zevf5/d0KspQOy0?= =?us-ascii?Q?kK8Atdn5V1fJ9G3G46u/BHDHkZgPJkv05DSZxxe9AD70+u6X4p9cjesuGqMu?= =?us-ascii?Q?JqzsZmjvSkBxWSC3A/3m0mekuKl0Ar9VrXbhEYt0wqXchoRQqQVUJ0RUXTog?= =?us-ascii?Q?WgXIXkil0yGqvhMyt1/jSoJW8TTsHmoCmVlvQWN7U9niJLsFK7LWA+wsJwdR?= =?us-ascii?Q?pPz1pNIGhC3dLCbGoCTvbyKpYNTZmzZkrdatDrYbOAEZ4Y3cZHGOJHbZU3FI?= =?us-ascii?Q?VA3fasc0hbuLSdRCrhVLhup8QohSs3i0uyRJQ9jr1dcAhzSMNY3lo09lZqot?= =?us-ascii?Q?t3xhu75QDaelVO6YMQk+US6v97OopdqQLGJg8B9VZ6/e0Lrl8G1kDC8F8WnU?= =?us-ascii?Q?nPR3cITn6IcNfomQv2wq0jKTYtqIKg34KkK0cgf0DJFHv2m/IGNSpnGR2o3V?= =?us-ascii?Q?Wd71Oc6aHaTqvQJI+9VgyxObTL1u99M0Hu2Zxz7wH8NPTXh7cF/shLQNxQGU?= =?us-ascii?Q?S5U2p2FEnWSYwy9/kgcE44lJ3r5xVbT6XfevKpvAdHNcA4HYBNa30YhTQivn?= =?us-ascii?Q?/l3WzbIvv0t1t77NE+S6yzMIUBK02PiF+BodXQUCVoV8vNpsLodfCvI/XTrW?= =?us-ascii?Q?xS5OSae9pR0mg49o4SPMKT7hrSjzLdf/LJitVqxjluNruEUIBk3++KdIDBJV?= =?us-ascii?Q?HxkghfZdwqOTzf5czCujamSbk4W5lUBNFi/deT5Jwl1l5bWHG65HRMM6FCAQ?= =?us-ascii?Q?+5BTD99o1ejRRzweMNszU8QWnLvyUFE23Y9I1Kmv3yATOu6iDaYLUbf6olE2?= =?us-ascii?Q?8OR+7WrH3SczsXOVHep4+Psv1cv0lioiKFmc7GPnoh6grW3OwE/UxFAvx8iO?= =?us-ascii?Q?E1LkFrMNWItUzi4PTMH42DK3/FpjJx+Ca4m1U7IRtw81QMZjQM5F/EaCBxks?= =?us-ascii?Q?945pB7dBeE63VzgSPE+qh5MOBIUsZlexVyBgSwy8ILiwSzcTqh2wuwVdIemQ?= =?us-ascii?Q?NKKd9T05I1YFfcZlYhOUzv+bwdstq/SDviSnORa2/KQaRBEZuIL29XEt5Jr3?= =?us-ascii?Q?T2AKwGafwzPAxGTCSVzh185k?= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6986 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: VE1EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 64167020-4357-4b98-a21f-08d8fe5519b1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s9NYQagsgltMefYxSUPQVYcIPYSNzxMNo8Ge1035d7Cf5XV1FgYJ+8QbiZofss09ZNKAkSX0UVBk+OZP+4zQp4NNCfegktwYElTcL+nR9gm9EusyPHGhygJRfBeE/K/3CwTMNihIB4wEtRaQDNi8jYlGAURh6KmUKvzMEseAQsMjJUlPaMHagGhbSzAV0enRhWjtXpfSvWdzGFBXRIGJP9lpe5EtrX7HxyRf7e9x0zK7lMpyCTx/1ctfp16ducr7rh9FddO2LtIqFXW5LEH2nlGsmW3E9wL14Y/eTDvy6wZxinZaPjKSUDkOqoDAOjoEoPByZViiywBFULS3hreOxy5jkDTx8vtsWwHCTgmetC1m8FOJG9OzavagMXmh/1TyJ115+83gUvMu6JqTM2g4WboOBURPXyxdi3yNr9ACIvLRbai0HQHRLgBAxK9vMYJTF9xoQ/l0vz4cHvvtcuwp0jZ8GjSdcbKAWhael60FegT6zI01Ot5zF7zW5ofhLZF0AZ6b0rn21nEZwx8mpy4/zTsuyMjWvDXyH7Ve3WBfqaHpKGwLBIDQX/NBsEgjJmBHgM3J/wE3PoP1C58HQZbl6fD0J9KEIZXu9EwUbgJiXW9Goqkbnw5FnehJtPTK+lEjrBDj6Ie/jb9LLceQEc/DT0hV//M7wS8TY44OcThganxOGbnYytgD0b85hrZAx/waI9UfItOQqRduEw5+lYmmjEGxNvy32BtQ8uhsqX1vAEhZF0fyJ0KDLBIJN7fylmCiIp+nPEaUDky/gc3kVCrU2Q== 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)(136003)(376002)(39860400002)(36840700001)(46966006)(6512007)(478600001)(82740400003)(36756003)(8676002)(69590400012)(8936002)(44832011)(70586007)(16526019)(186003)(5660300002)(6666004)(83380400001)(86362001)(336012)(82310400003)(6486002)(2906002)(956004)(6916009)(2616005)(36860700001)(356005)(81166007)(316002)(70206006)(26005)(47076005)(6506007); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 08:21:36.4370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 422e7013-6aa0-4a06-5f6c-08d8fe5527c2 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: VE1EUR03FT026.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4931 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_NONE, 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-List-Received-Date: Tue, 13 Apr 2021 08:21:43 -0000 _dl_tlsdesc_resolve_rela and _dl_tlsdesc_resolve_hold are only used for lazy tlsdesc relocation processing which is no longer supported. -- v2: - fix elf_machine_runtime_setup: remove tlsdesc got setup. --- sysdeps/x86_64/dl-machine.h | 4 -- sysdeps/x86_64/dl-tlsdesc.S | 104 ---------------------------------- sysdeps/x86_64/dl-tlsdesc.h | 4 +- sysdeps/x86_64/tlsdesc.c | 109 +----------------------------------- 4 files changed, 2 insertions(+), 219 deletions(-) diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 9a876a371e..a8596aa3fa 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -127,10 +127,6 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) } } - if (l->l_info[ADDRIDX (DT_TLSDESC_GOT)] && lazy) - *(ElfW(Addr)*)(D_PTR (l, l_info[ADDRIDX (DT_TLSDESC_GOT)]) + l->l_addr) - = (ElfW(Addr)) &_dl_tlsdesc_resolve_rela; - return lazy; } 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. */ -- 2.17.1