Message ID | 20221202035902.27063-1-linzhuorong@huawei.com |
---|---|
State | Superseded |
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> 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 <patchwork@sourceware.org>; 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 <libc-alpha@sourceware.org>; 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 <libc-alpha@sourceware.org>; 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: <libc-alpha@sourceware.org> CC: <nixiaoming@huawei.com>, <xiaojiangfeng@huawei.com>, <douzhaolei@huawei.com>, <wangbing6@huawei.com>, <wangfangpeng1@huawei.com>, <young.liuyang@huawei.com>, linzhuorong <linzhuorong@huawei.com> 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 Content-Type: text/plain 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 <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: linzhuorong via Libc-alpha <libc-alpha@sourceware.org> Reply-To: linzhuorong <linzhuorong@huawei.com> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
aarch64: fix elf_machine_dynamic compile error [BZ #29835]
|
|
Commit Message
linzhuorong
Dec. 2, 2022, 3:59 a.m. UTC
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 <linzhuorong@huawei.com> --- sysdeps/aarch64/dl-machine.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
The 12/02/2022 11:59, linzhuorong via Libc-alpha wrote: > elf_machine_dynamic compile error when compiling glibc with --enable-static-pie option turned on, static executables do not have symbol _DYNAMIC glibc no longer has --enable-static-pie, instead it has --disable-default-pie . static pie should have _DYNAMIC symbol since it has dynamic relocations (relative relocs), what is the binutils version? maybe glibc should disable default pie if old binutils is detected. > > Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make elf_machine_{load_address,dynamic} robust [BZ #28203]") > > Signed-off-by linzhuorong <linzhuorong@huawei.com> > --- > 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 >
disable-default-pie compile out different results The problem is why --enable-static-pie works in 7.3.0, but compiles error in 10.3.0? Error log: /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/libc.a(dl-reloc-static-pie.o): in function elf_machine_rel': /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' -----邮件原件----- 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> 发送时间: 2022年12月5日 22:55 收件人: linzhuorong <linzhuorong@huawei.com> 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; Liuyang (Young,C) <young.liuyang@huawei.com> 主题: Re: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] The 12/02/2022 11:59, linzhuorong via Libc-alpha wrote: > elf_machine_dynamic compile error when compiling glibc with > --enable-static-pie option turned on, static executables do not have > symbol _DYNAMIC glibc no longer has --enable-static-pie, instead it has --disable-default-pie . static pie should have _DYNAMIC symbol since it has dynamic relocations (relative relocs), what is the binutils version? maybe glibc should disable default pie if old binutils is detected. > > Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make > elf_machine_{load_address,dynamic} robust [BZ #28203]") > > Signed-off-by linzhuorong <linzhuorong@huawei.com> > --- > 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 >
The 12/07/2022 08:34, linzhuorong wrote: > disable-default-pie compile out different results > > The problem is why --enable-static-pie works in 7.3.0, but compiles error in 10.3.0? -static-pie support was added in gcc 8 so this likely works with gcc 7 because the configure option is just ignored then (and the static linked executables are not PIE) there can be linker issues causing gcc 10 to fail so the binutils version matters too, not just the gcc version. (on aarch64 you need at least version 2.30) the compiler target seems to be arm-linux-gnueabi which is not aarch64, so an aarch64 patch won't fix the issue. > > Error log: > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/libc.a(dl-reloc-static-pie.o): in function elf_machine_rel': /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > > > -----邮件原件----- > 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> > 发送时间: 2022年12月5日 22:55 > 收件人: linzhuorong <linzhuorong@huawei.com> > 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; Liuyang (Young,C) <young.liuyang@huawei.com> > 主题: Re: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] > > The 12/02/2022 11:59, linzhuorong via Libc-alpha wrote: > > elf_machine_dynamic compile error when compiling glibc with > > --enable-static-pie option turned on, static executables do not have > > symbol _DYNAMIC > > glibc no longer has --enable-static-pie, instead it has --disable-default-pie . > > static pie should have _DYNAMIC symbol since it has dynamic relocations (relative relocs), what is the binutils version? > > maybe glibc should disable default pie if old binutils is detected. > > > > > Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make > > elf_machine_{load_address,dynamic} robust [BZ #28203]") > > > > Signed-off-by linzhuorong <linzhuorong@huawei.com> > > --- > > 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 > >
The version of binutils is 2.38 Use gcc 7.3.0 just for testing, if there is no --static-pie, it may give ignore, I found only i386, arm, aarch64, loongarch use _DYNAMIC way to get, other are use GOT, what if I only fix arm? -----邮件原件----- 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> 发送时间: 2022年12月7日 17:14 收件人: linzhuorong <linzhuorong@huawei.com> 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; Liuyang (Young,C) <young.liuyang@huawei.com> 主题: Re: 答复: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] The 12/07/2022 08:34, linzhuorong wrote: > disable-default-pie compile out different results > > The problem is why --enable-static-pie works in 7.3.0, but compiles error in 10.3.0? -static-pie support was added in gcc 8 so this likely works with gcc 7 because the configure option is just ignored then (and the static linked executables are not PIE) there can be linker issues causing gcc 10 to fail so the binutils version matters too, not just the gcc version. (on aarch64 you need at least version 2.30) the compiler target seems to be arm-linux-gnueabi which is not aarch64, so an aarch64 patch won't fix the issue. > > Error log: > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/libc.a(dl-reloc-static-pie.o): in function elf_machine_rel': /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > > > -----邮件原件----- > 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> > 发送时间: 2022年12月5日 22:55 > 收件人: linzhuorong <linzhuorong@huawei.com> > 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; > xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei > <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) > <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; > Liuyang (Young,C) <young.liuyang@huawei.com> > 主题: Re: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ > #29835] > > The 12/02/2022 11:59, linzhuorong via Libc-alpha wrote: > > elf_machine_dynamic compile error when compiling glibc with > > --enable-static-pie option turned on, static executables do not have > > symbol _DYNAMIC > > glibc no longer has --enable-static-pie, instead it has --disable-default-pie . > > static pie should have _DYNAMIC symbol since it has dynamic relocations (relative relocs), what is the binutils version? > > maybe glibc should disable default pie if old binutils is detected. > > > > > Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make > > elf_machine_{load_address,dynamic} robust [BZ #28203]") > > > > Signed-off-by linzhuorong <linzhuorong@huawei.com> > > --- > > 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 > >
The 12/07/2022 12:52, linzhuorong wrote: > The version of binutils is 2.38 > Use gcc 7.3.0 just for testing, if there is no --static-pie, it may give ignore, I found only i386, arm, aarch64, loongarch use _DYNAMIC way to get, other are use GOT, > what if I only fix arm? what is the issue you want to fix? so far we haven't seen any. you just misconfigure the glibc build. > > -----邮件原件----- > 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> > 发送时间: 2022年12月7日 17:14 > 收件人: linzhuorong <linzhuorong@huawei.com> > 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; Liuyang (Young,C) <young.liuyang@huawei.com> > 主题: Re: 答复: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] > > The 12/07/2022 08:34, linzhuorong wrote: > > disable-default-pie compile out different results > > > > The problem is why --enable-static-pie works in 7.3.0, but compiles error in 10.3.0? > > -static-pie support was added in gcc 8 so this likely works with gcc 7 because the configure option is just ignored then (and the static linked executables are not PIE) > > there can be linker issues causing gcc 10 to fail so the binutils version matters too, not just the gcc version. (on aarch64 you need at least version 2.30) > > the compiler target seems to be arm-linux-gnueabi which is not aarch64, so an aarch64 patch won't fix the issue. > > > > > > Error log: > > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/obj/build-glibc/libc.a(dl-reloc-static-pie.o): in function elf_machine_rel': /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > > /home/XXXX/workspace/compiler/gcc/build/arm-linux-glibc/arm_linux_glibc_build_dir/arm-linux-glibc/lib/gcc/arm-linux-gnueabi/10.3.0/../../../../arm-linux-gnueabi/bin/ld: /home/XXXX/workspace/compiler/gcc/open_source/arm-linux-glibc-build_src/glibc-2.34/elf/../sysdeps/arm/dl-machine.h:440: undefined reference to _DYNAMIC' > > > > > > -----邮件原件----- > > 发件人: Szabolcs Nagy <szabolcs.nagy@arm.com> > > 发送时间: 2022年12月5日 22:55 > > 收件人: linzhuorong <linzhuorong@huawei.com> > > 抄送: libc-alpha@sourceware.org; Nixiaoming <nixiaoming@huawei.com>; > > xiaojiangfeng <xiaojiangfeng@huawei.com>; douzhaolei > > <douzhaolei@huawei.com>; Wangbing(wangbing,RTOS/Poincare Lab) > > <wangbing6@huawei.com>; wangfangpeng (A) <wangfangpeng1@huawei.com>; > > Liuyang (Young,C) <young.liuyang@huawei.com> > > 主题: Re: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ > > #29835] > > > > The 12/02/2022 11:59, linzhuorong via Libc-alpha wrote: > > > elf_machine_dynamic compile error when compiling glibc with > > > --enable-static-pie option turned on, static executables do not have > > > symbol _DYNAMIC > > > > glibc no longer has --enable-static-pie, instead it has --disable-default-pie . > > > > static pie should have _DYNAMIC symbol since it has dynamic relocations (relative relocs), what is the binutils version? > > > > maybe glibc should disable default pie if old binutils is detected. > > > > > > > > Fixes: bca0f5cbc9257c13322b99e55235c4f21ba0bd82("aarch64: Make > > > elf_machine_{load_address,dynamic} robust [BZ #28203]") > > > > > > Signed-off-by linzhuorong <linzhuorong@huawei.com> > > > --- > > > 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 > > >
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