[llvm-dev] Broken relocation for generating offsets?
via llvm-dev
llvm-dev at lists.llvm.org
Thu Mar 22 23:51:51 PDT 2018
In my case I wouldn't exceed the 2GB module address range...
As I understood - but I'm still a cub with the LLVM and everything - the
"OFFSET" thingy should calculate the offset from the instruction to the
address of the symbol. But LLVM creates a jump to that symbol.
From: Reid Kleckner <rnk at google.com>
To: bjoern.gaier at horiba.com, Lang Hames <lhames at gmail.com>
Cc: llvm-dev <llvm-dev at lists.llvm.org>
Date: 22.03.2018 18:43
Subject: Re: [llvm-dev] Broken relocation for generating offsets?
I wouldn't be surprised if JITing COFF files on Windows doesn't work so
well, since the object file format assumes most symbols are dllimport or
within the local 2GB module address range.
I'm not familiar with the current JIT state of the art, though.
On Thu, Mar 22, 2018 at 1:45 AM via llvm-dev <llvm-dev at lists.llvm.org>
wrote:
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.
_______________________________________________
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180323/0739bc5f/attachment.html>
More information about the llvm-dev
mailing list