Commit 6f95172f authored by Amy spark's avatar Amy spark 👉
Browse files

3rdparty: don't let Qt enable JIT under hardened SELinux policies

Although the official bug report [1] said it was fixed in 5.11, in
reality it was only fixed in 6.1 (with a 5.15 backport) [2].

[1]: https://bugreports.qt.io/browse/QTBUG-58508

[2]: https://codereview.qt-project.org/c/qt/qtdeclarative/+/329522

BUG: 459490
(cherry picked from commit fca57a28c902218fb5b950d655bc0c473e0b2bce)
parent c4fe5ccb
Pipeline #235998 passed with stage
in 48 minutes and 2 seconds
From 2065bb01e9a3235d89834d02ff52f703640aa4e4 Mon Sep 17 00:00:00 2001
From: Samuli Piippo <samuli.piippo@qt.io>
Date: Thu, 7 Mar 2019 15:02:52 +0200
Subject: [PATCH 135/139] Use lowercase name for window header
Compilation otherwise fails when cross-compiling on linux,
since the filename is is lowercased.
Change-Id: I0b25f814543b677802cd6f07dc91964547a6028a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
(cherry picked from commit 587d789fa5929f462b5744ba33a25db6c77b36fc)
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
src/qml/jsruntime/qv4functiontable_win64.cpp | 2 +-
tests/auto/qml/qv4assembler/tst_qv4assembler.cpp | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/qml/jsruntime/qv4functiontable_win64.cpp b/src/qml/jsruntime/qv4functiontable_win64.cpp
index bc5b24f6..fc13dc26 100644
--- a/src/qml/jsruntime/qv4functiontable_win64.cpp
+++ b/src/qml/jsruntime/qv4functiontable_win64.cpp
@@ -43,7 +43,7 @@
#include <QtCore/qdebug.h>
-#include <Windows.h>
+#include <windows.h>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
index 61a3e778..fd50ff50 100644
--- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
+++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp
@@ -37,7 +37,7 @@
#include <private/qv4global_p.h>
#ifdef Q_OS_WIN
-#include <Windows.h>
+#include <windows.h>
#endif
class tst_QV4Assembler : public QQmlDataTest
--
2.37.3
From 017bed2aab7f4d48984a21b5ab927ab999bf005b Mon Sep 17 00:00:00 2001
From: Ulf Hermann <ulf.hermann@qt.io>
Date: Wed, 16 Dec 2020 16:45:36 +0100
Subject: [PATCH 136/139] JIT: When making memory writable, include the
exception handler
makeWritable() rounds the memory down to the next page boundary. Usually
we include the exception handler this way, unless the offset from the
page boundary is less than the exception handler size. Make it explicit
that we do want the exception handler to be writable, too.
Fixes: QTBUG-89513
Change-Id: I2fb8fb0e1dcc3450b036924463dc1b40d2020c46
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 86a595b126bc6794380dc00af80ec4802f7d058c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 35614462443c100b6753b335b58a134fed4b5c35)
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
src/3rdparty/masm/assembler/AssemblerBuffer.h | 4 ++--
src/3rdparty/masm/assembler/LinkBuffer.h | 9 +++++----
.../masm/assembler/MacroAssemblerCodeRef.h | 6 +++---
src/3rdparty/masm/stubs/ExecutableAllocator.h | 11 ++++++++---
src/qml/jsruntime/qv4executableallocator.cpp | 14 ++++++++++++--
src/qml/jsruntime/qv4executableallocator_p.h | 10 ++++++++--
src/qml/jsruntime/qv4functiontable_win64.cpp | 4 ++--
7 files changed, 40 insertions(+), 18 deletions(-)
diff --git a/src/3rdparty/masm/assembler/AssemblerBuffer.h b/src/3rdparty/masm/assembler/AssemblerBuffer.h
index 45874235..2292a4c2 100644
--- a/src/3rdparty/masm/assembler/AssemblerBuffer.h
+++ b/src/3rdparty/masm/assembler/AssemblerBuffer.h
@@ -140,9 +140,9 @@ namespace JSC {
if (!result)
return 0;
- ExecutableAllocator::makeWritable(result->start(), result->sizeInBytes());
+ ExecutableAllocator::makeWritable(result->memoryStart(), result->memorySize());
- memcpy(result->start(), m_buffer, m_index);
+ memcpy(result->codeStart(), m_buffer, m_index);
return result.release();
}
diff --git a/src/3rdparty/masm/assembler/LinkBuffer.h b/src/3rdparty/masm/assembler/LinkBuffer.h
index a1bb046d..aef35662 100644
--- a/src/3rdparty/masm/assembler/LinkBuffer.h
+++ b/src/3rdparty/masm/assembler/LinkBuffer.h
@@ -338,7 +338,7 @@ inline void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::linkCode
m_executableMemory = m_assembler->m_assembler.executableCopy(*m_globalData, ownerUID, effort);
if (!m_executableMemory)
return;
- m_code = m_executableMemory->start();
+ m_code = m_executableMemory->codeStart();
m_size = m_assembler->m_assembler.codeSize();
ASSERT(m_code);
}
@@ -360,7 +360,8 @@ void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::performFinaliza
template <typename MacroAssembler, template <typename T> class ExecutableOffsetCalculator>
inline void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::makeExecutable()
{
- ExecutableAllocator::makeExecutable(code(), static_cast<int>(m_size));
+ ExecutableAllocator::makeExecutable(m_executableMemory->memoryStart(),
+ m_executableMemory->memorySize());
}
template <typename MacroAssembler>
@@ -447,9 +448,9 @@ inline void BranchCompactingLinkBuffer<MacroAssembler>::linkCode(void* ownerUID,
m_executableMemory = m_globalData->executableAllocator.allocate(*m_globalData, m_initialSize, ownerUID, effort);
if (!m_executableMemory)
return;
- m_code = (uint8_t*)m_executableMemory->start();
+ m_code = (uint8_t*)m_executableMemory->codeStart();
ASSERT(m_code);
- ExecutableAllocator::makeWritable(m_code, m_initialSize);
+ ExecutableAllocator::makeWritable(m_executableMemory->memoryStart(), m_executableMemory->memorySize());
uint8_t* inData = (uint8_t*)m_assembler->unlinkedCode();
uint8_t* outData = reinterpret_cast<uint8_t*>(m_code);
int readPtr = 0;
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h b/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
index a7e78ad7..cde97511 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerCodeRef.h
@@ -357,11 +357,11 @@ public:
}
MacroAssemblerCodeRef(PassRefPtr<ExecutableMemoryHandle> executableMemory)
- : m_codePtr(executableMemory->start())
+ : m_codePtr(executableMemory->codeStart())
, m_executableMemory(executableMemory)
{
ASSERT(m_executableMemory->isManaged());
- ASSERT(m_executableMemory->start());
+ ASSERT(m_executableMemory->codeStart());
ASSERT(m_codePtr);
}
@@ -395,7 +395,7 @@ public:
{
if (!m_executableMemory)
return 0;
- return m_executableMemory->sizeInBytes();
+ return m_executableMemory->codeSize();
}
bool tryToDisassemble(const char* prefix) const
diff --git a/src/3rdparty/masm/stubs/ExecutableAllocator.h b/src/3rdparty/masm/stubs/ExecutableAllocator.h
index a439c538..f9847040 100644
--- a/src/3rdparty/masm/stubs/ExecutableAllocator.h
+++ b/src/3rdparty/masm/stubs/ExecutableAllocator.h
@@ -82,9 +82,14 @@ struct ExecutableMemoryHandle : public RefCounted<ExecutableMemoryHandle> {
inline bool isManaged() const { return true; }
- void *exceptionHandler() { return m_allocation->exceptionHandler(); }
- void *start() { return m_allocation->start(); }
- size_t sizeInBytes() { return m_size; }
+ void *memoryStart() { return m_allocation->memoryStart(); }
+ size_t memorySize() { return m_allocation->memorySize(); }
+
+ void *exceptionHandlerStart() { return m_allocation->exceptionHandlerStart(); }
+ size_t exceptionHandlerSize() { return m_allocation->exceptionHandlerSize(); }
+
+ void *codeStart() { return m_allocation->codeStart(); }
+ size_t codeSize() { return m_size; }
QV4::ExecutableAllocator::ChunkOfPages *chunk() const
{ return m_allocator->chunkForAllocation(m_allocation); }
diff --git a/src/qml/jsruntime/qv4executableallocator.cpp b/src/qml/jsruntime/qv4executableallocator.cpp
index c836d121..8d7206e7 100644
--- a/src/qml/jsruntime/qv4executableallocator.cpp
+++ b/src/qml/jsruntime/qv4executableallocator.cpp
@@ -45,12 +45,22 @@
using namespace QV4;
-void *ExecutableAllocator::Allocation::exceptionHandler() const
+void *ExecutableAllocator::Allocation::exceptionHandlerStart() const
{
return reinterpret_cast<void*>(addr);
}
-void *ExecutableAllocator::Allocation::start() const
+size_t ExecutableAllocator::Allocation::exceptionHandlerSize() const
+{
+ return QV4::exceptionHandlerSize();
+}
+
+void *ExecutableAllocator::Allocation::memoryStart() const
+{
+ return reinterpret_cast<void*>(addr);
+}
+
+void *ExecutableAllocator::Allocation::codeStart() const
{
return reinterpret_cast<void*>(addr + exceptionHandlerSize());
}
diff --git a/src/qml/jsruntime/qv4executableallocator_p.h b/src/qml/jsruntime/qv4executableallocator_p.h
index 013c6d71..5c1f5101 100644
--- a/src/qml/jsruntime/qv4executableallocator_p.h
+++ b/src/qml/jsruntime/qv4executableallocator_p.h
@@ -86,8 +86,14 @@ public:
, free(true)
{}
- void *exceptionHandler() const;
- void *start() const;
+ void *memoryStart() const;
+ size_t memorySize() const { return size; }
+
+ void *exceptionHandlerStart() const;
+ size_t exceptionHandlerSize() const;
+
+ void *codeStart() const;
+
void invalidate() { addr = 0; }
bool isValid() const { return addr != 0; }
void deallocate(ExecutableAllocator *allocator);
diff --git a/src/qml/jsruntime/qv4functiontable_win64.cpp b/src/qml/jsruntime/qv4functiontable_win64.cpp
index fc13dc26..0cb98641 100644
--- a/src/qml/jsruntime/qv4functiontable_win64.cpp
+++ b/src/qml/jsruntime/qv4functiontable_win64.cpp
@@ -106,7 +106,7 @@ struct ExceptionHandlerRecord
void generateFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
{
ExceptionHandlerRecord *record = reinterpret_cast<ExceptionHandlerRecord *>(
- codeRef->executableMemory()->exceptionHandler());
+ codeRef->executableMemory()->exceptionHandlerStart());
record->info.Version = 1;
record->info.Flags = 0;
@@ -136,7 +136,7 @@ void generateFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
void destroyFunctionTable(Function *, JSC::MacroAssemblerCodeRef *codeRef)
{
ExceptionHandlerRecord *record = reinterpret_cast<ExceptionHandlerRecord *>(
- codeRef->executableMemory()->exceptionHandler());
+ codeRef->executableMemory()->exceptionHandlerStart());
if (!RtlDeleteFunctionTable(&record->handler)) {
const unsigned int errorCode = GetLastError();
qWarning() << "Failed to remove win64 unwind hook. Error code:" << errorCode;
--
2.37.3
From 4b7586b88b7bb611f72c0a1cfca9b2c257da84a2 Mon Sep 17 00:00:00 2001
From: Ulf Hermann <ulf.hermann@qt.io>
Date: Mon, 11 Jan 2021 11:33:26 +0100
Subject: [PATCH 137/139] masm: Add error handling for failed mprotect()
If we cannot mprotect() we have to abort the JIT compilation. Delete
RepatchBuffer.h as it is unfixable in that regard. Luckily we don't use
it.
Task-number: QTBUG-89659
Change-Id: Ic5ddbdf51b471db4ddeaa75aab48b24c1f7ced56
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
(cherry picked from commit 131e2c81d40e3d324c62e113749a08e7993d008f)
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit ab15d9a547dbd83bec99366e7f7b0449fdcdb6ef)
Signed-off-by: L. E. Segovia <amy@amyspark.me>
---
.../masm/assembler/AbstractMacroAssembler.h | 2 -
src/3rdparty/masm/assembler/AssemblerBuffer.h | 3 +-
src/3rdparty/masm/assembler/LinkBuffer.h | 19 +-
.../masm/assembler/MacroAssemblerARMv7.h | 1 -
.../masm/assembler/MacroAssemblerMIPS.h | 1 -
.../masm/assembler/MacroAssemblerX86.h | 1 -
.../masm/assembler/MacroAssemblerX86_64.h | 1 -
src/3rdparty/masm/assembler/RepatchBuffer.h | 181 ------------------
src/3rdparty/masm/stubs/ExecutableAllocator.h | 14 +-
src/3rdparty/masm/yarr/YarrJIT.cpp | 3 +-
src/qml/jit/qv4assemblercommon.cpp | 3 +-
src/qml/jsruntime/qv4vme_moth.cpp | 5 +-
12 files changed, 29 insertions(+), 205 deletions(-)
delete mode 100644 src/3rdparty/masm/assembler/RepatchBuffer.h
diff --git a/src/3rdparty/masm/assembler/AbstractMacroAssembler.h b/src/3rdparty/masm/assembler/AbstractMacroAssembler.h
index d0c1c461..9bafa243 100644
--- a/src/3rdparty/masm/assembler/AbstractMacroAssembler.h
+++ b/src/3rdparty/masm/assembler/AbstractMacroAssembler.h
@@ -51,7 +51,6 @@ template <typename, template <typename> class>
class LinkBufferBase;
template <typename>
class BranchCompactingLinkBuffer;
-class RepatchBuffer;
class Watchpoint;
namespace DFG {
struct OSRExit;
@@ -831,7 +830,6 @@ protected:
template <typename, template <typename> class> friend class LinkBufferBase;
template <typename> friend class BranchCompactingLinkBuffer;
- friend class RepatchBuffer;
static void linkJump(void* code, Jump jump, CodeLocationLabel target)
{
diff --git a/src/3rdparty/masm/assembler/AssemblerBuffer.h b/src/3rdparty/masm/assembler/AssemblerBuffer.h
index 2292a4c2..58ecac2a 100644
--- a/src/3rdparty/masm/assembler/AssemblerBuffer.h
+++ b/src/3rdparty/masm/assembler/AssemblerBuffer.h
@@ -140,7 +140,8 @@ namespace JSC {
if (!result)
return 0;
- ExecutableAllocator::makeWritable(result->memoryStart(), result->memorySize());
+ if (Q_UNLIKELY(!ExecutableAllocator::makeWritable(result->memoryStart(), result->memorySize())))
+ return 0;
memcpy(result->codeStart(), m_buffer, m_index);
diff --git a/src/3rdparty/masm/assembler/LinkBuffer.h b/src/3rdparty/masm/assembler/LinkBuffer.h
index aef35662..d9b5959f 100644
--- a/src/3rdparty/masm/assembler/LinkBuffer.h
+++ b/src/3rdparty/masm/assembler/LinkBuffer.h
@@ -228,7 +228,7 @@ public:
return m_size;
}
- inline void makeExecutable();
+ inline bool makeExecutable();
private:
template <typename T> T applyOffset(T src)
@@ -358,10 +358,10 @@ void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::performFinaliza
}
template <typename MacroAssembler, template <typename T> class ExecutableOffsetCalculator>
-inline void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::makeExecutable()
+inline bool LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::makeExecutable()
{
- ExecutableAllocator::makeExecutable(m_executableMemory->memoryStart(),
- m_executableMemory->memorySize());
+ return ExecutableAllocator::makeExecutable(m_executableMemory->memoryStart(),
+ m_executableMemory->memorySize());
}
template <typename MacroAssembler>
@@ -397,7 +397,7 @@ public:
}
virtual void performFinalization() override final;
- inline void makeExecutable();
+ inline bool makeExecutable();
inline void linkCode(void* ownerUID, JITCompilationEffort);
@@ -433,9 +433,9 @@ void BranchCompactingLinkBuffer<MacroAssembler>::performFinalization()
}
template <typename MacroAssembler>
-inline void BranchCompactingLinkBuffer<MacroAssembler>::makeExecutable()
+inline bool BranchCompactingLinkBuffer<MacroAssembler>::makeExecutable()
{
- ExecutableAllocator::makeExecutable(code(), m_initialSize);
+ return ExecutableAllocator::makeExecutable(code(), m_initialSize);
}
template <typename MacroAssembler>
@@ -448,9 +448,12 @@ inline void BranchCompactingLinkBuffer<MacroAssembler>::linkCode(void* ownerUID,
m_executableMemory = m_globalData->executableAllocator.allocate(*m_globalData, m_initialSize, ownerUID, effort);
if (!m_executableMemory)
return;
+ if (Q_UNLIKELY(!ExecutableAllocator::makeWritable(m_executableMemory->memoryStart(), m_executableMemory->memorySize()))) {
+ m_executableMemory = {};
+ return;
+ }
m_code = (uint8_t*)m_executableMemory->codeStart();
ASSERT(m_code);
- ExecutableAllocator::makeWritable(m_executableMemory->memoryStart(), m_executableMemory->memorySize());
uint8_t* inData = (uint8_t*)m_assembler->unlinkedCode();
uint8_t* outData = reinterpret_cast<uint8_t*>(m_code);
int readPtr = 0;
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
index 99801a0e..dd66eefb 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerARMv7.h
@@ -2022,7 +2022,6 @@ protected:
private:
template <typename, template <typename> class> friend class LinkBufferBase;
- friend class RepatchBuffer;
#if !defined(V4_BOOTSTRAP)
static void linkCall(void* code, Call call, FunctionPtr function)
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h b/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
index 07f0ec62..6dfc1048 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerMIPS.h
@@ -2818,7 +2818,6 @@ private:
bool m_fixedWidth;
template <typename, template <typename> class> friend class LinkBufferBase;
- friend class RepatchBuffer;
static void linkCall(void* code, Call call, FunctionPtr function)
{
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerX86.h b/src/3rdparty/masm/assembler/MacroAssemblerX86.h
index e3e0bfe5..bf5deeb1 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerX86.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerX86.h
@@ -345,7 +345,6 @@ public:
private:
template <typename, template <typename> class> friend class LinkBufferBase;
- friend class RepatchBuffer;
static void linkCall(void* code, Call call, FunctionPtr function)
{
diff --git a/src/3rdparty/masm/assembler/MacroAssemblerX86_64.h b/src/3rdparty/masm/assembler/MacroAssemblerX86_64.h
index f4349e1f..c419bcd7 100644
--- a/src/3rdparty/masm/assembler/MacroAssemblerX86_64.h
+++ b/src/3rdparty/masm/assembler/MacroAssemblerX86_64.h
@@ -743,7 +743,6 @@ public:
private:
template <typename, template <typename> class> friend class LinkBufferBase;
- friend class RepatchBuffer;
static void linkCall(void* code, Call call, FunctionPtr function)
{
diff --git a/src/3rdparty/masm/assembler/RepatchBuffer.h b/src/3rdparty/masm/assembler/RepatchBuffer.h
deleted file mode 100644
index dbb56f9a..00000000
--- a/src/3rdparty/masm/assembler/RepatchBuffer.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef RepatchBuffer_h
-#define RepatchBuffer_h
-
-#if ENABLE(JIT)
-
-#include "CodeBlock.h"
-#include <MacroAssembler.h>
-#include <wtf/Noncopyable.h>
-
-namespace JSC {
-
-// RepatchBuffer:
-//
-// This class is used to modify code after code generation has been completed,
-// and after the code has potentially already been executed. This mechanism is
-// used to apply optimizations to the code.
-//
-class RepatchBuffer {
- typedef MacroAssemblerCodePtr CodePtr;
-
-public:
- RepatchBuffer(CodeBlock* codeBlock)
- {
- JITCode& code = codeBlock->getJITCode();
- m_start = code.start();
- m_size = code.size();
-
- ExecutableAllocator::makeWritable(m_start, m_size);
- }
-
- ~RepatchBuffer()
- {
- ExecutableAllocator::makeExecutable(m_start, m_size);
- }
-
- void relink(CodeLocationJump jump, CodeLocationLabel destination)
- {
- MacroAssembler::repatchJump(jump, destination);
- }
-
- void relink(CodeLocationCall call, CodeLocationLabel destination)
- {
- MacroAssembler::repatchCall(call, destination);
- }
-
- void relink(CodeLocationCall call, FunctionPtr destination)
- {
- MacroAssembler::repatchCall(call, destination);
- }
-
- void relink(CodeLocationNearCall nearCall, CodePtr destination)
- {
- MacroAssembler::repatchNearCall(nearCall, CodeLocationLabel(destination));
- }
-
- void relink(CodeLocationNearCall nearCall, CodeLocationLabel destination)
- {
- MacroAssembler::repatchNearCall(nearCall, destination);
- }
-
- void repatch(CodeLocationDataLabel32 dataLabel32, int32_t value)
- {
- MacroAssembler::repatchInt32(dataLabel32, value);
- }
-
- void repatch(CodeLocationDataLabelCompact dataLabelCompact, int32_t value)
- {
- MacroAssembler::repatchCompact(dataLabelCompact, value);
- }
-
- void repatch(CodeLocationDataLabelPtr dataLabelPtr, void* value)
- {
- MacroAssembler::repatchPointer(dataLabelPtr, value);
- }
-
- void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
- {
- relink(CodeLocationCall(CodePtr(returnAddress)), label);
- }
-
- void relinkCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
- {
- relinkCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
- }
-
- void relinkCallerToFunction(ReturnAddressPtr returnAddress, FunctionPtr function)
- {
- relink(CodeLocationCall(CodePtr(returnAddress)), function);
- }
-
- void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodeLocationLabel label)
- {
- relink(CodeLocationNearCall(CodePtr(returnAddress)), label);
- }
-
- void relinkNearCallerToTrampoline(ReturnAddressPtr returnAddress, CodePtr newCalleeFunction)
- {
- relinkNearCallerToTrampoline(returnAddress, CodeLocationLabel(newCalleeFunction));
- }
-
- void replaceWithLoad(CodeLocationConvertibleLoad label)
- {
- MacroAssembler::replaceWithLoad(label);
- }
-
- void replaceWithAddressComputation(CodeLocationConvertibleLoad label)
- {
- MacroAssembler::replaceWithAddressComputation(label);
- }
-
- void setLoadInstructionIsActive(CodeLocationConvertibleLoad label, bool isActive)
- {
- if (isActive)
- replaceWithLoad(label);
- else
- replaceWithAddressComputation(label);
- }
-
- static CodeLocationLabel startOfBranchPtrWithPatchOnRegister(CodeLocationDataLabelPtr label)
- {
- return MacroAssembler::startOfBranchPtrWithPatchOnRegister(label);
- }
-
- static CodeLocationLabel startOfPatchableBranchPtrWithPatchOnAddress(CodeLocationDataLabelPtr label)
- {
- return MacroAssembler::startOfPatchableBranchPtrWithPatchOnAddress(label);
- }
-
- void replaceWithJump(CodeLocationLabel instructionStart, CodeLocationLabel destination)
- {
- MacroAssembler::replaceWithJump(instructionStart, destination);
- }
-
- // This is a *bit* of a silly API, since we currently always also repatch the
- // immediate after calling this. But I'm fine with that, since this just feels
- // less yucky.
- void revertJumpReplacementToBranchPtrWithPatch(CodeLocationLabel instructionStart, MacroAssembler::RegisterID reg, void* value)
- {
- MacroAssembler::revertJumpReplacementToBranchPtrWithPatch(instructionStart, reg, value);
- }
-
- void revertJumpReplacementToPatchableBranchPtrWithPatch(CodeLocationLabel instructionStart, MacroAssembler::Address address, void* value)
- {