Bug #26701 check-cpu compile flags in x86-64 doesn't support gcc < 3.4
Submitted: 27 Feb 2007 23:14 Modified: 11 Apr 2007 11:48
Reporter: jocelyn fournier (Silver Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0, 5.1, 5.2 OS:Linux (Linux)
Assigned to: Daniel Fischer CPU Architecture:Any
Tags: qc

[27 Feb 2007 23:14] jocelyn fournier
Description:
Hi,

BUILD/check-cpu script currently doesn't support gcc compiler < 3.4 on x86-64 system, because -mtune option is explicitely used.

To fix the issue, -mcpu option has to be used instead for gcc compiler < 3.4.

Moreover the -march cpu flags is not used for x86-64 platform, is this expected ?

Regards,
  Jocelyn

How to repeat:
Run the compile-pentium script on a x86-64 platform with gcc < 3.4 (for example a debian Sarge).

Suggested fix:
For the 5.2 falcon bktree :

--- check-cpu       2007-02-28 00:01:52.000000000 +0100
+++ check-cpu   2007-02-28 00:06:17.000000000 +0100
@@ -179,7 +179,14 @@
                     check_cpu_args='-mcpu=$cpu_arg -mtune=$cpu_arg'
             ;;
           x86_64-*)
-                    check_cpu_args='-mtune=$cpu_arg'
+                case "$cc_verno" in
+                      3.4*|3.5*|4.*)
+                            check_cpu_args='-mtune=$cpu_arg'
+                            ;;
+                      *)
+                            check_cpu_args='-mcpu=$cpu_arg'
+                            ;;
+            esac
             ;;
           *)
             check_cpu_cflags=""
[28 Feb 2007 0:41] jocelyn fournier
.
[28 Feb 2007 11:24] Sveta Smirnova
Thank you for the report.

Verified as described.
[1 Mar 2007 20:00] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/20938

ChangeSet@1.2429, 2007-03-01 20:58:51+01:00, df@pippilotta.erinye.com +1 -0
  BUG#26701 check-cpu compile flags in x86-64 doesn't support gcc < 3.4,
  apply suggestion from jocelyn fournier
[19 Mar 2007 15:15] Chad MILLER
I think it would be better with arithmetic operators.   

 if test "$cc_verno" -lt "3.4"; 
    check_cpu_args="-mcpu=$cpu_arg"; 
 else

gcc v5 and v6 probably won't support -mcpu .
[19 Mar 2007 15:17] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/22274

ChangeSet@1.2430, 2007-03-19 16:15:47+01:00, df@pippilotta.erinye.com +1 -0
  Modify BUG#26701 patch and a different location to also use the correct arguments for GCC 5 and 6.
[21 Mar 2007 15:27] jocelyn fournier
Hi,

Actually I think in the x86 case instead of 

+	    if test "$cc_verno" -lt "3.4"
+            then
+                            check_cpu_args='-mcpu=$cpu_arg'
+            else
+                            check_cpu_args='-mtune=$cpu_arg'
+            fi

just using

check_cpu_args='-march=$cpu_arg' without any condition should be enough, since -march implies -mtune/-mcpu. (and the current patch actually removes the -march optimisation is the x86 case)

(this is not the case for the PPC arch).

Regards,
  Jocelyn
[11 Apr 2007 11:41] Daniel Fischer
My patch is at least in 5.0.40 and 5.1.18-beta.
[11 Apr 2007 11:48] jocelyn fournier
Hi Daniel,

What about my latest comments ?

Thanks,
  Jocelyn