From patchwork Wed Jan 20 15:31:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 41774 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 A32E1396EC46; Wed, 20 Jan 2021 15:31:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A32E1396EC46 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1611156684; bh=dcOFZcRWhs1tYuT2FQnrHquNqoP9GmJWShHgam6GXB0=; 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=k+85X4zpwQMoDuneETL6iZJfSDHZtOmHWfzVuwTcz6ut4Hy+o+6ISdEMKrVdpy0+D z7FgEgteMZMI3g7zFtewJu9X4ZbH22jKUgiMwVIWLi5dnIEP0CaRg7KFCxaF/dxT6T yfPT9o6dw7eFJzKPWu3UdEZkD03XacU3THi605Nw= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150082.outbound.protection.outlook.com [40.107.15.82]) by sourceware.org (Postfix) with ESMTPS id 6B2DB396EC34 for ; Wed, 20 Jan 2021 15:31:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6B2DB396EC34 Received: from AM5PR0101CA0002.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::15) by AM0PR08MB3123.eurprd08.prod.outlook.com (2603:10a6:208:5b::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Wed, 20 Jan 2021 15:31:18 +0000 Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:16:cafe::46) by AM5PR0101CA0002.outlook.office365.com (2603:10a6:206:16::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 20 Jan 2021 15:31:18 +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 AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.11 via Frontend Transport; Wed, 20 Jan 2021 15:31:18 +0000 Received: ("Tessian outbound 587c3d093005:v71"); Wed, 20 Jan 2021 15:31:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 54337ce9a930f926 X-CR-MTA-TID: 64aa7808 Received: from 838edf763b1f.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 7A0B08CF-9C4C-4721-BD49-D07F9A72F713.1; Wed, 20 Jan 2021 15:31:12 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 838edf763b1f.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 20 Jan 2021 15:31:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AVMQ0zdx8Tsbsbf5p0TX88XlLPgIrhmY+8tjnd9C+nA2b6v3dPZyrisAyrS7N7DYvvDoKcuKbToMuJiqUEalivihCVprTRHlBrVkPnMYYmtksOrA2Okm5/hhMP5UqWg4LMRTvKd0PwY1gPYgA14lSaYjjBxeDarwqt0qDd+PBeX1wMkS8PBqM4eDRmn2zefjP1LTgDV4bSCPpyPgQsjzotFEQQl08CXli/rblHnxPpcFIBzVeqM0+D5x+AeR+C+bK07rvXzOaQQHiHO0w+p/13EIycOKdkTg1Nffvu3cOkuzVHWKbMUSqIdqetKfWUpqLtpKeGqISEjt24v2KY+U6A== 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=dcOFZcRWhs1tYuT2FQnrHquNqoP9GmJWShHgam6GXB0=; b=bvCZNVQ0FgpCMnrOX4QIsuO7Sv/q6NLcYRLEJnNhozJrzVclj7R4SRdN+grQWxfbuWD1/3qkNJSW4tbDEsAELv0O7bhXtpjJrJTBLWB8iwrOdpxBSdMTBl17y5jB9rb6SeSp4AV41gnCsOcse9zqdA3B5pRmjy+b6PeDh27Z1oikm91Kv0b+mUnqKqHdREN0LOCDLAsyKkUzeMEoHJdBfTwoF0mK4u/F8E0TjLnC19CfQAWb/pJzlS7zJbSyuUCCXJYZRdfyvlCDFKCWHap/fk7e0h/nKNn+VwEBIg4Q+nUuLKi2uXLPaZNn76kQpMgfUVFPUelSyyWv0xUZMcrt0g== 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 PR3PR08MB5577.eurprd08.prod.outlook.com (2603:10a6:102:81::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3763.11; Wed, 20 Jan 2021 15:31:11 +0000 Received: from PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f]) by PA4PR08MB6320.eurprd08.prod.outlook.com ([fe80::700f:ddbe:a347:ee4f%7]) with mapi id 15.20.3763.014; Wed, 20 Jan 2021 15:31:11 +0000 To: libc-alpha@sourceware.org Subject: [PATCH v5 4/7] csu: Avoid weak ref for __ehdr_start in static PIE Date: Wed, 20 Jan 2021 15:31:05 +0000 Message-Id: <4da71cb981057048e8cf9dec8731ad936b433e38.1611155254.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [217.140.106.51] X-ClientProxiedBy: LO2P265CA0382.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::34) 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.51) by LO2P265CA0382.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3784.12 via Frontend Transport; Wed, 20 Jan 2021 15:31:11 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 49fca39c-a84c-44ee-ab73-08d8bd586e93 X-MS-TrafficTypeDiagnostic: PR3PR08MB5577:|AM0PR08MB3123: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 015ChQlczlIki9V4uP2CMFSWIIjDjakSwnAqBdMhGITQIdfjEpZs6Py1YXOOnK03g9KAjwvmSMp8gScENK/hU1DkvUeGVxPkYRxmxF2mqCY8+H56iM8LIjG67v+RWbEfGT9+Z4OKHUZQNMI8RxDY49Z5EosqAQ9IfRBJIGctshxZARo6ceIFkPkLf99OoLlmWTj2e3yfVJ2g41GkIHzdHVS6eB1avFr6ZnyCKefdgj13/z1rWw9c6pJ6BBrnj8ZcJ7hxR4hoisPO5ES2cPXJ1yAO9MR9VVGNCym7FEYm1GfoBCiMaKIafojgCnkjc3ZvJ/Lb7/me0P9AZan429skDjqH6CDHDf+nMuvFbGDeLMqYbKWBCSfvISbPlTYUL2bqqq6iZre1xmjlYD4k6bMZ5pwjnJncLl/fel5itfxRTzQUcX4WlcIfkjbdaE6qCWkq 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)(136003)(346002)(376002)(396003)(39860400002)(366004)(66476007)(2906002)(316002)(52116002)(6666004)(186003)(16526019)(66556008)(36756003)(86362001)(6486002)(2616005)(478600001)(4744005)(26005)(44832011)(8936002)(6512007)(6916009)(66946007)(69590400011)(956004)(8676002)(5660300002)(6506007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: xud21E7Z8ZnMn0UmMExlyLOeeBtG03fwR7NrqQ+YQdFFyPG+9jSAipy2f58fKeIAkkudnleFay32yKk6SH0BcqKxh7xGazZ8x3qxEEKBYiwztCgCFMTN/RHHHdHRDw+2xrv3iuF76uv7z49xOdKTeUa9RRDKx4bbuLrmund/kJqNcfulw0Bx2RWBxhDZxGuefkc0mbJavP3X/9b3314jmq/jRDDdKfC3fe7mXbyBy8aSiDoGOU4mMGGOkIBFThoK9jlBt6a6cD87DWn9rKvY5MiVle8WeXJ7Qjn/Jj6TzHmIzn9zMLiDg5LRRtQeQk3jIDV94eORap2584HJZHU9INqjyaWhOkiw0lAK9CS7tnJVaHG8B9VnRibUCj12TPR1/mJTzS8vXlR2p6kzsnUOvtXNM3jqqk7pNDnPIHeDVE7rLBRdZLqhlyIpX3HdHIZypEh1rJcsyq3uWtTHhAInQ3Lv8qmQMnbMpQHU81UXEOVc2N1RAadY31LZqTBtWrFSuEv9VxAnkyyH+HuSOnRu+LrOvfMX0FBEf9cW67Wutpuww7EB/m3eRF0BiK6jZNZ5tvq7eOpMtbzYHMHby5pY01Wm9vVTHk15BQDt1h1qnuKmQS3+nPt1nNNrV2k7XAI6lfJiQJw7CybOwMoDpkJDo75+XVWfL/o5+an8eYz19T2G31aYk5eQJG6EzxuQX402kc9PNxKKoycPR4QB1b0Bf8q+24AMyVnRBS0ZYvbTdsymPiBKp+V9sIqpVJ4WD0ScEm+I6l/gYB8dahawBtoDsX2JYdh/j3nzBFN88oe9yIoa/wdFQD/2OrBZfWxa1fRaxJiNo7lNVOkuwOazi+fqjJ/MWHfBjWEyuY9lLKUbuyRQQuBzdj6crq8XW9TU7kzVcbmsChUtQjcjFy5dYqpyBnXg4Sm1OIeQ3eBTv416ZmCY+X2CWb6bKE81K5gGd7NBsy0ZHUlxL7jB+jM6VZiKjgKoJ9hl+eMiqBlFX0K2XK43mKMHU1RH4OiR6wPZfGbe X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR08MB5577 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: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 78b73042-fa29-4704-c398-08d8bd586a6b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2YInZpo8A7KepYSNoVmvoXToQzfiQlbzbIj7UMyTz1hLfMlPGB2MRvZgCXVEVEoDUpPH1/sNQAPrmW9Y1kLRIuLe8B5xJ0NVFA8JILdtnZEBx5Vq/dXOyUuMkjBYKxn252ZJW+Iy5ZxQdi3+Pw9TYG3URdB5i9OrHzWPCGljymWt9UvOqwnq4yTVyX12UMHG9lJG0i3CuywE5wcUlYfURyLhBb57FqSPFAGFb6idzmVa0oWx1BcT6wMVwHnTQTDxlblVxbTObX6lsSQqBQhHkGbrT+tbhp78Wbz7nVf+2KpQyD3E/UMzfjo563o3voSQlYYmN24a8A1ZpkDSxWP+esEfYhkaAIlpgb/ajJEV/YrtI+YjjvKtRVcZ0ST3o1qwoZyd60v6tY4zQFdJ1uxsqA3Wuqh7AQoi+DCVOqKSYFl1ElSEG+nsW6HAwjpPcUTAm/zrDTXDNA6U5Ut/nalWchv7/MchLFYbOfBtAGL1EgetHM/v6cgep2biqwiY6Hizy99h3ucXS5bbgwwj4UTOu5iPAL4llAE/d0xO/rauEFtGoreuww6Yi/0Ozv0KWdO3GuqVVfWGecvquysir0Vd/lTjcEh/jzGyYai0Pw5RTxE0gY3MhVb3+0oi/0hviBzY 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)(39860400002)(346002)(396003)(46966006)(70206006)(5660300002)(2906002)(47076005)(70586007)(186003)(81166007)(8676002)(8936002)(478600001)(36756003)(82310400003)(6506007)(356005)(6916009)(2616005)(6486002)(336012)(26005)(6666004)(16526019)(316002)(6512007)(86362001)(44832011)(82740400003)(4744005)(956004)(69590400011); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2021 15:31:18.2268 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 49fca39c-a84c-44ee-ab73-08d8bd586e93 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: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3123 X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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" All linkers support __ehdr_start that support static PIE linking, so there is no need to check for its presence via a weak reference. This avoids a RELATIVE relocation in static PIE startup code on some targets. With non-PIE static linking the weak ref check is kept in case the linker does not support __ehdr_start. Reviewed-by: Adhemerval Zanella --- csu/libc-start.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/csu/libc-start.c b/csu/libc-start.c index db859c3bed..5b9ce1d158 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -175,8 +175,12 @@ LIBC_START_MAIN (int (*main) (int, char **, char ** MAIN_AUXVEC_DECL), information from auxv. */ extern const ElfW(Ehdr) __ehdr_start +# if BUILD_PIE_DEFAULT + __attribute__ ((visibility ("hidden"))); +# else __attribute__ ((weak, visibility ("hidden"))); if (&__ehdr_start != NULL) +# endif { assert (__ehdr_start.e_phentsize == sizeof *GL(dl_phdr)); GL(dl_phdr) = (const void *) &__ehdr_start + __ehdr_start.e_phoff;