From: Fangrui Song <maskray@google.com>
To: Adhemerval Zanella <adhemerval.zanella@linaro.org>,
Joseph Myers <joseph@codesourcery.com>
Cc: libc-alpha@sourceware.org, "H.J. Lu" <hjl.tools@gmail.com>,
Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Subject: Re: [PATCH 0/3] Improve lld support and current status
Date: Wed, 27 Oct 2021 18:18:54 -0700 [thread overview]
Message-ID: <20211028011854.yrenushtllg23qop@google.com> (raw)
In-Reply-To: <20211028010630.dagff7p6rvygziho@google.com>
On 2021-10-27, Fangrui Song wrote:
>
>On 2021-10-27, Adhemerval Zanella wrote:
>>>>Similar to mips64/mips64el:
>>>>
>>>> ld.lld: warning: ../sysdeps/unix/sysv/linux/setitimer.c:(function
>>>> _dl_runtime_resolve: .text+0x18954): found R_MIPS_JALR relocation
>>>> against non-function symbol . This is invalid and most likely a compiler
>>>> bug.
>>>> ld.lld: error: can't create dynamic relocation R_MIPS_64 against local
>>>> symbol in readonly segment; recompile object files with -fPIC or pass
>>>> '-Wl,-z,notext' to allow text relocations in the output
>>>> >>> defined in
>>>> >>> /home/azanella/Projects/glibc/build/mips64-linux-gnu-lld/elf/librtld.os
>>>> >>> referenced by ../sysdeps/unix/sysv/linux/setitimer.c
>>>> >>> /home/azanella/Projects/glibc/build/mips64-linux-gnu-lld/elf/librtld.os:(.eh_frame+0x20)
>>>
>>>I took a look at LLD's R_MIPS_JALR code and I am inclined to trust it
>>>reporting a genuine issue.
>>
>>I give you that loader code is tricky, but it does not really explain why
>>lld is failing to link the eh_frame. It *might* due some internal assembly
>>routines, but at least from logs it does not seem so.
>
>Hope Joseph can answer the question.
>
>If we have easy-to-follow instructions building glibc mips with LLD, I can
>forward it to Simon Atanasyan (MIPS code owner of llvm-project and the major
>contributor of LLD's MIPS port)...
>
>But see below (for riscv/), I suspect this is a glibc sysdeps/ problem.
jrtc27 told me that BFD mips has a hack to rewrite R_MIPS_64 in
.eh_frame to avoid such a R_MIPS_64 diagnostic. LLD doesn't implement it.
Clang's mips port emits relative relocations in .eh_frame (DW_EH_PE_pcrel | dwarf::DW_EH_PE_sdata4)
to avoid the linker issue: https://reviews.llvm.org/D72228
Lack of 64-bit PC-relative relocation is a longstanding problem for mips.
LLVM integrated assembler and linker actually support `.quad foo - .`
via composed relocations, but it is still unsupported in GNU as
(feature request: https://sourceware.org/bugzilla/show_bug.cgi?id=26222)
I know really little about MIPS but I'd wish that GNU as implements
.quad foo-. and GCC migrates to PC-relative relocations like Clang.
next prev parent reply other threads:[~2021-10-28 1:18 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-26 20:03 Adhemerval Zanella
2021-10-26 20:03 ` [PATCH 1/3] elf: Disable ifuncmain{1,5,5pic,5pie} when using LLD Adhemerval Zanella
2021-10-29 19:49 ` Fangrui Song
2021-10-26 20:03 ` [PATCH 2/3] Fix LIBC_PROG_BINUTILS for -fuse-ld=lld Adhemerval Zanella
2021-10-26 20:48 ` Fangrui Song
2021-10-27 11:42 ` Adhemerval Zanella
2021-10-26 20:03 ` [PATCH 3/3] Check if linker also support -mtls-dialect=gnu2 Adhemerval Zanella
2021-10-27 2:04 ` Fāng-ruì Sòng
2021-10-29 0:56 ` Fāng-ruì Sòng
2021-10-26 20:33 ` [PATCH 0/3] Improve lld support and current status Fangrui Song
2021-10-27 13:11 ` Adhemerval Zanella
2021-10-28 1:06 ` Fangrui Song
2021-10-28 1:18 ` Fangrui Song [this message]
2021-10-28 17:40 ` Adhemerval Zanella
2021-10-28 11:48 ` Adhemerval Zanella
2021-10-27 22:39 ` Tulio Magno Quites Machado Filho
2021-10-27 22:50 ` Tulio Magno Quites Machado Filho
2021-11-05 7:23 ` lld status with powerpc64 Fangrui Song
2021-11-05 7:45 ` Fangrui Song
2021-11-05 13:58 ` Adhemerval Zanella
2021-11-05 19:32 ` Adhemerval Zanella
2021-11-05 19:38 ` H.J. Lu
2021-11-05 19:40 ` H.J. Lu
2021-11-05 19:50 ` Fāng-ruì Sòng
2021-11-07 14:24 ` Bill Schmidt
2021-11-08 11:37 ` Adhemerval Zanella
2021-11-08 13:26 ` Bill Schmidt
2021-11-08 13:54 ` Adhemerval Zanella
2021-11-08 13:59 ` Bill Schmidt
2021-11-08 14:11 ` Adhemerval Zanella
2021-11-08 14:12 ` Bill Schmidt
[not found] ` <OFD215FC7A.323066CE-ON00258787.0051DA95-00258787.00532945@ibm.com>
2021-11-08 22:38 ` Fangrui Song
2021-11-09 12:20 ` Adhemerval Zanella
2021-10-27 23:37 ` [PATCH 0/3] Improve lld support and current status Fangrui Song
2021-10-28 17:27 ` Tulio Magno Quites Machado Filho
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211028011854.yrenushtllg23qop@google.com \
--to=maskray@google.com \
--cc=adhemerval.zanella@linaro.org \
--cc=hjl.tools@gmail.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=tuliom@linux.ibm.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).