From patchwork Tue Apr 13 08:21:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 42973 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 2FEBF3968C06; Tue, 13 Apr 2021 08:21:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2FEBF3968C06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1618302110; 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=scVZUJiXmkBwWwMDYUTES8PW+7NP/vZi7jMLTxkVRft+1eQ0K5FN6ogGS+qrtSkJk OHF6jfpsgj5nfRTRtYcftbfqkU+p5fUCGNrX8YVjf5+SOl8aQttrtwzArHMiGfMX60 36mXDVIgzNvYmvsNUiUEww0NAAAJBY2B2girpATI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2067.outbound.protection.outlook.com [40.107.20.67]) by sourceware.org (Postfix) with ESMTPS id B87B73968C01 for ; Tue, 13 Apr 2021 08:21:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B87B73968C01 Received: from AM6PR0502CA0058.eurprd05.prod.outlook.com (2603:10a6:20b:56::35) by PA4PR08MB5904.eurprd08.prod.outlook.com (2603:10a6:102:e5::10) 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:43 +0000 Received: from AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:56:cafe::b) by AM6PR0502CA0058.outlook.office365.com (2603:10a6:20b:56::35) 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:42 +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 AM5EUR03FT033.mail.protection.outlook.com (10.152.16.99) 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:42 +0000 Received: ("Tessian outbound 700fd1fc53d5:v90"); Tue, 13 Apr 2021 08:21:42 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1e612d38cf96e2c8 X-CR-MTA-TID: 64aa7808 Received: from 29cdbadc1ac2.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F7BAD7F4-0EFF-4B20-8FAD-43804AC1B7DE.1; Tue, 13 Apr 2021 08:21:33 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 29cdbadc1ac2.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 13 Apr 2021 08:21:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dL+EHbs6sVckTbNxZyXooYviod2oEeWCEhF70HlO1m974LrRLK2Vn1NohiH5PaN4xechzIvO4m/sdjPogjJRuHmArNWJAwIIUZVDmt1NFLBvKuQkKJzFIiDDbCs1529XwLoNeULu8JCK3TEoqsF0lTMP78sbUUOIUJVd4Qq1sHkbQYoIWdoYzYmvrulpqMG72XmZQ5i6/FiLgxE6tKkD/KrwurybdqqIhSu40rXNmD53PTP+gpdkzVDV89m/wpdQJzOjaiMzAKFmFIeuM9+kXHD836VJynnpu4vCcDpmw2aLFWiONoqmGvqWs5MZk5yhxuKs7CHlzMcer8Q8uLpAlQ== 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=Q0KSTo/H+qlzuDkpfUnxTagFZPLyrtYmNGsLdrLdvAMBvnwTSm8/lwW47KcDc99ygaucdw9bhpwAXu2ftPsNen2fGMrb/IJX9pVEIuHypA3fzmIRNFQwHZNPqXBKsh1WeOdfP644EvcQLQBPxAHqibLt9yeEb5TZ4SOyfJiK1eA7JugWBWPb8mvFgY6uJGuRvvWm5xlCcrNbTP8yg9cGk+czewLKvRG7lVB2S/u7PWgUe9B0FUYjgUAN7aPzgcE6SvN2Ubh+Mtm+Y0uxCmBZBFhUta2WGqSbkO1zDdxapZxIsLoDaCM0GREUWQMuEGY/9qfdu4YzNqsGW5S5rC/CRg== 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:30 +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:30 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v2 12/14] i386: Remove lazy tlsdesc relocation related code Date: Tue, 13 Apr 2021 09:21:24 +0100 Message-Id: <13859e5a8b0dab26c922c4d1df63d854957c33b3.1618301209.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.55] X-ClientProxiedBy: LO2P265CA0240.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::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 LO2P265CA0240.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::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:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e565f0f-85f5-4886-f5af-08d8fe552b8a X-MS-TrafficTypeDiagnostic: PAXPR08MB6986:|PA4PR08MB5904: 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: 4hEVuzfJXgtUoq9j54zVzCm0nCzuQ6X6/kIY1xewXopL1GPloIOjy9C9grBQgxFyEOlWfUDKjWXkK1ZVA3SpV20AEWxZ5oLMY9ohCrpFKS3SXQSrpR8oFwHQzoOaT5Kv75mYZ+Kg8/6aVmlSCAaz++eBJ5Q24KUyuLa6efwXUxxoBC9t1POQip+KZ2yLjLiPgZ9NltCzw2dxFgjx++8BTvThXsWcrNxkzhYbipISWT/5jNDC3HCBwYWEe9+WYuJ2BFj/Uyx4knUZVhXLvxX80DUQ22uFLZJA8XIkDstpU87O+SHV6RgJX7oR1hi5MBupK7YjDQWx0HoDGgC+z3KKtsQaV11LCjCNIkv/2i3jIsfDqk1yMnGus6t3WEGTJFSxgZOoSJHMqydrQ18sLK1iF8wmy4CU2h8Vo4P4HrN0WuLC46lCeLOdCMX8ZxPvEmcV3Oi2mnTUHcdtwUPP7t+H5VKXLlHpWbEp+Mn39cWIUXbH5euoRAurfsMgk5NA2KHyLK/X0VHg26tAJgz2ClqLPUGvgsDN6qlqUTO6Z1E4s5aYu8rlqtAXVJ7x+TlaeLzTfPWvdsaKmXVYN+2zTIvj9s2ORzTAzIA2FxgiKf2byMzio0DLfsA/ugx83+5EI8gVgEq+RxD8B82R5kSgy2zxAHsDo4iUfmYPjxNvK6wN6tWAZR3/5wpUlhIWZso2rT0fEE57MK6DKTWc18H/lo8kWyzZ9qSWU/ft/hM72X9d7bBXfdK9IakYjXv+AtEEqXSr 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)(30864003)(66946007)(66556008)(44832011)(66476007)(86362001)(956004)(2616005)(69590400012)(8936002)(83380400001)(36756003)(38350700002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: nqIPPt+wYPkeCmNtqEQgyEPm8VVJJYODkAQtKf1JExHlL87t7YmKA8L9JrCOE7ocotVe5wZ46jFQoluO91hqW98sEW200zX5bewwn1diAEHV07r6IB2mfrYTKhzcv1xps/L7z0FhCJdgazAjtkaEMmcX8A577SBjoWdGCGWxkPuH0Z4gj/r3K4bFwzwI1ZaDwSovZZWERnxcVTwwzTqeU88mZN7ttnV3OYPWKqxokxPhtgaOdrXHeajeGSfxJEt27tNr6xr80PbkKcIoNxRoAOMKTPlvkq8kwnzwu/Qh/D03zqrkDBp6wbLjv6eYSYMt7r60f7w1ymyzALJWUK1qTUh4Tu9VA7RQ6TkdETPLwbVYkDNfs2H0R6nCSrVITKN+KRg1uOeb1wWa7j7a2lT1E0HnxzlWAFYJ1+uA/xkNHbwjG9j+0YOwAyBOh4SXo8Yt7LltBAz+AdZiYOwavL0jTe4YSoTlNfBHlV7MAsOsTZQ2Z+VSjACoZDbv9xLeGYDUgS5yj5YLlq+fgZiPeMdSc9XqKjWieZjmY96xhzL+/J7N9gnX6GLjN/7grIWwXvi2dVZKBJM1fMst32H9n3qqyYgWBBe+3vZPSJJ55PweGHWTHoDGFwvZ+IWvTsM9AJsFEuEsvEJzaqC3jHNWcFfhuSDjiTcQ57yF4Jm1BZmK1/pRgn1t/yR9cJC99z/7faD+bW5jLaVOfnEEgVCNHWNoUhhbveyIvLP1JXLkRyl+bRIfeo+eNWrinPIGvxALFHsTTmIYkt0AyHDEevI7fEDzTt7D3lHm5Z0lVez71OeoSuzcJb9ANsjcHYSTcJWtHv19tyiVbPaijA+1M7xzv7mHWY5YqpY+Him1GBk7M5Ug5sQI1KrMLgvpMep8b2nZhP9Z9P3GA7LM7/M4FCULcoRy1mCgNqgZ5pb7lERhOt0+Z9V0Te6ZFFfa2+FW6B7F3rRp/UZDuul2bQ9Uqip/hewlqsw6yWexxeMbv+tGKbCb6PPttWwhnM1xGc05ucbq5TNG504cDQhcC3RhMbqORdp/s9StwlRIPX3PWOvQ2Sv6CO9K5fAIMtH0CPhsrK1n88bM3h70RH8PzIAbmID1Ja/ncNOQW3N0mvrUotd1AMWSzEU3nMFmbpA9AF+fw6swJaRlXKFJn5d/lA9p0aY9tJeTzVPVod1MH1d6mwnjOBG5tYDRDM9VjBFbb/VAjotnVrgUaNd4JQmxbvEyM2gyCeDx0Ik15EIvU++nQ0h5QaccOH5YfXG5HYSfpj+iUYYYzgsnUjnlR7xcJXIRT9bMzr4nlFqloHrX5591B7Xn2JVEDvekEPfzYG57CqwupSnrQJLn 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: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: c9ef84ec-4a67-486a-e208-08d8fe5523d4 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ib5FsK1AnZFGd0lLFcyjSeJkNTlLbzskjTMXQ/0dp90EvqbwglCZTQmvPP/w5x1o6YUzMrfpqmCqcegIBVoBGur05GXbHGy6bADSbmrnN2TrnhNIUnrLN20EbUeGl29oFkPFi8yEWZE1GrBvKSEHgWZyzAUY6TvzVHvsWeUTMEZHHrPyyPLurOk6ydUFAQZh5dZo8dlH6lPO1lZ7Zd84SdjQP2tvOaFJsZUyRwo14TzOCIeS0OzYHfOP7D+x+syyvT3h80M2t3O6xBYUUho0raTCm9g8am0qtD+8Wvxom5ESEw3lxvop4rVzJ3PTYMg3CXbq1D5cDiuWN9vh2gWLqLg++fXp1R7eVM782FsuMb9sHS8OEK/dSpn0TuATotFRKkKsKWtbtJcXRihhWro0QV5wyQTwd2rk19+bhhuOGbKar6azmE1OoTh2pi1DJRE8RjNlDsm3gHamKCPh0xfOPF5jsFip1qAUJuZxhwfn/Qx4T7D2mdRXemt73zQypi48G1D3BSSWlaXbb1evSJzUAHeQTsVhd7l/Stu28fGGFgTQNvdmOqJ7lMlCbcAgvfVhOWYTrbQNujw/h3HPQe//Nry+FZPhNPtPCysBm45anVFEH/cfB4ALF1Cd0zCsqcXo5Ic9kRlNA1bGdohEOsE5LczPXhN61KYIYCGoNfXdsffwTw50BktWtsiwY8NJL3+6jM6CjFuS93sJ+GEh/BYdEZ1h/kZyfMKNx9fzZHhFELg+HTuDplqsXAyQq7G8DqVXHGHN9JBDWUxca7oO9jqqqA== 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)(376002)(396003)(346002)(39860400002)(46966006)(36840700001)(83380400001)(69590400012)(6666004)(36860700001)(86362001)(8936002)(956004)(6916009)(6506007)(186003)(16526019)(26005)(81166007)(2906002)(2616005)(336012)(8676002)(478600001)(5660300002)(36756003)(356005)(44832011)(70206006)(316002)(70586007)(82740400003)(6512007)(47076005)(6486002)(82310400003)(30864003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2021 08:21:42.8317 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e565f0f-85f5-4886-f5af-08d8fe552b8a 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: AM5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5904 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-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. */