From nobody Wed May 22 08:31:58 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Vkl0G6Tnrz5LD6w; Wed, 22 May 2024 08:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Vkl0G2lYjz4jBJ; Wed, 22 May 2024 08:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716366718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/YE/QyoqyZpATJkmQb4fwQA+bml6r8dHPUS+QtXEsmc=; b=sXFYIyop0g4GMW/nkY8cmCyP3/qdefyKio9NX9gJcl0GZECZZ7D5Z5ykEfNRcyHg+ecEIQ N73RTzPVVrZEpxRlS13/H2KJ0p6Fg4V/dqNfyB/wS7JIiqnKacZYqcR2AqYS+ZOyKorcr1 x1asE9OJnfHch4Cxe+ec7+D2ze/IHCP2EIsI/kaCdzBY8h09BAdZjqPR01ekeC3GXfu1jT YMrocFGLDXUrK4li/w5wYVw67eXfM3FuI2K/yJIVmsREob/S9PERUbPM02fn+9N2L0CMhB M2tCuaJfXD0UOMJKzAYByOFeX8Rz2OpO0G8OMDWbeQBGDSVSIo1xscl0i0vwzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716366718; a=rsa-sha256; cv=none; b=no/4VJLSZydYnycczKTICy/QkmN3Sbgc+6AC4/5OwdPU16zSUmuWl5y14CfSPg0l4GD561 e3Q8aY0i8i6X7fBbEKdZ66Q15kIyZeXPHlSaronwt0pC3KrbkUetYWA0FrDm+5RmNFjkEn ZDuJ+/hJr1/JzsMOl7qBnVcLR1vc+wpEj/3TIG1NT+CWEzYwjEA/dWwNhhisk6Wy6RaXzh TyYs1KWW2de7Hw9/WNC6DNQLSEHLJi8jNiMx2UOH1e8gn585yZ8BM1emufXKv+wM2Lf4Cd bhcBFFyvrdb3mWSjGCcPNTt+pUd+oVCZXGOhhSgem8HESus6k5qO7uFb806JIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716366718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=/YE/QyoqyZpATJkmQb4fwQA+bml6r8dHPUS+QtXEsmc=; b=NEGMgbmErEC3QSYKJ2PWXJ1pvGNmJKE41xwYZYQ3xoU7AZibh5ZlglDbkHIXXNzM7SJmEB BuMHwxDy1lmY1yWjk4f7/MhrmhBDKrI7aT/1RpASFPBc47kFvS0XdBcGVfWImrtVp/sxzz H3VWqAsLoSYuPzUkqTDckZysej+ELuNqfyd2YXjxAtsjXjuiVQOUUsdbKux77Ru7ldLOsG FBGsAhoS8OPUrrA/xB/9mRcOhtodt6rLXmdL0CVVLyJCLJcTX0sQWFlld7HtBBX73aBKOP fnh8c39JpWPO86+ryQOHHnOus3+CxDNaORTGckCJ/g26IN1jjxe57CJipCnvYQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Vkl0G2MkJzyRs; Wed, 22 May 2024 08:31:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44M8VwrL008770; Wed, 22 May 2024 08:31:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44M8Vwax008767; Wed, 22 May 2024 08:31:58 GMT (envelope-from git) Date: Wed, 22 May 2024 08:31:58 GMT Message-Id: <202405220831.44M8Vwax008767@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andrew Turner Subject: git: 53120fbb6895 - main - csu: Find the main pointer through the GOT List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: andrew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 53120fbb68952b7d620c2c0e1cf05c5017fc1b27 Auto-Submitted: auto-generated The branch main has been updated by andrew: URL: https://cgit.FreeBSD.org/src/commit/?id=53120fbb68952b7d620c2c0e1cf05c5017fc1b27 commit 53120fbb68952b7d620c2c0e1cf05c5017fc1b27 Author: Andrew Turner AuthorDate: 2024-05-22 08:18:10 +0000 Commit: Andrew Turner CommitDate: 2024-05-22 08:18:10 +0000 csu: Find the main pointer through the GOT Use the Global Offset Table to find the location of main in crt1. With lld the old code would point to main@plt, however ld.bfd fails to link when main is in a shared library. Fix this by using the GOT address to find main as it works with both lld and bfd. Reviewed by: jrtc27 Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45259 --- lib/csu/aarch64/crt1_s.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/csu/aarch64/crt1_s.S b/lib/csu/aarch64/crt1_s.S index 981cf4653efd..1fb60f756a7a 100644 --- a/lib/csu/aarch64/crt1_s.S +++ b/lib/csu/aarch64/crt1_s.S @@ -44,8 +44,8 @@ ENTRY(_start) add x2, x1, x0, lsl #3 /* env is after argv */ add x2, x2, #8 /* argv is null terminated */ #ifdef PIC - adrp x4, main - add x4, x4, :lo12:main + adrp x4, :got:main + ldr x4, [x4, :got_lo12:main] #else ldr x4, =main #endif