[RFC] imgrel/imagerel operator from the clang integrated assembler and the Microsoft assembler
Julian Waters
tanksherman27@gmail.com
Wed Nov 13 04:49:33 GMT 2024
The reply from Intel mentions that it has to do with the addressing
mode, to quote:
In case of vmovupd that you show below, the addressing mode used has
base (rdx), index (rcx), and displacement
(imagerel(__jsvml_dtanh_ha_data_internal)+2624). The base/index are
registers and displacement is the constant. The displacement in this
addressing mode can only be 32bits so the 64-bit base is loaded into
rdx first.
The assembly we were talking about was this:
lea rdx, QWORD PTR [__ImageBase]
...
vmovupd xmm2, XMMWORD PTR
[imagerel(__jsvml_dtanh_ha_data_internal)+2624+rdx+rcx]
best regards,
Julian
On Tue, Nov 12, 2024 at 5:27 PM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 12.11.2024 09:24, Julian Waters wrote:
> > My mistake, I just checked and it is indeed not human written, but instead
> > was the output of the Intel C Compiler. The source code that the assembly
> > came from is proprietary and involves Intel C extensions, and so is not
> > accessible to anyone outside of Intel (Which unfortunately includes me). I
> > don't know the right people to talk to at Intel to get them to regenerate
> > the assembly for GAS targeting Windows COFF. Now that I see it, it
> > certainly is odd that imagerel is being used inside an instruction only to
> > be added to __ImageBase later on (The uses of imagerel elsewhere can be
> > replaced with .rva so aren't a concern). I'll try to ask why this is the
> > case, but no guarantees that I'll ever get a reply
>
> You may want to try asking in their ISA extensions forum [1]. No guarantees
> for an answer, but perhaps worth a try in the absence of known better
> alternatives.
>
> > To clarify about the .reloc example, I was wondering whether it relied on
> > the current location that is being assembled into. The . means the current
> > address in the assembler, no? If it does, then the offset that should
> > be subtracted from . as in the example may differ depending on the
> > instruction
>
> Of course. As said, quite a bit of care is needed when using .reloc.
>
> Jan
>
> [1] https://community.intel.com/t5/Intel-ISA-Extensions/bd-p/isa-extensions
>
More information about the Binutils
mailing list