diff --git a/0045-tcg-ppc64-Support-the-ELFv2-ABI.patch b/0045-tcg-ppc64-Support-the-ELFv2-ABI.patch new file mode 100644 index 0000000..7d7b2f3 --- /dev/null +++ b/0045-tcg-ppc64-Support-the-ELFv2-ABI.patch @@ -0,0 +1,58 @@ +From 243f0e345cce28c1f93444de33fe7981efdac6dd Mon Sep 17 00:00:00 2001 +From: Ulrich Weigand +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 +Signed-off-by: Andreas Färber +--- + 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 */ diff --git a/qemu-linux-user.changes b/qemu-linux-user.changes index b3c3bba..dc4e401 100644 --- a/qemu-linux-user.changes +++ b/qemu-linux-user.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 13 08:17:18 UTC 2014 - afaerber@suse.de + +- ABI fixes for ppc64le TCG + 0045-tcg-ppc64-Support-the-ELFv2-ABI.patch + ------------------------------------------------------------------- Fri Apr 18 17:55:03 UTC 2014 - afaerber@suse.de diff --git a/qemu-linux-user.spec b/qemu-linux-user.spec index 7279731..93af914 100644 --- a/qemu-linux-user.spec +++ b/qemu-linux-user.spec @@ -69,6 +69,7 @@ Patch0041: 0041-qtest-Increase-socket-timeout.patch Patch0042: 0042-qtest-Be-paranoid-about-accept-addr.patch Patch0043: 0043-arm-translate.c-Fix-smlald-Instruct.patch Patch0044: 0044-target-arm-A64-fix-unallocated-test.patch +Patch0045: 0045-tcg-ppc64-Support-the-ELFv2-ABI.patch # Please do not add patches manually here, run update_git.sh. # this is to make lint happy Source300: rpmlintrc @@ -166,6 +167,7 @@ run cross-architecture builds. %patch0042 -p1 %patch0043 -p1 %patch0044 -p1 +%patch0045 -p1 %build ./configure --prefix=%_prefix --sysconfdir=%_sysconfdir \ diff --git a/qemu.changes b/qemu.changes index 1a711dc..d5ffe6c 100644 --- a/qemu.changes +++ b/qemu.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue May 13 08:17:18 UTC 2014 - afaerber@suse.de + +- ABI fixes for ppc64le TCG. Addresses acpi-test failures. + 0045-tcg-ppc64-Support-the-ELFv2-ABI.patch + ------------------------------------------------------------------- Sat May 10 20:06:24 UTC 2014 - afaerber@suse.de diff --git a/qemu.spec b/qemu.spec index d3df326..97003f2 100644 --- a/qemu.spec +++ b/qemu.spec @@ -98,6 +98,7 @@ Patch0041: 0041-qtest-Increase-socket-timeout.patch Patch0042: 0042-qtest-Be-paranoid-about-accept-addr.patch Patch0043: 0043-arm-translate.c-Fix-smlald-Instruct.patch Patch0044: 0044-target-arm-A64-fix-unallocated-test.patch +Patch0045: 0045-tcg-ppc64-Support-the-ELFv2-ABI.patch # Please do not add patches manually here, run update_git.sh. # roms/ipxe patches @@ -520,6 +521,7 @@ This package provides a service file for starting and stopping KSM. %patch0042 -p1 %patch0043 -p1 %patch0044 -p1 +%patch0045 -p1 %patch1000 -p1 %patch1001 -p1