7af5077dec
Fix ppc64le TCG and resulting test failures OBS-URL: https://build.opensuse.org/request/show/233682 OBS-URL: https://build.opensuse.org/package/show/Virtualization/qemu?expand=0&rev=208
59 lines
2.3 KiB
Diff
59 lines
2.3 KiB
Diff
From 243f0e345cce28c1f93444de33fe7981efdac6dd Mon Sep 17 00:00:00 2001
|
|
From: Ulrich Weigand <uweigand@de.ibm.com>
|
|
Date: Tue, 22 Apr 2014 18:26:15 +0200
|
|
Subject: [PATCH] tcg-ppc64: Support the ELFv2 ABI
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
The new ELFv2 ABI, used by default on powerpc64le-linux hosts,
|
|
introduced some changes that are incompatible with code currently
|
|
generated by the ppc64 TGC target. In particular, we no longer
|
|
use function descriptors.
|
|
|
|
This patch adds support for the ELFv2 ABI in the ppc64 TGC
|
|
function call and function prologue sequences.
|
|
|
|
Signed-off-by: Ulrich Weigand <ulrich.weigand@de.ibm.com>
|
|
Signed-off-by: Andreas Färber <afaerber@suse.de>
|
|
---
|
|
tcg/ppc64/tcg-target.c | 18 +++++++++++++++++-
|
|
1 file changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/tcg/ppc64/tcg-target.c b/tcg/ppc64/tcg-target.c
|
|
index 06e440f..4ef4838 100644
|
|
--- a/tcg/ppc64/tcg-target.c
|
|
+++ b/tcg/ppc64/tcg-target.c
|
|
@@ -717,6 +717,22 @@ static void tcg_out_call(TCGContext *s, tcg_target_long arg, int const_arg)
|
|
tcg_out32(s, MTSPR | RS(arg) | LR);
|
|
tcg_out32(s, BCLR | BO_ALWAYS | LK);
|
|
}
|
|
+#elif _CALL_ELF == 2
|
|
+ /* In the ELFv2 ABI, we do not need to set up the TOC pointer in r2,
|
|
+ but instead we have to set up r12 to contain the destination address
|
|
+ when performing an indirect call. */
|
|
+ TCGReg reg = arg;
|
|
+ if (const_arg) {
|
|
+ /* FIXME: we could use bl if we knew that the destination uses
|
|
+ the same TOC, and what its local entry point offset is.
|
|
+ For now, always perform an indirect call. */
|
|
+ tcg_out_movi(s, TCG_TYPE_PTR, TCG_REG_R12, arg);
|
|
+ reg = TCG_REG_R12;
|
|
+ } else {
|
|
+ tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_R12, arg);
|
|
+ }
|
|
+ tcg_out32(s, MTSPR | RS(reg) | CTR);
|
|
+ tcg_out32(s, BCCTR | BO_ALWAYS | LK);
|
|
#else
|
|
TCGReg reg = arg;
|
|
int ofs = 0;
|
|
@@ -1112,7 +1128,7 @@ static void tcg_target_qemu_prologue(TCGContext *s)
|
|
REG_SAVE_BOT - CPU_TEMP_BUF_NLONGS * sizeof(long),
|
|
CPU_TEMP_BUF_NLONGS * sizeof(long));
|
|
|
|
-#ifndef __APPLE__
|
|
+#if !defined(__APPLE__) && _CALL_ELF != 2
|
|
/* First emit adhoc function descriptor */
|
|
tcg_out64(s, (uint64_t)s->code_ptr + 24); /* entry point */
|
|
s->code_ptr += 16; /* skip TOC and environment pointer */
|