From patchwork Fri Dec 2 03:59:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: linzhuorong X-Patchwork-Id: 61340 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 7662D3858421 for ; Fri, 2 Dec 2022 03:59:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7662D3858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669953571; bh=/IeDw8lnc6STu9WhbwcV55IBOS8Av+tFOK74xQC0Cs4=; h=To:CC:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=EtqWzNzedtNNm0lhL2jCkTTK9NPv/EB0UDsnSpfZUGkUqCYhpLrK4bTmLMBZy+1BC Kk7r8E56reSYI4TadW+8xi+z0qTJsPJaH7EKAAvLvvHds5D47jQxIUcs1BFMiEzXWS Nnoyun0/jWejPLSeHW9CKRUdbuxdP3Xh0IpKo2HY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by sourceware.org (Postfix) with ESMTPS id 8442A3858C83 for ; Fri, 2 Dec 2022 03:59:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8442A3858C83 Received: from dggpeml500008.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NNfLT6xffz15Mrl for ; Fri, 2 Dec 2022 11:58:25 +0800 (CST) Received: from linux-suse12sp5.huawei.com (10.67.188.132) by dggpeml500008.china.huawei.com (7.185.36.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 2 Dec 2022 11:59:08 +0800 To: CC: , , , , , , linzhuorong Subject: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] Date: Fri, 2 Dec 2022 11:59:02 +0800 Message-ID: <20221202035902.27063-1-linzhuorong@huawei.com> X-Mailer: git-send-email 2.12.3 MIME-Version: 1.0 X-Originating-IP: [10.67.188.132] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500008.china.huawei.com (7.185.36.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_STOCKGEN, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: linzhuorong via Libc-alpha From: linzhuorong Reply-To: linzhuorong Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" elf_machine_dynamic compile error when compiling glibc with --enable-static-pie option turned on, static executables do not have symbol _DYNAMIC Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make elf_machine_{load_address,dynamic} robust [BZ #28203]") Signed-off-by linzhuorong --- sysdeps/aarch64/dl-machine.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index ae8b14425a..49b1d1ea0e 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -53,8 +53,9 @@ elf_machine_load_address (void) static inline ElfW(Addr) __attribute__ ((unused)) elf_machine_dynamic (void) { - extern ElfW(Dyn) _DYNAMIC[] attribute_hidden; - return (ElfW(Addr)) _DYNAMIC - elf_machine_load_address (); + /* Declaring this hidden ensures that a PC-relative reference is uesed. */ + extern const ElfW(Addr) _GLOBAL_OFFSET_TABLE_[] attribute_hidden; + return _GLOBAL_OFFSET_TABLE_[0]; } /* Set up the loaded object described by L so its unrelocated PLT