Bug 371668 - ppc64 clobbering of R2 is invalid.
Summary: ppc64 clobbering of R2 is invalid.
Status: RESOLVED DUPLICATE of bug 376729
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-25 14:32 UTC by Will Schmidt
Modified: 2017-03-06 14:11 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
proposed patch (2.07 KB, patch)
2016-10-28 18:57 UTC, Will Schmidt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Will Schmidt 2016-10-25 14:32:13 UTC
This was recently noticed and reported via GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78095

"
>  (Powerpc)
>   <li>GCC now diagnoses inline assembly that clobbers register r2.            
>     This has always been invalid code, and is no longer quietly               
>     tolerated.</li>        
"


Reproducible: Always


Actual Results:  
Errors reported in several spots, including: 
m_debuglog.c: In function 'vgPlain_debugLog':
m_debuglog.c:228:4: error: PIC register clobbered by 'r2' in 'asm'
    __asm__ volatile (
    ^~~~~~~
### and 
In file included from ../include/pub_tool_clreq.h:34:0,
                 from pub_core_clreq.h:38,
                 from vg_preloaded.c:46:
vg_preloaded.c: In function '_vgnU_ifunc_wrapper':
../include/valgrind.h:3292:7: error: PIC register clobbered by 'r2' in 'asm'
       __asm__ volatile(                                           \
       ^
vg_preloaded.c:104:5: note: in expansion of macro 'CALL_FN_W_v'
     CALL_FN_W_v(result, fn);
     ^~~~~~~~~~~
Comment 1 Will Schmidt 2016-10-28 18:57:01 UTC
Created attachment 101860 [details]
proposed patch

Proposed patch.
Remove "r2" from the __CALLER_SAVED_REGS for ppc64 and ppc64le.
Remove "r2" from the clobber list associated with functions local_sys_write_stderr and local_sys_getpid.
Comment 2 Julian Seward 2017-03-06 14:11:43 UTC

*** This bug has been marked as a duplicate of bug 376729 ***