18c6c09d2d
- add support of ppc64le architecture - added patches: * valgrind-3.9.0-merge.patches.from.Paul.McKenney.patch * valgrind-3.9.0-ppc64le-abiv2.patch - This is a request for devel:tools project but will need also to enable openSUSE:Factory:PowerPC ppc64le build. OBS-URL: https://build.opensuse.org/request/show/213760 OBS-URL: https://build.opensuse.org/package/show/devel:tools/valgrind?expand=0&rev=100
439 lines
15 KiB
Diff
439 lines
15 KiB
Diff
Subject: valgrind 3.9.0 ppc64le abiv2
|
|
From: Guy Menanteau <menantea@linux.vnet.ibm.com>
|
|
|
|
more changes for ppc64le arch now that ABI V2 is supported.
|
|
This is a complement of previous valgrind-3.9.0-merge.patches.from.Paul.McKenney.patch
|
|
|
|
Signed-off-by: Guy Menanteau <menantea@linux.vnet.ibm.com>
|
|
Signed-off-by: Michel Normand <normand@linux.vnet.ibm.com>
|
|
---
|
|
coregrind/m_dispatch/dispatch-ppc64-linux.S | 57 +++++++++++++++++++++++++++-
|
|
coregrind/m_libcsetjmp.c | 13 ++++++
|
|
coregrind/m_main.c | 40 +++++++++++++++++++
|
|
coregrind/m_signals.c | 2
|
|
coregrind/m_syscall.c | 6 ++
|
|
coregrind/m_syswrap/syscall-ppc64-linux.S | 6 ++
|
|
coregrind/m_syswrap/syswrap-ppc64-linux.c | 12 +++++
|
|
coregrind/m_trampoline.S | 16 +++++++
|
|
8 files changed, 149 insertions(+), 3 deletions(-)
|
|
|
|
Index: valgrind-3.9.0/coregrind/m_main.c
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_main.c
|
|
+++ valgrind-3.9.0/coregrind/m_main.c
|
|
@@ -2800,7 +2800,7 @@ asm("\n"
|
|
"\ttrap\n"
|
|
".previous\n"
|
|
);
|
|
-#elif defined(VGP_ppc64_linux) || defined(VGP_ppc64le_linux)
|
|
+#elif defined(VGP_ppc64_linux) || (defined(VGP_ppc64le_linux) && _CALL_ELF != 2)
|
|
asm("\n"
|
|
/* PPC64 ELF ABI says '_start' points to a function descriptor.
|
|
So we must have one, and that is what goes into the .opd section. */
|
|
@@ -2819,6 +2819,44 @@ asm("\n"
|
|
"\tori 16,16,vgPlain_interim_stack@higher\n"
|
|
"\tsldi 16,16,32\n"
|
|
"\toris 16,16,vgPlain_interim_stack@h\n"
|
|
+ "\tori 16,16,vgPlain_interim_stack@l\n"
|
|
+ "\txor 17,17,17\n"
|
|
+ "\tlis 17,("VG_STRINGIFY(VG_STACK_GUARD_SZB)" >> 16)\n"
|
|
+ "\tori 17,17,("VG_STRINGIFY(VG_STACK_GUARD_SZB)" & 0xFFFF)\n"
|
|
+ "\txor 18,18,18\n"
|
|
+ "\tlis 18,("VG_STRINGIFY(VG_STACK_ACTIVE_SZB)" >> 16)\n"
|
|
+ "\tori 18,18,("VG_STRINGIFY(VG_STACK_ACTIVE_SZB)" & 0xFFFF)\n"
|
|
+ "\tadd 16,17,16\n"
|
|
+ "\tadd 16,18,16\n"
|
|
+ "\trldicr 16,16,0,59\n"
|
|
+ /* now r16 = &vgPlain_interim_stack + VG_STACK_GUARD_SZB +
|
|
+ VG_STACK_ACTIVE_SZB rounded down to the nearest 16-byte
|
|
+ boundary. And r1 is the original SP. Set the SP to r16 and
|
|
+ call _start_in_C_linux, passing it the initial SP. */
|
|
+ "\tmr 3,1\n"
|
|
+ "\tmr 1,16\n"
|
|
+ "\tlis 14, _start_in_C_linux@highest\n"
|
|
+ "\tori 14,14,_start_in_C_linux@higher\n"
|
|
+ "\tsldi 14,14,32\n"
|
|
+ "\toris 14,14,_start_in_C_linux@h\n"
|
|
+ "\tori 14,14,_start_in_C_linux@l\n"
|
|
+ "\tld 14,0(14)\n"
|
|
+ "\tmtctr 14\n"
|
|
+ "\tbctrl\n"
|
|
+ "\tnop\n"
|
|
+ "\ttrap\n"
|
|
+);
|
|
+#elif defined(VGP_ppc64le_linux) && _CALL_ELF == 2
|
|
+asm("\n"
|
|
+ ".text\n"
|
|
+ "\t.globl _start\n"
|
|
+ "\t.type _start,@function\n"
|
|
+ "_start:\n"
|
|
+ /* set up the new stack in r16 */
|
|
+ "\tlis 16,vgPlain_interim_stack@ha\n"
|
|
+ "\tori 16,16,vgPlain_interim_stack@higher\n"
|
|
+ "\tsldi 16,16,32\n"
|
|
+ "\toris 16,16,vgPlain_interim_stack@h\n"
|
|
"\tori 16,16,vgPlain_interim_stack@l\n"
|
|
"\txor 17,17,17\n"
|
|
"\tlis 17,("VG_STRINGIFY(VG_STACK_GUARD_SZB)" >> 16)\n"
|
|
Index: valgrind-3.9.0/coregrind/m_signals.c
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_signals.c
|
|
+++ valgrind-3.9.0/coregrind/m_signals.c
|
|
@@ -829,7 +829,7 @@ extern void my_sigreturn(void);
|
|
" syscall\n" \
|
|
".previous\n"
|
|
|
|
-#elif defined(VGP_ppc32_linux)
|
|
+#elif defined(VGP_ppc32_linux) || (defined(VGP_ppc64le_linux) && _CALL_ELF == 2)
|
|
# define _MY_SIGRETURN(name) \
|
|
".text\n" \
|
|
".globl my_sigreturn\n" \
|
|
Index: valgrind-3.9.0/coregrind/m_libcsetjmp.c
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_libcsetjmp.c
|
|
+++ valgrind-3.9.0/coregrind/m_libcsetjmp.c
|
|
@@ -152,6 +152,7 @@ __asm__(
|
|
#if defined(VGP_ppc64_linux) || defined(VGP_ppc64le_linux)
|
|
|
|
__asm__(
|
|
+#if _CALL_ELF != 2
|
|
".section \".toc\",\"aw\"" "\n"
|
|
|
|
".section \".text\"" "\n"
|
|
@@ -167,6 +168,13 @@ __asm__(
|
|
|
|
".type VG_MINIMAL_SETJMP, @function" "\n"
|
|
".L.VG_MINIMAL_SETJMP:" "\n"
|
|
+#else
|
|
+".text" "\n"
|
|
+"" "\n"
|
|
+".global VG_MINIMAL_SETJMP" "\n" // r3 = jmp_buf
|
|
+".type VG_MINIMAL_SETJMP, @function" "\n"
|
|
+"VG_MINIMAL_SETJMP:" "\n"
|
|
+#endif
|
|
" std 0, 0(3)" "\n"
|
|
" std 1, 8(3)" "\n"
|
|
" std 2, 16(3)" "\n"
|
|
@@ -211,6 +219,7 @@ __asm__(
|
|
|
|
".globl VG_MINIMAL_LONGJMP" "\n"
|
|
|
|
+#if _CALL_ELF != 2
|
|
".section \".opd\",\"aw\"" "\n"
|
|
".align 3" "\n"
|
|
"VG_MINIMAL_LONGJMP:" "\n"
|
|
@@ -219,6 +228,10 @@ __asm__(
|
|
|
|
".type VG_MINIMAL_LONGJMP, @function" "\n"
|
|
".L.VG_MINIMAL_LONGJMP:" "\n"
|
|
+#else
|
|
+".type VG_MINIMAL_LONGJMP, @function" "\n"
|
|
+"VG_MINIMAL_LONGJMP:" "\n"
|
|
+#endif
|
|
// do r4 = 1
|
|
// and park it in the restore slot for r3 (the ret reg)
|
|
" li 4, 1" "\n"
|
|
Index: valgrind-3.9.0/coregrind/m_syscall.c
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_syscall.c
|
|
+++ valgrind-3.9.0/coregrind/m_syscall.c
|
|
@@ -382,6 +382,7 @@ asm(
|
|
bottom bit of [1]. */
|
|
extern void do_syscall_WRK ( ULong* argblock );
|
|
asm(
|
|
+#if _CALL_ELF != 2
|
|
".align 2\n"
|
|
".globl do_syscall_WRK\n"
|
|
".section \".opd\",\"aw\"\n"
|
|
@@ -392,6 +393,11 @@ asm(
|
|
".type .do_syscall_WRK,@function\n"
|
|
".globl .do_syscall_WRK\n"
|
|
".do_syscall_WRK:\n"
|
|
+#else
|
|
+".globl do_syscall_WRK\n"
|
|
+".type do_syscall_WRK,@function\n"
|
|
+"do_syscall_WRK:\n"
|
|
+#endif
|
|
" std 3,-16(1)\n" /* stash arg */
|
|
" ld 8, 48(3)\n" /* sc arg 6 */
|
|
" ld 7, 40(3)\n" /* sc arg 5 */
|
|
Index: valgrind-3.9.0/coregrind/m_trampoline.S
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_trampoline.S
|
|
+++ valgrind-3.9.0/coregrind/m_trampoline.S
|
|
@@ -441,6 +441,13 @@ VG_(ppc64_linux_SUBST_FOR_rt_sigreturn):
|
|
VG_(ppctoc_magic_redirect_return_stub):
|
|
trap
|
|
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(ppc64_linux_REDIR_FOR_strlen)
|
|
+ .size VG_(ppc64_linux_REDIR_FOR_strlen), \
|
|
+ .L0end-VG_(ppc64_linux_REDIR_FOR_strlen)
|
|
+ .type VG_(ppc64_linux_REDIR_FOR_strlen), @function
|
|
+VG_(ppc64_linux_REDIR_FOR_strlen):
|
|
+#else
|
|
/* this function is written using the "dotless" ABI convention */
|
|
.align 2
|
|
.globl VG_(ppc64_linux_REDIR_FOR_strlen)
|
|
@@ -454,6 +461,7 @@ VG_(ppc64_linux_REDIR_FOR_strlen):
|
|
.type VG_(ppc64_linux_REDIR_FOR_strlen), @function
|
|
|
|
.L.VG_(ppc64_linux_REDIR_FOR_strlen):
|
|
+#endif
|
|
mr 9,3
|
|
lbz 0,0(3)
|
|
li 3,0
|
|
@@ -471,6 +479,13 @@ VG_(ppc64_linux_REDIR_FOR_strlen):
|
|
.byte 0,0,0,0,0,0,0,0
|
|
.L0end:
|
|
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(ppc64_linux_REDIR_FOR_strchr)
|
|
+ .size VG_(ppc64_linux_REDIR_FOR_strchr), \
|
|
+ .L1end-VG_(ppc64_linux_REDIR_FOR_strchr)
|
|
+ .type VG_(ppc64_linux_REDIR_FOR_strchr),@function
|
|
+VG_(ppc64_linux_REDIR_FOR_strchr):
|
|
+#else
|
|
/* this function is written using the "dotless" ABI convention */
|
|
.align 2
|
|
.globl VG_(ppc64_linux_REDIR_FOR_strchr)
|
|
@@ -484,6 +499,7 @@ VG_(ppc64_linux_REDIR_FOR_strchr):
|
|
.type VG_(ppc64_linux_REDIR_FOR_strchr),@function
|
|
|
|
.L.VG_(ppc64_linux_REDIR_FOR_strchr):
|
|
+#endif
|
|
lbz 0,0(3)
|
|
rldicl 4,4,0,56
|
|
cmpw 7,4,0
|
|
Index: valgrind-3.9.0/coregrind/m_dispatch/dispatch-ppc64-linux.S
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_dispatch/dispatch-ppc64-linux.S
|
|
+++ valgrind-3.9.0/coregrind/m_dispatch/dispatch-ppc64-linux.S
|
|
@@ -72,6 +72,11 @@ void VG_(disp_run_translations)( UWord*
|
|
*/
|
|
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+.globl VG_(disp_run_translations)
|
|
+.type VG_(disp_run_translations),@function
|
|
+VG_(disp_run_translations):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_run_translations)
|
|
.section ".opd","aw"
|
|
@@ -82,12 +87,27 @@ VG_(disp_run_translations):
|
|
.type .VG_(disp_run_translations),@function
|
|
.globl .VG_(disp_run_translations)
|
|
.VG_(disp_run_translations):
|
|
+#endif
|
|
/* r3 holds two_words */
|
|
/* r4 holds guest_state */
|
|
/* r5 holds host_addr */
|
|
|
|
+#if _CALL_ELF != 2
|
|
+ /* ----- entry point to VG_(disp_run_translations) ----- */
|
|
+ /* PPC64 ABIv1 saves LR->16(prt_sp), CR->8(prt_sp)) */
|
|
+
|
|
+ /* Save lr, cr */
|
|
+ mflr 6
|
|
+ std 6,16(1)
|
|
+ mfcr 6
|
|
+ std 6,8(1)
|
|
+
|
|
+ /* New stack frame */
|
|
+ stdu 1,-624(1) /* sp should maintain 16-byte alignment */
|
|
+#else
|
|
+/* FIXME !!!!!!!!! */
|
|
/* ----- entry point to VG_(disp_run_translations) ----- */
|
|
- /* PPC64 ABI saves LR->16(prt_sp), CR->8(prt_sp)) */
|
|
+ /* PPC64 ABIv2 saves LR->16(prt_sp), CR->8(prt_sp)) */
|
|
|
|
/* Save lr, cr */
|
|
mflr 6
|
|
@@ -97,6 +117,7 @@ VG_(disp_run_translations):
|
|
|
|
/* New stack frame */
|
|
stdu 1,-624(1) /* sp should maintain 16-byte alignment */
|
|
+#endif
|
|
|
|
/* General reg save area : 152 bytes */
|
|
std 31,472(1)
|
|
@@ -392,6 +413,11 @@ VG_(disp_run_translations):
|
|
|
|
/* ------ Chain me to slow entry point ------ */
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(disp_cp_chain_me_to_slowEP)
|
|
+ .type VG_(disp_cp_chain_me_to_slowEP),@function
|
|
+VG_(disp_cp_chain_me_to_slowEP):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_cp_chain_me_to_slowEP)
|
|
.section ".opd","aw"
|
|
@@ -402,6 +428,7 @@ VG_(disp_cp_chain_me_to_slowEP):
|
|
.type .VG_(disp_cp_chain_me_to_slowEP),@function
|
|
.globl .VG_(disp_cp_chain_me_to_slowEP)
|
|
.VG_(disp_cp_chain_me_to_slowEP):
|
|
+#endif
|
|
/* We got called. The return address indicates
|
|
where the patching needs to happen. Collect
|
|
the return address and, exit back to C land,
|
|
@@ -417,6 +444,11 @@ VG_(disp_cp_chain_me_to_slowEP):
|
|
|
|
/* ------ Chain me to fast entry point ------ */
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(disp_cp_chain_me_to_fastEP)
|
|
+ .type VG_(disp_cp_chain_me_to_fastEP),@function
|
|
+VG_(disp_cp_chain_me_to_fastEP):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_cp_chain_me_to_fastEP)
|
|
.section ".opd","aw"
|
|
@@ -427,6 +459,7 @@ VG_(disp_cp_chain_me_to_fastEP):
|
|
.type .VG_(disp_cp_chain_me_to_fastEP),@function
|
|
.globl .VG_(disp_cp_chain_me_to_fastEP)
|
|
.VG_(disp_cp_chain_me_to_fastEP):
|
|
+#endif
|
|
/* We got called. The return address indicates
|
|
where the patching needs to happen. Collect
|
|
the return address and, exit back to C land,
|
|
@@ -442,6 +475,11 @@ VG_(disp_cp_chain_me_to_fastEP):
|
|
|
|
/* ------ Indirect but boring jump ------ */
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(disp_cp_xindir)
|
|
+ .type VG_(disp_cp_xindir),@function
|
|
+VG_(disp_cp_xindir):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_cp_xindir)
|
|
.section ".opd","aw"
|
|
@@ -452,6 +490,7 @@ VG_(disp_cp_xindir):
|
|
.type .VG_(disp_cp_xindir),@function
|
|
.globl .VG_(disp_cp_xindir)
|
|
.VG_(disp_cp_xindir):
|
|
+#endif
|
|
/* Where are we going? */
|
|
ld 3,OFFSET_ppc64_CIA(31)
|
|
|
|
@@ -493,6 +532,11 @@ VG_(disp_cp_xindir):
|
|
|
|
/* ------ Assisted jump ------ */
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(disp_cp_xassisted)
|
|
+ .type VG_(disp_cp_xassisted),@function
|
|
+VG_(disp_cp_xassisted):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_cp_xassisted)
|
|
.section ".opd","aw"
|
|
@@ -503,6 +547,7 @@ VG_(disp_cp_xassisted):
|
|
.type .VG_(disp_cp_xassisted),@function
|
|
.globl .VG_(disp_cp_xassisted)
|
|
.VG_(disp_cp_xassisted):
|
|
+#endif
|
|
/* r31 contains the TRC */
|
|
mr 6,31
|
|
li 7,0
|
|
@@ -510,6 +555,11 @@ VG_(disp_cp_xassisted):
|
|
|
|
/* ------ Event check failed ------ */
|
|
.section ".text"
|
|
+#if _CALL_ELF == 2
|
|
+ .globl VG_(disp_cp_evcheck_fail)
|
|
+ .type VG_(disp_cp_evcheck_fail),@function
|
|
+VG_(disp_cp_evcheck_fail):
|
|
+#else
|
|
.align 2
|
|
.globl VG_(disp_cp_evcheck_fail)
|
|
.section ".opd","aw"
|
|
@@ -520,12 +570,17 @@ VG_(disp_cp_evcheck_fail):
|
|
.type .VG_(disp_cp_evcheck_fail),@function
|
|
.globl .VG_(disp_cp_evcheck_fail)
|
|
.VG_(disp_cp_evcheck_fail):
|
|
+#endif
|
|
li 6,VG_TRC_INNER_COUNTERZERO
|
|
li 7,0
|
|
b .postamble
|
|
|
|
|
|
+#if _CALL_ELF == 2
|
|
+.size .VG_(disp_run_translations), .-VG_(disp_run_translations)
|
|
+#else
|
|
.size .VG_(disp_run_translations), .-.VG_(disp_run_translations)
|
|
+#endif
|
|
|
|
/* Let the linker know we don't need an executable stack */
|
|
.section .note.GNU-stack,"",@progbits
|
|
Index: valgrind-3.9.0/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
+++ valgrind-3.9.0/coregrind/m_syswrap/syswrap-ppc64-linux.c
|
|
@@ -78,6 +78,11 @@ void ML_(call_on_new_stack_0_1) ( Addr s
|
|
address, the second word is the TOC ptr (r2), and the third word is
|
|
the static chain value. */
|
|
asm(
|
|
+#if _CALL_ELF == 2
|
|
+" .globl vgModuleLocal_call_on_new_stack_0_1\n"
|
|
+" .type vgModuleLocal_call_on_new_stack_0_1,@function\n"
|
|
+"vgModuleLocal_call_on_new_stack_0_1:\n"
|
|
+#else
|
|
" .align 2\n"
|
|
" .globl vgModuleLocal_call_on_new_stack_0_1\n"
|
|
" .section \".opd\",\"aw\"\n"
|
|
@@ -88,6 +93,7 @@ asm(
|
|
" .type .vgModuleLocal_call_on_new_stack_0_1,@function\n"
|
|
" .globl .vgModuleLocal_call_on_new_stack_0_1\n"
|
|
".vgModuleLocal_call_on_new_stack_0_1:\n"
|
|
+#endif
|
|
" mr %r1,%r3\n\t" // stack to %sp
|
|
" mtlr %r4\n\t" // retaddr to %lr
|
|
" ld 5,0(5)\n\t" // load f_ptr from f_desc[0]
|
|
@@ -170,6 +176,11 @@ ULong do_syscall_clone_ppc64_linux ( Wor
|
|
Int* parent_tid,
|
|
void/*vki_modify_ldt_t*/ * );
|
|
asm(
|
|
+#if _CALL_ELF == 2
|
|
+" .globl do_syscall_clone_ppc64_linux\n"
|
|
+" .type do_syscall_clone_ppc64_linux,@function\n"
|
|
+"do_syscall_clone_ppc64_linux:\n"
|
|
+#else
|
|
" .align 2\n"
|
|
" .globl do_syscall_clone_ppc64_linux\n"
|
|
" .section \".opd\",\"aw\"\n"
|
|
@@ -180,6 +191,7 @@ asm(
|
|
" .type .do_syscall_clone_ppc64_linux,@function\n"
|
|
" .globl .do_syscall_clone_ppc64_linux\n"
|
|
".do_syscall_clone_ppc64_linux:\n"
|
|
+#endif
|
|
" stdu 1,-64(1)\n"
|
|
" std 29,40(1)\n"
|
|
" std 30,48(1)\n"
|
|
Index: valgrind-3.9.0/coregrind/m_syswrap/syscall-ppc64-linux.S
|
|
===================================================================
|
|
--- valgrind-3.9.0.orig/coregrind/m_syswrap/syscall-ppc64-linux.S
|
|
+++ valgrind-3.9.0/coregrind/m_syswrap/syscall-ppc64-linux.S
|
|
@@ -73,6 +73,11 @@
|
|
/* from vki_arch.h */
|
|
#define VKI_SIG_SETMASK 2
|
|
|
|
+#if _CALL_ELF == 2
|
|
+.globl ML_(do_syscall_for_client_WRK)
|
|
+.type ML_(do_syscall_for_client_WRK),@function
|
|
+ML_(do_syscall_for_client_WRK):
|
|
+#else
|
|
.align 2
|
|
.globl ML_(do_syscall_for_client_WRK)
|
|
.section ".opd","aw"
|
|
@@ -83,6 +88,7 @@ ML_(do_syscall_for_client_WRK):
|
|
.type .ML_(do_syscall_for_client_WRK),@function
|
|
.globl .ML_(do_syscall_for_client_WRK)
|
|
.ML_(do_syscall_for_client_WRK):
|
|
+#endif
|
|
/* make a stack frame */
|
|
stdu 1,-80(1)
|
|
std 31,72(1)
|