[llvm-dev] Broken relocation for generating offsets?

via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 22 01:45:08 PDT 2018


Hello, 

I append another clue I found out: The problem is definitely not caused by 
"__ImageBase" the problem comes with the "OFFSET". I generated another 
object file which crashed. The commonality: 
mov         edx, DWORD PTR ?normalPlanschbecken@@3HA ; normalPlanschbecken 

lea         rcx, OFFSET FLAT
:??_C at _0CC@LCMJAIPO at Reading?5?$CCnormalPlanschbecken?$CC?5?$CFi@ 
jmp         printf




From:        via llvm-dev <llvm-dev at lists.llvm.org> 
To:        llvm-dev at lists.llvm.org 
Date:        06.03.2018 10:45 
Subject:        [llvm-dev] Broken relocation for generating offsets? 
Sent by:        "llvm-dev" <llvm-dev-bounces at lists.llvm.org> 



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.
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev



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.



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/20180322/e6a959b4/attachment-0001.html>


More information about the llvm-dev mailing list