Skip to content

Commit

Permalink
Fix stack-based arguments for ppc64le.
Browse files Browse the repository at this point in the history
  • Loading branch information
yugr committed Mar 20, 2024
1 parent 887426c commit 48779bb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 23 deletions.
38 changes: 16 additions & 22 deletions arch/powerpc64le/trampoline.S.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion scripts/travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 48779bb

Please sign in to comment.