From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70043.outbound.protection.outlook.com [40.107.7.43]) by sourceware.org (Postfix) with ESMTPS id 31E20385840E for ; Thu, 7 Oct 2021 14:15:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 31E20385840E Received: from DB6PR0402CA0009.eurprd04.prod.outlook.com (2603:10a6:4:91::19) by VE1PR08MB5773.eurprd08.prod.outlook.com (2603:10a6:800:1a9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18; Thu, 7 Oct 2021 14:15:40 +0000 Received: from DB5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:91:cafe::e) by DB6PR0402CA0009.outlook.office365.com (2603:10a6:4:91::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Thu, 7 Oct 2021 14:15:40 +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 DB5EUR03FT054.mail.protection.outlook.com (10.152.20.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Thu, 7 Oct 2021 14:15:39 +0000 Received: ("Tessian outbound a8bfe25d7364:v103"); Thu, 07 Oct 2021 14:15:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6f82b035f0762df8 X-CR-MTA-TID: 64aa7808 Received: from 0d4455474ce4.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 9A032E1B-0BD0-4576-AB17-B3CF3821D6C5.1; Thu, 07 Oct 2021 14:15:33 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 0d4455474ce4.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 07 Oct 2021 14:15:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iJGPv+DeL3psWelvt2rJ/BYTf39Sl0XyFiAXSxL5Gx3+xmYO6SLnpyJLry+lyYPRBQP0sIdQjEmAMcdZ0dU+kUVibAMCj3V10/McSc80aDWFrWtEiC+ZUvKGWaak6EjKzYxlIjSmZo/dLutXMMThGzmfLtCQk4SfGncA2+4QHTAvSwTNm4VWy/lsBZLhHXgNrM4xRe9KDyUQq1kfw6ANMYinW0mYgHeG/LAGRQklD5DBCjpor8z1bev7ec//yVFGwAfIwK0Tqtn401mBWhpoTDn018NNj+i9WE+tj3w8mhaLfa/dqj/9rVtK3rZvqJ0rl5Xtk0MzKLRbzhYRt1r6jQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IG1iNJCL30Kriu9ZNul8E2RNkFZpaSHwviFx8/m4a4Q=; b=VHKWw3/GxHiUDXLPfyYZcAMjW4Xz1rwnXfTomg7sTVKd5gvvmIn+aO1iREv8PdcG2dTRLFihQSRU3J7RxqmEN2kjjQPjVHNGZ+eSw+1QCH9LWscvHLtzB0KrVfzNMjLIW1UVzWyTLMbGpxEzhyNnrYgB32zVs3L0jAvwny5PI3dkXNCV9NLZU8Xb6VpSAOzSZ6y96E9IhuCSiCMOd6GtPfyP2htfnD8bo3UK33VgWJnREYTtK8W8o65BduKTyc/xUu1Lakh1UMH4Jyf9btE6VGZLc0y61D4IfM6VL6RglE05L9AO16jHFGO2GuW3GVumDqfm4t9axIivbANI1+fUVQ== 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: denx.de; dkim=none (message not signed) header.d=none;denx.de; dmarc=none action=none header.from=arm.com; Received: from VI1PR0801MB1854.eurprd08.prod.outlook.com (2603:10a6:800:5c::15) by VI1PR08MB3888.eurprd08.prod.outlook.com (2603:10a6:803:b8::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.20; Thu, 7 Oct 2021 14:15:30 +0000 Received: from VI1PR0801MB1854.eurprd08.prod.outlook.com ([fe80::a592:9d43:f9d3:bad7]) by VI1PR0801MB1854.eurprd08.prod.outlook.com ([fe80::a592:9d43:f9d3:bad7%5]) with mapi id 15.20.4566.023; Thu, 7 Oct 2021 14:15:28 +0000 Date: Thu, 7 Oct 2021 15:15:26 +0100 From: Szabolcs Nagy To: Lukasz Majewski Cc: Fangrui Song , Adhemerval Zanella , Florian Weimer , Joseph Myers , Andreas Schwab , libc-alpha Subject: Re: [PATCH] dl: Use "adr" assembler command to get proper load address Message-ID: <20211007141526.GF2700@arm.com> References: <20210907164906.yt6nonvfyhvbrx6p@google.com> <20210907193227.6047f9cc@ktm> <20210907174417.sctsswphsyae4mpc@google.com> <20211005094554.2f28d6bd@ktm> <20211006075721.qnv6qabroytcsido@google.com> <20211006110321.5f1a9610@ktm> <20211006134344.63395242@ktm> <20211006125517.GE2700@arm.com> <20211007111926.30db4c4f@ktm> <20211007120038.1445bbd3@ktm> Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20211007120038.1445bbd3@ktm> X-ClientProxiedBy: LO4P123CA0202.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a5::9) To VI1PR0801MB1854.eurprd08.prod.outlook.com (2603:10a6:800:5c::15) MIME-Version: 1.0 Received: from arm.com (217.140.106.52) by LO4P123CA0202.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:1a5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Thu, 7 Oct 2021 14:15:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7cb61187-aedf-4535-5708-08d9899cf0e2 X-MS-TrafficTypeDiagnostic: VI1PR08MB3888:|VE1PR08MB5773: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1850;OLM:1850; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: GS9Vu42UCOUfD8RIsNEpSZUk0901Q8yXZ/7JnBGh/D3YV1QOXoBbPXvXpm5BAh7aPJA/mkmBUg2lIcR/8xASmG+O6V25EsFnqe34QRYzx/mP2uRLEmhXCgZSkaL0QAOyJlM9rAluBrFWVyGZ4U/Vq45a6JlAeoDP1PelyBHBcD+iZXtYhhc1t/qpSto/v94mKGieWKBBG++9ulLzCnDfEpRDylHqhTTbkaQHxe2CX1/QsKxL5L3JoLesidLljleXFaDwn9B7O2TOo89IMqI/MTU5uIcDMJwkI0keENN0M/BOIzklWwvX2ZMQDx3wMT+pSWmubvYtgC2MzZ7yeG682o4WDu1HpXT6vmdhJ9z+EO2raws9Yztu1GKLem8HgUQwSk4i6Fs+BcdnY4Y5gw07h9osL13gH+OcEwMaSUhVOJhk6P+hy7duXedtXgb79b13rmKqakgHLAB4+VvyYSQJUl6BcghPNPzw1OcBHIBDO/YUYAMMqLvh99YzYB1NpzC6EcS22s8agTy5nqHiB6/bC25yu5waqCgL7EnBRA4qBwPtOqF8WjzGLZO3XcQ2u7a8RmipN39qUDem3Efg5kY4mXMM6rl0c4VwYE4DnlQ+GEiBoQLvv+tRiDX27SxxvN8b1hPBlC0IMj7YgW0bodAg2qQp30WJ7mJE4e25Fhya9TQhQmc7tlyRNpfwxGkQ7jPv4dt5nWtb8YiU+8XGHh+DjFOn1nBu87+/1QZS+Ft8Frn+N6WtHq0leezAkgNapYk+kqCNAJzBlpGqxeKJd1+dZmIijf87LITb2Kkc27YzuzsMbv2I6GkP6q8Icz5jBXCZgsnFhVsDOTWlm0etghI2og== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VI1PR0801MB1854.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(66946007)(66556008)(66476007)(8886007)(4326008)(26005)(2616005)(956004)(44832011)(6916009)(7696005)(36756003)(52116002)(2906002)(8676002)(38100700002)(316002)(966005)(33656002)(38350700002)(83380400001)(55016002)(8936002)(5660300002)(86362001)(186003)(508600001)(1076003)(54906003); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3888 Original-Authentication-Results: denx.de; dkim=none (message not signed) header.d=none;denx.de; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: d78bd675-caba-41db-ddde-08d9899cea09 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BCyq+bIMh1gl5xzI1kTC0P6uoPUD/GgZfTtNE+k577jy3m/G1QFoe6VppeHwqeKOhs7YX4krh0lauvPtSnzKdjQXSuxdGOd6BTI47V8VTEtdV6DzkbI35/eMkAqgzKXwPZZ0lfGbqeiOWy6m71LJHQedicHJZefzeP9NwdhYFpw+EQTB0m96Tjay0lYH073FXTcpygHCJ1ouNXUz8Dh48r2JtOJFroE70c/7PrmhBa6+WOn8nbeWcXef/g5uXauPAUXs+c6TMZ+G8wYs3saaVMslvIw+uw4U7SkftFnPG5itixkwXVqgugA1Od6FYKt6Xin3PazyoUR2JRCm8f3kWa0L28fst86stZYEUrjJyHCGqjTg3RVBQzolfKM6H8AJnCBNA76S7Ky/FbNXyJ2RrUHg9Gi1piHxZPf7/geagr82z7Z76dhZOrCQqFWoNH7D2V+Pp02W3DtHG6+fNVZDiq8wHNpaculs9zvtcRO2P9gNzoMYbo3+pDGZ+M4xIVzoynXs2GyasE8NI6EWSLJTZm3SLjD5bZ0Rg8WMoKTdix0gkpQfJ8BhnVUHhS9UG7It+KNaHh1wbDSABnvuwtc+6LKxWAp5SwtphcoPBxNuPkh0Gk8pNwYR9wMVvcft/2XzWBs3HwWABu8h0vLZhojGE4fG9mMJ3OgdRa0g9ehM2mf4oopmunQsuTdS1ictPSVkBIW7K/B3C0yL/vYuGCs7wV7Mz4AsAWAvQokwS7OEwnoNBD18cNP89gAGv09v06/q+PdGPOI0Jv/S7GaU21nilvb4lYgZdsGD8RCmBslXX2oz48qz2tp/V315+vmpkj0v4s/twSCDVYESir8bz8hWhA== 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)(46966006)(36840700001)(7696005)(5660300002)(8676002)(1076003)(966005)(83380400001)(4326008)(2616005)(82310400003)(70586007)(33656002)(36860700001)(47076005)(36756003)(44832011)(6862004)(81166007)(8886007)(8936002)(70206006)(956004)(2906002)(26005)(55016002)(86362001)(186003)(336012)(316002)(508600001)(356005)(54906003); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2021 14:15:39.8824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cb61187-aedf-4535-5708-08d9899cf0e2 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: DB5EUR03FT054.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5773 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Thu, 07 Oct 2021 14:15:56 -0000 The 10/07/2021 12:00, Lukasz Majewski wrote: > On Thu, 7 Oct 2021 11:19:26 +0200 > Lukasz Majewski wrote: > > Please find working and broken ld-linux-armhf.so.3: > > https://owncloud.denx.de/s/wtAfktG6pXLffSA thanks. i can confirm that this crashes on an aarch64 machine too (that supports running arm binaries), so not just a qemu problem. > > > > Links: > > > > [1] - > > > > https://github.com/lmajewski/y2038_glibc/commit/e67e0f589b88a44be8f8b9b770b08950dd7e5bd5 > > > > > > > > readelf -e ld-linux-armhf.so.3 > > > > > > > > [10] .plt PROGBITS 41000994 000994 000050 04 > > > > AX 0 0 4 [11] .text PROGBITS 41000a00 > > > > 000a00 01fed0 00 AX 0 0 64 [12] .rodata PROGBITS > > > > 410208d0 0208d0 004b24 00 A 0 0 4 [13] .ARM.extab > > > > PROGBITS 410253f4 0253f4 000018 00 A 0 0 4 [14] > > > > .ARM.exidx ARM_EXIDX 4102540c 02540c 0000c8 00 AL 11 > > > > 0 4 [15] .data.rel.ro PROGBITS 41036200 026200 > > > > 000cf4 00 WA 0 0 8 [16] .dynamic DYNAMIC > > > > 41036ef4 026ef4 0000c8 08 WA 5 0 4 [17] .got > > > > PROGBITS 41036fbc 026fbc 000040 04 WA 0 0 4 > > > > > > why are all addresses >0x41000000 ? > > > in a shared library i expect all those addresses > > > to be close to 0. > > > > On this real HW system (the rootfs which is running) - libc.so.6 also > > has address > 0x41000000 > > libm.so.6 also has the value > 0x41200000 > > (Entry point address: 0x412c9190) > > > > The offset of > 0x41000000 looks a bit strange indeed, but it is still > > less than the kernel space. Moreover, with position independent code > > it shall not matter. > > > > > > > > is this made by some modified binutils? > > > > I've double checked the ld-linux-armhf.so.3 and after build it has: > > (Entry point address: 0xa00) which seems to be correct. > > > > So it looks like during installation of the glibc (on the Yocto/OE > > created rootfs) the elf header is modified and this 0x41000000 offset > > is added. > > > > And indeed it is the case. Yocto/OE by default perform prelinking (use > prelink program) to speedup start time of dynamic program. > > The prelink [1] itself assigns some virtual addresses to all required > shared objects (in our case for /sbin/init), so no clashes are > encountered. > > And using prelink is a _default_ behaviour in Yocto/OE poky distro. > > Links: > [1] - https://linux.die.net/man/8/prelink ah prelinking. ok so &__ehdr_start is supposed to point to the elf header, which supposed to start at address 0 within the elf image. but with prelinking everthing is moved by a fixed offset (including the elf header), so __ehdr_start is no longer has 0 address. i don't immediately know what's the best fix for this.