From 48779bb6a5fcbe625ffc8a1cfcd4276b4c879596 Mon Sep 17 00:00:00 2001 From: Yury Gribov Date: Wed, 20 Mar 2024 22:15:27 +0300 Subject: [PATCH] Fix stack-based arguments for ppc64le. --- arch/powerpc64le/trampoline.S.tpl | 38 +++++++++++++------------------ scripts/travis.sh | 2 +- 2 files changed, 17 insertions(+), 23 deletions(-) diff --git a/arch/powerpc64le/trampoline.S.tpl b/arch/powerpc64le/trampoline.S.tpl index ecb4c1f..f767aba 100644 --- a/arch/powerpc64le/trampoline.S.tpl +++ b/arch/powerpc64le/trampoline.S.tpl @@ -14,12 +14,23 @@ .hidden $sym #endif + // Force callers to save r2 + .localentry $sym, 1 + $sym: .cfi_startproc -.$sym.LCF0: - addis 2, 12, .TOC. - .$sym.LCF0@ha - addi 2, 2, .TOC. - .$sym.LCF0@l - .localentry $sym, . - $sym + + // Get function address + mflr 11 + bcl 20, 31, $$+4 +0: + mflr 12 + mtlr 11 + addi 12, 12, ($sym - 0b) + + // Get TOC address + addis 2, 12, .TOC. - $sym@ha + addi 2, 2, .TOC. - $sym@l 1: // Load address @@ -31,26 +42,9 @@ $sym: beq 3f 2: // "Fast" path - // TODO: can we get rid of prologue/epilogue here? - - mflr 0 - std 0, 16(1) - stdu 1, -112(1) - .cfi_def_cfa_offset 112 - .cfi_offset lr, 16 - - std 2, 24(1) mtctr 12 - bctrl - - ld 2, 24(1) - addi 1, 1, 112 - .cfi_def_cfa_offset 0 - ld 0, 16(1) - mtlr 0 - .cfi_restore lr - blr + bctr 3: // Slow path diff --git a/scripts/travis.sh b/scripts/travis.sh index d1b6741..54d87a7 100755 --- a/scripts/travis.sh +++ b/scripts/travis.sh @@ -40,7 +40,7 @@ tests/multiple-dlopens-3/run.sh $ARCH if ! echo "$ARCH" | grep -q powerpc; then tests/many-functions/run.sh $ARCH fi -if ! echo "$ARCH" | grep -q 'mips64\|powerpc'; then +if ! echo "$ARCH" | grep -q 'mips64\|powerpc64-'; then # FIXME: enable for all platforms ! tests/stack-args/run.sh $ARCH fi