* [MIPS] Can we have R_MIPS_PC64?
@ 2020-02-05 7:19 Fangrui Song
2020-02-05 9:00 ` Andrew Pinski
0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2020-02-05 7:19 UTC (permalink / raw)
Cc: binutils
R_MIPS_PC32 exists as a GNU extension.
R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
(like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
This just makes certain things unnecessarily complex.
* DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
* __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
.quad foo - . => Error: PC-relative reference to a different section
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-05 7:19 [MIPS] Can we have R_MIPS_PC64? Fangrui Song
@ 2020-02-05 9:00 ` Andrew Pinski
2020-02-05 9:04 ` Andrew Pinski
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Pinski @ 2020-02-05 9:00 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Tue, Feb 4, 2020 at 11:20 PM Fangrui Song <i@maskray.me> wrote:
>
> R_MIPS_PC32 exists as a GNU extension.
> R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
> (like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
But the why is recorded still in the mail archives:
https://sourceware.org/ml/binutils/2004-04/msg00657.html
Thanks,
Andrew Pinski
>
> This just makes certain things unnecessarily complex.
>
> * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
> * __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
> .quad foo - . => Error: PC-relative reference to a different section
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-05 9:00 ` Andrew Pinski
@ 2020-02-05 9:04 ` Andrew Pinski
2020-02-05 9:10 ` Andrew Pinski
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Pinski @ 2020-02-05 9:04 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Wed, Feb 5, 2020 at 12:59 AM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Tue, Feb 4, 2020 at 11:20 PM Fangrui Song <i@maskray.me> wrote:
> >
> > R_MIPS_PC32 exists as a GNU extension.
> > R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
> > (like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
>
> But the why is recorded still in the mail archives:
> https://sourceware.org/ml/binutils/2004-04/msg00657.html
See the GCC side of the reason:
https://gcc.gnu.org/ml/gcc-patches/2004-04/msg01093.html
Thanks,
Andrew Pinski
>
> Thanks,
> Andrew Pinski
>
>
> >
> > This just makes certain things unnecessarily complex.
> >
> > * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
> > * __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
> > .quad foo - . => Error: PC-relative reference to a different section
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-05 9:04 ` Andrew Pinski
@ 2020-02-05 9:10 ` Andrew Pinski
2020-02-05 9:16 ` Andrew Pinski
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Pinski @ 2020-02-05 9:10 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Wed, Feb 5, 2020 at 1:04 AM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Wed, Feb 5, 2020 at 12:59 AM Andrew Pinski <pinskia@gmail.com> wrote:
> >
> > On Tue, Feb 4, 2020 at 11:20 PM Fangrui Song <i@maskray.me> wrote:
> > >
> > > R_MIPS_PC32 exists as a GNU extension.
> > > R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
> > > (like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
> >
> > But the why is recorded still in the mail archives:
> > https://sourceware.org/ml/binutils/2004-04/msg00657.html
>
> See the GCC side of the reason:
> https://gcc.gnu.org/ml/gcc-patches/2004-04/msg01093.html
Note the reason why R_MIPS_PC32 was added back is described here:
https://sourceware.org/ml/binutils/2004-06/msg00213.html
So it is a GNU extension as GCC accidentally emitted them so it needed
to be added back.
Thanks,
Andrew
>
>
> Thanks,
> Andrew Pinski
>
> >
> > Thanks,
> > Andrew Pinski
> >
> >
> > >
> > > This just makes certain things unnecessarily complex.
> > >
> > > * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
> > > * __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
> > > .quad foo - . => Error: PC-relative reference to a different section
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-05 9:10 ` Andrew Pinski
@ 2020-02-05 9:16 ` Andrew Pinski
2020-02-08 18:40 ` Fangrui Song
0 siblings, 1 reply; 9+ messages in thread
From: Andrew Pinski @ 2020-02-05 9:16 UTC (permalink / raw)
To: Fangrui Song; +Cc: binutils
On Wed, Feb 5, 2020 at 1:10 AM Andrew Pinski <pinskia@gmail.com> wrote:
>
> On Wed, Feb 5, 2020 at 1:04 AM Andrew Pinski <pinskia@gmail.com> wrote:
> >
> > On Wed, Feb 5, 2020 at 12:59 AM Andrew Pinski <pinskia@gmail.com> wrote:
> > >
> > > On Tue, Feb 4, 2020 at 11:20 PM Fangrui Song <i@maskray.me> wrote:
> > > >
> > > > R_MIPS_PC32 exists as a GNU extension.
> > > > R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
> > > > (like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
> > >
> > > But the why is recorded still in the mail archives:
> > > https://sourceware.org/ml/binutils/2004-04/msg00657.html
> >
> > See the GCC side of the reason:
> > https://gcc.gnu.org/ml/gcc-patches/2004-04/msg01093.html
>
> Note the reason why R_MIPS_PC32 was added back is described here:
> https://sourceware.org/ml/binutils/2004-06/msg00213.html
>
> So it is a GNU extension as GCC accidentally emitted them so it needed
> to be added back.
> * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
Never used on MIPS, see
https://gcc.gnu.org/ml/gcc-patches/2004-06/msg00970.html
Plus:
https://www.sourceware.org/ml/binutils/2004-05/msg00227.html
>
>
> Thanks,
> Andrew
>
> >
> >
> > Thanks,
> > Andrew Pinski
> >
> > >
> > > Thanks,
> > > Andrew Pinski
> > >
> > >
> > > >
> > > > This just makes certain things unnecessarily complex.
> > > >
> > > > * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
> > > > * __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
> > > > .quad foo - . => Error: PC-relative reference to a different section
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-05 9:16 ` Andrew Pinski
@ 2020-02-08 18:40 ` Fangrui Song
2020-02-17 18:07 ` Maciej W. Rozycki
0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2020-02-08 18:40 UTC (permalink / raw)
To: Andrew Pinski; +Cc: binutils
On 2020-02-05, Andrew Pinski wrote:
>On Wed, Feb 5, 2020@1:10 AM Andrew Pinski <pinskia@gmail.com> wrote:
>>
>> On Wed, Feb 5, 2020@1:04 AM Andrew Pinski <pinskia@gmail.com> wrote:
>> >
>> > On Wed, Feb 5, 2020@12:59 AM Andrew Pinski <pinskia@gmail.com> wrote:
>> > >
>> > > On Tue, Feb 4, 2020@11:20 PM Fangrui Song <i@maskray.me> wrote:
>> > > >
>> > > > R_MIPS_PC32 exists as a GNU extension.
>> > > > R_MIPS_PC64 existed, but was removed by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=4030e8f62467c29b782aa2480e1e452b8e458699
>> > > > (like all the old commits, the description just recorded what the commit *did*. There was no *why*.)
>> > >
>> > > But the why is recorded still in the mail archives:
>> > > https://sourceware.org/ml/binutils/2004-04/msg00657.html
>> >
>> > See the GCC side of the reason:
>> > https://gcc.gnu.org/ml/gcc-patches/2004-04/msg01093.html
>>
>> Note the reason why R_MIPS_PC32 was added back is described here:
>> https://sourceware.org/ml/binutils/2004-06/msg00213.html
>>
>> So it is a GNU extension as GCC accidentally emitted them so it needed
>> to be added back.
>
>
>> * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
>Never used on MIPS, see
>https://gcc.gnu.org/ml/gcc-patches/2004-06/msg00970.html
>Plus:
>https://www.sourceware.org/ml/binutils/2004-05/msg00227.html
>
>>
>>
>> Thanks,
>> Andrew
>>
>> >
>> >
>> > Thanks,
>> > Andrew Pinski
>> >
>> > >
>> > > Thanks,
>> > > Andrew Pinski
>> > >
>> > >
>> > > >
>> > > > This just makes certain things unnecessarily complex.
>> > > >
>> > > > * DW_EH_PE_pcrel|DW_EH_PE_sdata8 => ?
>> > > > * __patchable_function_entries has to have the SHF_WRITE flag on MIPS https://gcc.gnu.org/ml/gcc/2020-01/msg00106.html
>> > > > .quad foo - . => Error: PC-relative reference to a different section
I hope someone can add back R_MIPS_PC64.
I don't have any take on MIPS. I just feel that MIPS64 makes other
64-bit architectures inconvenient due to its own deficiency.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-08 18:40 ` Fangrui Song
@ 2020-02-17 18:07 ` Maciej W. Rozycki
2020-02-19 4:26 ` Fangrui Song
0 siblings, 1 reply; 9+ messages in thread
From: Maciej W. Rozycki @ 2020-02-17 18:07 UTC (permalink / raw)
To: Fangrui Song; +Cc: Andrew Pinski, binutils
On Sat, 8 Feb 2020, Fangrui Song wrote:
> I hope someone can add back R_MIPS_PC64.
You don't need R_MIPS_PC64. You can yield the same effect the usual
MIPS64 way, that is by composing R_MIPS_PC32 with R_MIPS_64 (similarly to
e.g. how R_MIPS_REL32 composes with R_MIPS_64).
Of course the toolchain may not as it stands support this composition.
Feel free to post patches to take care of your use case.
HTH,
Maciej
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-17 18:07 ` Maciej W. Rozycki
@ 2020-02-19 4:26 ` Fangrui Song
2020-07-09 5:23 ` Fangrui Song
0 siblings, 1 reply; 9+ messages in thread
From: Fangrui Song @ 2020-02-19 4:26 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Andrew Pinski, binutils
On 2020-02-17, Maciej W. Rozycki wrote:
>On Sat, 8 Feb 2020, Fangrui Song wrote:
>
>> I hope someone can add back R_MIPS_PC64.
>
> You don't need R_MIPS_PC64. You can yield the same effect the usual
>MIPS64 way, that is by composing R_MIPS_PC32 with R_MIPS_64 (similarly to
>e.g. how R_MIPS_REL32 composes with R_MIPS_64).
>
> Of course the toolchain may not as it stands support this composition.
>Feel free to post patches to take care of your use case.
>
> HTH,
>
> Maciej
Thank you for your comments. Sorry that I cannot create a patch, as I know very little about MIPS.
I raised these MIPS issues (including the recent DT_MIPS_XHASH
https://sourceware.org/ml/binutils/2020-01/msg00451.html) not because I
have anything to do with MIPS. I started the threads from the viewpoint
of a toolchain maintainer.
I noticed MIPS introduced complexity in a number of areas,
where other architectures can share a simple common implementation.
(It is weird that .quad foo - . is not representable on MIPS64.)
For my own selfish purposes, I will be sad if someone wants to add some
peculiar MIPS features (e.g. DT_MIPS_XHASH) to LLVM binary utilities or
lld. I hope we can get rid of things like
https://reviews.llvm.org/D72228 at some point.
I hope someone can implement PC64, or something similar for MIPS.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [MIPS] Can we have R_MIPS_PC64?
2020-02-19 4:26 ` Fangrui Song
@ 2020-07-09 5:23 ` Fangrui Song
0 siblings, 0 replies; 9+ messages in thread
From: Fangrui Song @ 2020-07-09 5:23 UTC (permalink / raw)
To: binutils
On 2020-02-18, Fangrui Song wrote:
>On 2020-02-17, Maciej W. Rozycki wrote:
>>On Sat, 8 Feb 2020, Fangrui Song wrote:
>>
>>>I hope someone can add back R_MIPS_PC64.
>>
>>You don't need R_MIPS_PC64. You can yield the same effect the usual
>>MIPS64 way, that is by composing R_MIPS_PC32 with R_MIPS_64 (similarly to
>>e.g. how R_MIPS_REL32 composes with R_MIPS_64).
>>
>>Of course the toolchain may not as it stands support this composition.
>>Feel free to post patches to take care of your use case.
>>
>>HTH,
>>
>> Maciej
>
>Thank you for your comments. Sorry that I cannot create a patch, as I know very little about MIPS.
>
>I raised these MIPS issues (including the recent DT_MIPS_XHASH
>https://sourceware.org/ml/binutils/2020-01/msg00451.html) not because I
>have anything to do with MIPS. I started the threads from the viewpoint
>of a toolchain maintainer.
>
>I noticed MIPS introduced complexity in a number of areas,
>where other architectures can share a simple common implementation.
>(It is weird that .quad foo - . is not representable on MIPS64.)
>
>For my own selfish purposes, I will be sad if someone wants to add some
>peculiar MIPS features (e.g. DT_MIPS_XHASH) to LLVM binary utilities or
>lld. I hope we can get rid of things like
>https://reviews.llvm.org/D72228 at some point.
>
>I hope someone can implement PC64, or something similar for MIPS.
Simon Atanasyan has implemented .quad foo-. via a chain of relocation
R_MIPS_PC32/R_MIPS_64/R_MIPS_NONE in LLVM's integrated assembler
(https://reviews.llvm.org/D80390 ). This will be available in LLVM/Clang 11.0.0
I created a feature request for GNU as:
https://sourceware.org/bugzilla/show_bug.cgi?id=26222
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-07-09 5:23 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 7:19 [MIPS] Can we have R_MIPS_PC64? Fangrui Song
2020-02-05 9:00 ` Andrew Pinski
2020-02-05 9:04 ` Andrew Pinski
2020-02-05 9:10 ` Andrew Pinski
2020-02-05 9:16 ` Andrew Pinski
2020-02-08 18:40 ` Fangrui Song
2020-02-17 18:07 ` Maciej W. Rozycki
2020-02-19 4:26 ` Fangrui Song
2020-07-09 5:23 ` Fangrui Song
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).