Thread (42 messages) 42 messages, 4 authors, 2014-04-22

Re: [PATCH 15/33] powerpc: Fix ABIv2 issues with stack offsets in assembly code

From: Alan Modra <hidden>
Date: 2014-03-26 10:04:58

On Tue, Mar 25, 2014 at 10:44:21PM +1100, Anton Blanchard wrote:
Fix STK_PARAM and use it instead of hardcoding ABIv1 offsets.
 _GLOBAL(memcpy)
 BEGIN_FTR_SECTION
-	std	r3,48(r1)	/* save destination pointer for return value */
+	std	r3,STK_PARAM(R3)(r1)	/* save destination pointer for return value */
Here and elsewhere you're assuming you have a parameter save area.
That won't be true with ELFv2 for calls to functions like memcpy.

typedef __SIZE_TYPE__ size_t;
extern void *memcpy (void *dest, const void *src, size_t n);

void foo (void *dest, const void *src, size_t n)
{
  memcpy (dest, src, n);
}

foo:
0:	addis 2,12,.TOC.-0b@ha
	addi 2,2,.TOC.-0b@l
	.localentry	foo,.-foo
	mflr 0
	std 0,16(1)
	stdu 1,-32(1)   # <========
	bl memcpy
	nop
	addi 1,1,32
	ld 0,16(1)
	mtlr 0
	blr

-- 
Alan Modra
Australia Development Lab, IBM
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help