[PATCH 3/5] x86: widen @got{,pcrel} support to PUSH and APX IMUL
H.J. Lu
hjl.tools@gmail.com
Tue Feb 4 12:14:59 GMT 2025
On Tue, Feb 4, 2025 at 7:16 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 04.02.2025 12:12, H.J. Lu wrote:
> > On Tue, Feb 4, 2025 at 7:02 PM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 04.02.2025 11:41, Jan Beulich wrote:
> >>> On 04.02.2025 11:17, H.J. Lu wrote:
> >>>> On Tue, Feb 4, 2025 at 6:14 PM Jan Beulich <jbeulich@suse.com> wrote:
> >>>>>
> >>>>> On 03.02.2025 23:40, H.J. Lu wrote:
> >>>>>> On Mon, Feb 3, 2025 at 7:41 PM Jan Beulich <jbeulich@suse.com> wrote:
> >>>>>>> --- /dev/null
> >>>>>>> +++ b/ld/testsuite/ld-i386/load8a.d
> >>>>>>> @@ -0,0 +1,14 @@
> >>>>>>> +#source: load8.s
> >>>>>>> +#as: --32 -mrelax-relocations=yes
> >>>>>>> +#ld: -melf_i386 -z noseparate-code
> >>>>>>> +#objdump: -dw
> >>>>>>> +
> >>>>>>> +.*: +file format .*
> >>>>>>> +
> >>>>>>> +Disassembly of section .text:
> >>>>>>> +
> >>>>>>> +0+8048074 <_start>:
> >>>>>>> +[ ]*[a-f0-9]+: 26 68 86 90 04 08 es push \$0x8049086
> >>>>>>> +[ ]*[a-f0-9]+: 26 68 87 90 04 08 es push \$0x8049087
> >>>>>>> +[ ]*[a-f0-9]+: 26 68 87 90 04 08 es push \$0x8049087
> >>>>>>
> >>>>>> Please avoid adding the es prefix. It may not be nop in the future.
> >>>>>
> >>>>> Constructive comments please. What other prefix do you suggest we use?
> >>>>> Is another of the segment overrides okay? If not, all that's left is an
> >>>>> address size override, if I'm not mistaken. Which overall seems less
> >>>>> desirable to use.
> >>>>
> >>>> You can use 1-byte NOP.
> >>>
> >>> That'll have an undue effect on debugging, by splitting a single insn
> >>> into two.
> >>>
> >>>>> Plus - is your concern only about 32-bit code, or also about 64-bit? For
> >>>>> 32-bit code in particular I'm having difficulty seeing why an ES
> >>>>> prefix might gain new meaning going forward, when an increasing number
> >>>>> of ISA extensions are for 64-bit mode only anyway. If the concern
> >>>>> extends to 64-bit code (it shouldn't, as the pre-386 segment overrides
> >>>>> are documented as nop prefixes, if I'm not mistaken), earlier changes
> >>>>> would need adjusting then, too, I think.
> >>>>
> >>>> I don't think adding instructions like PUSH is very useful.
> >>
> >> Further to my earlier reply: You didn't answer my question. Which is
> >
> > Which question?
>
> "Is your concern only about 32-bit code, or also about 64-bit?"
Both.
> >> necessary to determine whether earlier changes need adjustment.
> >>
> >>> I was actively waiting for this kind of comment. Why was adding support
> >>> for e.g. ADC and SBB useful then? Imo it can only be one of two ways:
> >>> Either we support everything that can be supported, or we limit things
> >>> strictly to cases that are actively deemed useful.
> >>
> >> Thinking of it: With TEST being special-cased in the logic involved, I'm
> >> also curious to learn of a code sequence where TEST would sensibly be
> >> used (and where CMP can't be used instead).
> >
> > Compiler may generate TEST with GOT.
>
> Can it? Why would it? (IOW: Again you didn't really address my request.)
>
[hjl@gnu-tgl-3 tmp]$ cat x.c
extern int foo __attribute__ ((weak));
extern void bar (void);
__attribute__ ((regparm(3)))
void
_start (long int p)
{
if (((unsigned long) &foo) & p)
bar ();
}
[hjl@gnu-tgl-3 tmp]$ gcc -c -O2 -m32 x.c -mno-direct-extern-access
[hjl@gnu-tgl-3 tmp]$ objdump -dwr x.o
x.o: file format elf32-i386
Disassembly of section .text:
00000000 <_start>:
0: 85 05 00 00 00 00 test %eax,0x0 2: R_386_GOT32X foo
6: 75 08 jne 10 <_start+0x10>
8: c3 ret
9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
10: e9 fc ff ff ff jmp 11 <_start+0x11> 11: R_386_PC32 bar
[hjl@gnu-tgl-3 tmp]$
Which request?
--
H.J.
More information about the Binutils
mailing list