1
From e42e6a8d432270a5393f7451f63074af0811dddf Mon Sep 17 00:00:00 2001
2
From: Erik Verbruggen <erik.verbruggen@digia.com>
3
Date: Mon, 27 Jan 2014 13:00:20 +0100
4
Subject: [PATCH] V4 JIT: save/restore ebx (GOT ptr) on linux/x86.
6
On linux/x86, ebx is used to store the global offset table. When using
7
this register for temporary values, we have to save it at the entry of
8
a generated function, and restore it before doing calls and at the end.
10
Task-number: QTBUG-36289
11
Change-Id: I30194be3ce44f58b793ee52f6201906bcb68d46a
13
src/qml/compiler/qv4isel_masm.cpp | 2 +-
14
src/qml/compiler/qv4isel_masm_p.h | 4 ++++
15
2 files changed, 5 insertions(+), 1 deletion(-)
17
diff --git a/src/qml/compiler/qv4isel_masm.cpp b/src/qml/compiler/qv4isel_masm.cpp
18
index 0cfb684..0fcd770 100644
19
--- a/src/qml/compiler/qv4isel_masm.cpp
20
+++ b/src/qml/compiler/qv4isel_masm.cpp
21
@@ -122,7 +122,7 @@ static const Assembler::RegisterID calleeSavedRegisters[] = {
24
static const Assembler::RegisterID calleeSavedRegisters[] = {
25
- // Not used: JSC::X86Registers::ebx,
26
+ JSC::X86Registers::ebx, // temporary register
27
JSC::X86Registers::esi, // ContextRegister
28
JSC::X86Registers::edi // LocalsRegister
30
diff --git a/src/qml/compiler/qv4isel_masm_p.h b/src/qml/compiler/qv4isel_masm_p.h
31
index a146220..7dfe6a8 100644
32
--- a/src/qml/compiler/qv4isel_masm_p.h
33
+++ b/src/qml/compiler/qv4isel_masm_p.h
34
@@ -981,6 +981,10 @@ public:
35
prepareRelativeCall(function, this);
36
loadArgumentOnStackOrRegister<0>(arg1);
38
+#if OS(LINUX) && CPU(X86) && (defined(__PIC__) || defined(__PIE__))
39
+ load32(Address(StackFrameRegister, -sizeof(void*)), JSC::X86Registers::ebx); // restore the GOT ptr
42
callAbsolute(functionName, function);