Quantcast

[PATCH] valgrind / ppc64 remove R2/TOC ptr clobbers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] valgrind / ppc64 remove R2/TOC ptr clobbers

Will Schmidt

On ppc64*, the TOC ptr should not be considered a scratch
register, and should not be in the clobber list.
This is called out in newer GCC (i.e. gcc7) and triggers an error.
   
Thusly, remove R2 from the clobber list.

Signed-Off-By: Will Schmidt <[hidden email]>
---

   
diff --git a/coregrind/m_debuglog.c b/coregrind/m_debuglog.c
index dc6e26d..be77680 100644
--- a/coregrind/m_debuglog.c
+++ b/coregrind/m_debuglog.c
@@ -215,7 +215,7 @@ static UInt local_sys_write_stderr ( const HChar* buf, Int n )
       :
       : "b" (block)
       : "cc","memory","cr0","ctr",
-        "r0","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12"
+        "r0","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12"
    );
    if (block[0] < 0)
       block[0] = -1;
@@ -231,7 +231,7 @@ static UInt local_sys_getpid ( void )
       : "=&r" (__res)
       : "i" (__NR_getpid)
       : "cc","memory","cr0","ctr",
-        "r0","r2","r4","r5","r6","r7","r8","r9","r10","r11","r12"
+        "r0","r4","r5","r6","r7","r8","r9","r10","r11","r12"
    );
    return (UInt)__res;
 }
diff --git a/include/valgrind.h b/include/valgrind.h
index 6892007..d2e7c38 100644
--- a/include/valgrind.h
+++ b/include/valgrind.h
@@ -2708,7 +2708,7 @@ typedef
 #define __CALLER_SAVED_REGS                                       \
    "lr", "ctr", "xer",                                            \
    "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
+   "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",         \
    "r11", "r12", "r13"
 
 /* Macros to save and align the stack before making a function
@@ -3264,7 +3264,7 @@ typedef
 #define __CALLER_SAVED_REGS                                       \
    "lr", "ctr", "xer",                                            \
    "cr0", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",        \
-   "r0", "r2", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",   \
+   "r0", "r3", "r4", "r5", "r6", "r7", "r8", "r9", "r10",         \
    "r11", "r12", "r13"
 
 /* Macros to save and align the stack before making a function



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] valgrind / ppc64 remove R2/TOC ptr clobbers

Mark Wielaard
On Fri, 2017-02-17 at 11:27 -0600, Will Schmidt wrote:
> On ppc64*, the TOC ptr should not be considered a scratch
> register, and should not be in the clobber list.
> This is called out in newer GCC (i.e. gcc7) and triggers an error.
>    
> Thusly, remove R2 from the clobber list.

Thanks. I used this patch to get the valgrind fedora rawhide package to
build again on ppc64[le]. And it seems to work.

For reference I also backported the following list of patches to make
things work better against latest gcc, glibc and linux kernel used in
fedora rawhide. This might be a good list of patches/bugs if we do a
3.12.1 release.

# KDE#371396 - workaround helgrind and drd pth_cond_destroy_busy testcase hangs

# RHBZ#1390282 upstream svn r16134
# Cleanup none/tests/nocwd.vgtest tmp dirs.

# RHBZ#1424367
# GCC7 now diagnoses inline assembly that clobbers register r2.
# This has always been invalid code, and is no longer quietly tolerated.

# KDE#376611 ppc64 and arm64 don't know about prlimit64 syscall

# KDE#376279 Handle unknown HINT instructions on aarch64 by ignoring them.

# KDE#342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM
#            that clones to a different stack
# KDE#373192 Calling posix_spawn in glibc 2.24 completely broken

# KDE#372600 process loops forever when fatal signals are arriving quickly

# KDE#372504 Hanging on exit_group

# KDE#373046 Stacks registered by core are never deregistered

# KDE#344139
# Initialize x86 system GDT on first use.
# VEX: Recognize the SS segment prefix on x86.

# KDE#352767 - Wine/valgrind: noted but unhandled ioctl 0x5307 (CDROMSTOP)
# KDE#348616 - Wine/valgrind: noted but unhandled ioctl 0x5390 (DVD_READ_STRUCT)

# KDE#373069 force old implementation of std::string for leak_cpp_interior test

# KDE#375806 add suppression for helgrind/tests/tc22_exit_w_lock

# KDE#372195 Power PC, xxsel instruction is not always recognized.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] valgrind / ppc64 remove R2/TOC ptr clobbers

Carl E. Love-2
Mark, Will:

I have tested and committed Will's patch, see
https://bugs.kde.org/show_bug.cgi?id=376729

I left the bug open for the moment in case either of you would like to
add any additional info/comments on the bug.  If not, I will close it.

Thanks.

                  Carl Love

On Sat, 2017-02-18 at 18:00 +0100, Mark Wielaard wrote:

> On Fri, 2017-02-17 at 11:27 -0600, Will Schmidt wrote:
> > On ppc64*, the TOC ptr should not be considered a scratch
> > register, and should not be in the clobber list.
> > This is called out in newer GCC (i.e. gcc7) and triggers an error.
> >    
> > Thusly, remove R2 from the clobber list.
>
> Thanks. I used this patch to get the valgrind fedora rawhide package to
> build again on ppc64[le]. And it seems to work.
>
> For reference I also backported the following list of patches to make
> things work better against latest gcc, glibc and linux kernel used in
> fedora rawhide. This might be a good list of patches/bugs if we do a
> 3.12.1 release.
>
> # KDE#371396 - workaround helgrind and drd pth_cond_destroy_busy testcase hangs
>
> # RHBZ#1390282 upstream svn r16134
> # Cleanup none/tests/nocwd.vgtest tmp dirs.
>
> # RHBZ#1424367
> # GCC7 now diagnoses inline assembly that clobbers register r2.
> # This has always been invalid code, and is no longer quietly tolerated.
>
> # KDE#376611 ppc64 and arm64 don't know about prlimit64 syscall
>
> # KDE#376279 Handle unknown HINT instructions on aarch64 by ignoring them.
>
> # KDE#342040 Valgrind mishandles clone with CLONE_VFORK | CLONE_VM
> #            that clones to a different stack
> # KDE#373192 Calling posix_spawn in glibc 2.24 completely broken
>
> # KDE#372600 process loops forever when fatal signals are arriving quickly
>
> # KDE#372504 Hanging on exit_group
>
> # KDE#373046 Stacks registered by core are never deregistered
>
> # KDE#344139
> # Initialize x86 system GDT on first use.
> # VEX: Recognize the SS segment prefix on x86.
>
> # KDE#352767 - Wine/valgrind: noted but unhandled ioctl 0x5307 (CDROMSTOP)
> # KDE#348616 - Wine/valgrind: noted but unhandled ioctl 0x5390 (DVD_READ_STRUCT)
>
> # KDE#373069 force old implementation of std::string for leak_cpp_interior test
>
> # KDE#375806 add suppression for helgrind/tests/tc22_exit_w_lock
>
> # KDE#372195 Power PC, xxsel instruction is not always recognized.
>
>



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-developers mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/valgrind-developers
Loading...