From patchwork Fri Dec 2 03:53:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: linzhuorong X-Patchwork-Id: 61338 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 00BB13858C52 for ; Fri, 2 Dec 2022 03:54:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 00BB13858C52 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669953247; 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=roGdwvgwNoNwA1fpkFJuk/FoCmOAQb4YTrSGJzD3ak+WivTOep4S3FdYCYyMzlleO jNlu8oGelPSkivwB5IaLTdXcZGr0gml9dpgxUEXLuB+DXoMAcjLF/KLDfIsajYY4Ot DVNiULv8wkWwEMtwn+DBtAUWFXWuNV9BYW2TlJ0E= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 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 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 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 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