<font size=2 face="sans-serif">Hello,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
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:</font><font size=3>
</font>
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=100% style="border-style:solid solid solid solid;border-color:#000000;border-width:1px 1px 1px 1px;padding:1px 1px;"><font size=2 face="sans-serif">mov
        edx, DWORD PTR ?normalPlanschbecken@@3HA ;
normalPlanschbecken</font><font size=3> </font><font size=2 face="sans-serif"><br>
lea         rcx, <b><u>OFFSET FLAT</u></b>:??_C@_0CC@LCMJAIPO@Reading?5?$CCnormalPlanschbecken?$CC?5?$CFi@</font><font size=3>
</font><font size=2 face="sans-serif"><br>
jmp         printf</font></table>
<br><font size=3><br>
<br>
<br>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
From:        </font><font size=1 face="sans-serif">via
llvm-dev <llvm-dev@lists.llvm.org></font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
To:        </font><font size=1 face="sans-serif">llvm-dev@lists.llvm.org</font><font size=3>
</font><font size=1 color=#5f5f5f face="sans-serif"><br>
Date:        </font><font size=1 face="sans-serif">06.03.2018
10:45</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Subject:        </font><font size=1 face="sans-serif">[llvm-dev]
Broken relocation for generating offsets?</font><font size=3> </font><font size=1 color=#5f5f5f face="sans-serif"><br>
Sent by:        </font><font size=1 face="sans-serif">"llvm-dev"
<llvm-dev-bounces@lists.llvm.org></font><font size=3> <br>
</font>
<hr noshade><font size=3><br>
<br>
</font><font size=2 face="sans-serif"><br>
Hello LLVM-Mailing-List,</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
I discovered a strange behavior when dealing with object files generated
by the compiler of Visual Studio 2015.</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
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.</font><font size=3> </font>
<table width=100% style="border-collapse:collapse;">
<tr valign=top height=8>
<td width=100% style="border-style:solid solid solid solid;border-color:#000000;border-width:1px 1px 1px 1px;padding:1px 1px;"><font size=2 face="sans-serif">mov
        eax, DWORD PTR ?myInt@@3HA ; myInt</font><font size=3>
</font><font size=2 face="sans-serif"><br>
lea         rdi,<b><u> OFFSET FLAT</u></b>:__ImageBase</font><font size=3>
</font><font size=2 face="sans-serif"><br>
xor         ebx, ebx</font></table>
<br><font size=3><br>
</font><font size=2 face="sans-serif"><br>
<br>
Then these offset is used to jump to some labels like "$LL4@execute:".</font><font size=3>
</font><font size=2 face="sans-serif"><br>
<br>
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?</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
Kind regards</font><font size=3> </font><font size=2 face="sans-serif"><br>
Björn</font><font size=3> </font><font size=2 face="sans-serif"><br>
<br>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr.
DE 114 165 789<br>
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko
Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.</font><tt><font size=2><br>
_______________________________________________<br>
LLVM Developers mailing list<br>
llvm-dev@lists.llvm.org</font></tt><font size=3 color=blue><u><br>
</u></font><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev"><tt><font size=2 color=blue><u>http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</u></font></tt></a><font size=3><br>
<br>
</font><font size=2 face="sans-serif"><br>
<br>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr.
DE 114 165 789<br>
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko
Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.<br>
</font>
<br>
<br><font size=2 face="sans-serif"><br>
Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, USt.ID-Nr.
DE 114 165 789<br>
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, Heiko
Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.<br>
<br>
</font>