[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Fwd: Re: [PATCH] tcg-ppc64: Support the ELFv2 ABI
From: |
Richard Henderson |
Subject: |
[Qemu-devel] Fwd: Re: [PATCH] tcg-ppc64: Support the ELFv2 ABI |
Date: |
Tue, 22 Apr 2014 11:08:50 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 |
Bah. Copied Uli's typo to qemu address.
r~
-------- Original Message --------
Subject: Re: [PATCH] tcg-ppc64: Support the ELFv2 ABI
Date: Tue, 22 Apr 2014 10:53:18 -0700
From: Richard Henderson <address@hidden>
To: Ulrich Weigand <address@hidden>, address@hidden
CC: address@hidden, address@hidden
On 04/22/2014 09:20 AM, Ulrich Weigand wrote:
> +#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);
Looks ok.
Any chance we can get assurances on the same TOC from the compiler+linker?
E.g. for Alpha gcc has -msmall-data, so the compiler can assume a single gp for
local functions, optimizing more calls itself. Then the linker has
--warn-multiple-gp to check this assumption at link time.
> -#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 */
The proper test here is #ifdef _CALL_AIX.
Please check out
git://github.com/rth7680/qemu.git tcg-ppc-merge
which merges the ppc32 and ppc64 backends. I also started to
support the ELFv2 ABI. I believe that you technically need
#ifdef _CALL_AIX
# define LINK_AREA_SIZE (6 * SZR)
# define LR_OFFSET (1 * SZR)
# define TCG_TARGET_CALL_STACK_OFFSET (LINK_AREA_SIZE + 8 * SZR)
+#elif defined(_CALL_ELF) && _CALL_ELF == 2
+# define LINK_AREA_SIZE (4 * SZR)
+# define LR_OFFSET (1 * SZR)
+# define TCG_TARGET_CALL_STACK_OFFSET LINK_AREA_SIZE
although we don't have helpers that will actually exercise 9 arguments.
But I had missed this R12 feature of the call conventions, so thanks for that.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] Fwd: Re: [PATCH] tcg-ppc64: Support the ELFv2 ABI,
Richard Henderson <=