[llvm-dev] Broken relocation for generating offsets?

via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 6 01:44:49 PST 2018


Hello LLVM-Mailing-List,

I discovered a strange behavior when dealing with object files generated 
by the compiler of Visual Studio 2015.

When jitting bc files I also add object files to look up functions. These 
object files are coming from visual studio. When using a switch case 
instruction that compiler often generates code based of __ImageBase. I 
show you a short snippet of the assembly output.

mov      eax, DWORD PTR ?myInt@@3HA ; myInt
lea      rdi, OFFSET FLAT:__ImageBase
xor      ebx, ebx

Then these offset is used to jump to some labels like "$LL4 at execute:".

When the object file gets added to the jitting process this offset 
generation seems to be broken. Executing the code coming from the object 
file will lead to a crash. The crash address will always be exactly the 
address I used to overload __ImageBase with. So it seems that the address 
relocation is wrong with generating offsets?

Kind regards
Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, 
USt.ID-Nr. DE 114 165 789
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, 
Heiko Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180306/e469dc3f/attachment.html>


More information about the llvm-dev mailing list