2022-11-14 03:56:17

by Larry Finger

[permalink] [raw]
Subject: Help with YASM

Hi,

I am the openSUSE maintainer for VirtualBox. A portion of the code is written in
yasm assembler. There are two sections of the code that refer to external
globals that now need to be referenced in a position-independent manner. After
much web searching, I have not found a method that works.

The first code snippet is a jump to an external location. The original code is

jmp NAME(dtrace_probe)

Based on a reference that I found, I changed this to

jmp [rel dtrace_probe wrt ..got]

This compiles without error, but I have no idea if it would work.

The second reference to an external variable is

lea T2, [NAME(g_afParity) wrt rip]

Trying to emulate the above change, I replaced this with

lea T2, [rel NAME(g_afParity) wrt rip ..got]

This one generates a compile error that there is a missing "]".

Thanks for any help, or pointers to reference works that I can read.

Larry