From: linzhuorong via Libc-alpha <libc-alpha@sourceware.org>
To: Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: "libc-alpha@sourceware.org" <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>
Subject: 答复: [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835]
Date: Wed, 7 Dec 2022 08:34:05 +0000 [thread overview]
Message-ID: <9002f8c2ba144c3bbe5b788d806cdb85@huawei.com> (raw)
In-Reply-To: <Y44GOoWx/dT2K/Gw@arm.com>
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
>
next prev parent reply other threads:[~2022-12-07 8:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 3:59 [PATCH] aarch64: fix elf_machine_dynamic compile error [BZ #29835] linzhuorong via Libc-alpha
2022-12-05 14:54 ` Szabolcs Nagy via Libc-alpha
2022-12-07 8:34 ` linzhuorong via Libc-alpha [this message]
2022-12-07 9:14 ` 答复: " Szabolcs Nagy via Libc-alpha
2022-12-07 12:52 ` 答复: " linzhuorong via Libc-alpha
2022-12-08 9:26 ` Szabolcs Nagy via Libc-alpha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9002f8c2ba144c3bbe5b788d806cdb85@huawei.com \
--to=libc-alpha@sourceware.org \
--cc=douzhaolei@huawei.com \
--cc=linzhuorong@huawei.com \
--cc=nixiaoming@huawei.com \
--cc=szabolcs.nagy@arm.com \
--cc=wangbing6@huawei.com \
--cc=wangfangpeng1@huawei.com \
--cc=xiaojiangfeng@huawei.com \
--cc=young.liuyang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).