* Gas: Any pseudo instruction to disable a single RELOC?
@ 2024-01-12 10:08 YunQiang Su
2024-01-12 10:17 ` Jan Beulich
0 siblings, 1 reply; 5+ messages in thread
From: YunQiang Su @ 2024-01-12 10:08 UTC (permalink / raw)
To: binutils
Is there a way to disable generating RELOC for a single instruction?
One example is
.set noreorder
xx:
.reloc 0,R_MIPS_NONE,0 # append a new reloc.
bal 4
nop
sll $2,$2,0
sll $2,$2,0
In this example, I wish `bal 4` would be keeped as is.
Is there a way to disable generating any RELOC?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gas: Any pseudo instruction to disable a single RELOC?
2024-01-12 10:08 Gas: Any pseudo instruction to disable a single RELOC? YunQiang Su
@ 2024-01-12 10:17 ` Jan Beulich
2024-01-12 14:41 ` YunQiang Su
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2024-01-12 10:17 UTC (permalink / raw)
To: YunQiang Su; +Cc: binutils
On 12.01.2024 11:08, YunQiang Su wrote:
> Is there a way to disable generating RELOC for a single instruction?
> One example is
>
> .set noreorder
> xx:
> .reloc 0,R_MIPS_NONE,0 # append a new reloc.
> bal 4
> nop
> sll $2,$2,0
> sll $2,$2,0
>
>
> In this example, I wish `bal 4` would be keeped as is.
> Is there a way to disable generating any RELOC?
I don't think there is, and I don't think there should be. People using
.reloc absolutely need to know what they are doing.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gas: Any pseudo instruction to disable a single RELOC?
2024-01-12 10:17 ` Jan Beulich
@ 2024-01-12 14:41 ` YunQiang Su
2024-01-12 15:43 ` Xi Ruoyao
0 siblings, 1 reply; 5+ messages in thread
From: YunQiang Su @ 2024-01-12 14:41 UTC (permalink / raw)
To: Jan Beulich; +Cc: binutils
> I don't think there is, and I don't think there should be. People using
> .reloc absolutely need to know what they are doing.
>
Thank you, I find a solution.
BAL . + 4
won't emit any relocs.
Background:
MIPS pre-R6 has no instructions that can read PC directly, thus we
have to use an branch and link instruction to do so.
I am working on GCC to support it. I don' want to emit an label for this
simple branch.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gas: Any pseudo instruction to disable a single RELOC?
2024-01-12 14:41 ` YunQiang Su
@ 2024-01-12 15:43 ` Xi Ruoyao
2024-01-12 16:00 ` YunQiang Su
0 siblings, 1 reply; 5+ messages in thread
From: Xi Ruoyao @ 2024-01-12 15:43 UTC (permalink / raw)
To: YunQiang Su, Jan Beulich; +Cc: binutils
在 2024-01-12星期五的 22:41 +0800,YunQiang Su写道:
> > I don't think there is, and I don't think there should be. People using
> > .reloc absolutely need to know what they are doing.
> >
>
> Thank you, I find a solution.
> BAL . + 4
> won't emit any relocs.
>
> Background:
> MIPS pre-R6 has no instructions that can read PC directly, thus we
> have to use an branch and link instruction to do so.
For this purpose GAS already supports the nal alias for bltzal $r0, 0.
> I am working on GCC to support it. I don' want to emit an label for this
> simple branch.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Gas: Any pseudo instruction to disable a single RELOC?
2024-01-12 15:43 ` Xi Ruoyao
@ 2024-01-12 16:00 ` YunQiang Su
0 siblings, 0 replies; 5+ messages in thread
From: YunQiang Su @ 2024-01-12 16:00 UTC (permalink / raw)
To: Xi Ruoyao; +Cc: Jan Beulich, binutils
[-- Attachment #1: Type: text/plain, Size: 305 bytes --]
>
> For this purpose GAS already supports the nal alias for bltzal $r0, 0.
>
Yes. I tried it first, and the performance of it is soooo bad.
The attached test case on Loongson 3A:
classic-MIPS-PIC NAL-PIC BAL-PIC
1.5s 18s (eighteen) 5s
[-- Attachment #2: xx.c --]
[-- Type: application/octet-stream, Size: 934 bytes --]
#include <stdio.h>
volatile int g1 = 1;
volatile int g2 = 2;
volatile int g3 = 3;
volatile int g4 = 4;
volatile int g5 = 5;
volatile int g6 = 6;
volatile int g7 = 7;
volatile int g8 = 8;
volatile int g9 = 9;
volatile int g10 = 10;
volatile int g11 = 11;
volatile int g12 = 12;
volatile int g13 = 13;
volatile int g14 = 14;
volatile int g15 = 15;
volatile int g16 = 16;
volatile int g17 = 17;
volatile int g18 = 18;
volatile int g19 = 19;
volatile int g20 = 20;
volatile int g21 = 21;
volatile int g22 = 22;
volatile int g23 = 23;
volatile int g24 = 24;
__attribute__ ((noinline))
volatile int f () {
return g1 + g2 + g3 + g4 + g5 + g6 + g7 + g8 +
g9 + g10 + g11 + g12 + g13 + g14 + g15 + g16 +
g17 + g18 + g19 + g20 + g21 + g22 + g23 + g24;
}
int main () {
int x;
for (int i = 0; i< 1e8; i++) {
x += f ();
}
printf ("%d\n", x);
return x;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-01-12 16:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-12 10:08 Gas: Any pseudo instruction to disable a single RELOC? YunQiang Su
2024-01-12 10:17 ` Jan Beulich
2024-01-12 14:41 ` YunQiang Su
2024-01-12 15:43 ` Xi Ruoyao
2024-01-12 16:00 ` YunQiang Su
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).