Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1257623

Summary: valgrind testsuite is aborted due to bogus builtins in 32 bit mode
Product: Red Hat Enterprise Linux 7 Reporter: Miroslav Franc <mfranc>
Component: valgrindAssignee: Mark Wielaard <mjw>
Status: CLOSED ERRATA QA Contact: Miloš Prchlík <mprchlik>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: jakub, lmiksik, mbenitez, mfranc, mprchlik, ohudlick
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: valgrind-3.10.0-16.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 09:05:22 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miroslav Franc 2015-08-27 13:30:17 UTC
Description of problem:
When running valgrind testsuite on ppc64.  We sometimes see the following error:

test_touch_tm.c:11:23: error: builtin __builtin_tabortdc is only valid in 64-bit mode
    __builtin_tabortdc (0,0,0);
                       ^
test_touch_tm.c:12:24: error: builtin __builtin_tabortdci is only valid in 64-bit mode
    __builtin_tabortdci (0,0,0);
                        ^
make[6]: *** [test_touch_tm-test_touch_tm.o] Error 1
make[5]: *** [check-am] Error 2
make[4]: *** [check-recursive] Error 1
make[3]: *** [check-recursive] Error 1
make[2]: *** [check-recursive] Error 1
make[1]: *** [check] Error 2

It aborts entire testsuite.  Which means no results. :(

Version-Release number of selected component (if applicable):
valgrind-3.10.0-14.el7


Steps to Reproduce:
1. make --quiet regtest


The culprit seems to be test_touch_tm.c testcase.

--- test_touch_tm.c ---
#include <stdio.h>

int main (void) {
#ifdef HAS_ISA_2_07
   /* Just get the compiler to generate each of the TM instructions
    * so we can verify that valgrind recognizes them.
    * For now, only the tbegin instruction does anything in valgrind.
    * The rest are just treated as NOPS.
    */
   __builtin_tabort (0);
   __builtin_tabortdc (0,0,0);
   __builtin_tabortdci (0,0,0);
   __builtin_tabortwc (0,0,0);
   __builtin_tabortwci (0,0,0);
   __builtin_tbegin (0);
   __builtin_tend (0);
   //   __builtin_tcheck (0);  tcheck not recognized by compiler
   __builtin_trechkpt ();  // not recognized by early HW
   __builtin_treclaim (0); // not recognized by early HW
   __builtin_tsr (0);
#endif
   return 0;
}
--- --- ---

# gcc -m64 -mhtm -DHAS_ISA_2_07 -Winline -Wall -O -g -mregnames -lm test_touch_tm.c
# gcc -m32 -mhtm -DHAS_ISA_2_07 -Winline -Wall -O -g -mregnames -lm test_touch_tm.c
test_touch_tm.c: In function ‘main’:
test_touch_tm.c:11:23: error: builtin __builtin_tabortdc is only valid in 64-bit mode
    __builtin_tabortdc (0,0,0);
                       ^
test_touch_tm.c:12:24: error: builtin __builtin_tabortdci is only valid in 64-bit mode
    __builtin_tabortdci (0,0,0);
                        ^

Something like the following seems to fix that:

#ifdef __PPC64__
   __builtin_tabortdc (0,0,0);
   __builtin_tabortdci (0,0,0);
#endif

Comment 1 Miroslav Franc 2015-08-27 13:48:39 UTC
Actually, strange thing is that it's in both none/tests/ppc32 and none/tests/ppc64 directories.  I can see that upstream has it only in none/tests/ppc64.

Comment 2 Miroslav Franc 2015-08-27 13:53:31 UTC
(In reply to Miroslav Franc from comment #1)
> Actually, strange thing is that it's in both none/tests/ppc32 and
> none/tests/ppc64 directories.  I can see that upstream has it only in
> none/tests/ppc64.

I take that back.  There's a symlink.

Comment 4 Mark Wielaard 2015-08-27 14:39:41 UTC
This is caused by a stricter gcc which no longer accepts __builtin_tabortdc[i] in -m32 mode. The fix to guard those calls with __PPC64__ looks correct.

Comment 10 Miloš Prchlík 2015-09-23 13:47:49 UTC
Verified for valgrind-3.10.0-16.el7.

Comment 12 errata-xmlrpc 2015-11-19 09:05:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2259.html