From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by sourceware.org (Postfix) with ESMTPS id CC3053858D35 for ; Fri, 2 Dec 2022 03:53:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC3053858D35 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=huawei.com Received: from dggpeml500008.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4NNfDC2ysSzmV6H for ; Fri, 2 Dec 2022 11:52:59 +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:53:42 +0800 From: linzhuorong To: CC: , linzhuorong Subject: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] Date: Fri, 2 Dec 2022 11:53:20 +0800 Message-ID: <20221202035320.26785-1-linzhuorong@huawei.com> X-Mailer: git-send-email 2.12.3 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.67.188.132] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To dggpeml500008.china.huawei.com (7.185.36.147) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-12.5 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 List-Id: 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 -- 2.12.3