Bug #47137 Solaris binary packages should be compiled with '-g0', not '-g'
Submitted: 4 Sep 2009 13:14 Modified: 18 Dec 2009 11:46
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Packaging Severity:S5 (Performance)
Version:any OS:Solaris (using Sun compilers)
Assigned to: Joerg Bruehe CPU Architecture:Any

[4 Sep 2009 13:14] Hartmut Holzgraefe
A while we go we started to add the '-g' compile option to our builds so that binaries always contain symbol information and so produce more meaningful information in the event of crashes (backtraces in the error log, core dumps ...)

This change was supposed to have no performance impact as the additional information is stored in a separate segment in the binary file which is not loaded at runtime but only inspected on demand.

It turned out that with the Sun C++ compiler '-g' also disables some 
optimization to e.g. make backtraces on core dumps more readable.
One of the optimizations that get disabled is function inlining which
has a rather large performance impact, especially on native NDBAPI
applications with MySQL Cluster.

Sun compilers have an additional option '-g0' though that works the same
way as '-g' on gcc by adding symbol information without changing any other

See also: http://docs.sun.com/app/docs/doc/819-5267/bkasi?a=view

Compiles and links for debugging, but does not disable inlining.

This option is the same as –g, except that +d is disabled and dbx cannot step into inlined functions.

If you specify -g0 and the optimization level is -xO3 or lower, the compiler provides best-effort symbolic information with almost full optimization. Tail-call optimization and back-end inlining are disabled.

How to repeat:
Build binaries with -g, -g0 and without any -g option and compare peak performance.

Suggested fix:
Use -g0 instead of -g when building with Sun compilers
[17 Sep 2009 19:51] 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:


2803 Joerg Bruehe	2009-09-17
      Fix bug#47137
          Solaris binary packages should be compiled with '-g0', not '-g'
      The main fix for this is done in the build tools,
      but in the sources it affects "configure.in"
      which sets "DEBUG_CXXFLAGS" to be used in all debug builds.
[18 Sep 2009 10:25] Bjørn Munch
Looks good to me
[18 Sep 2009 12:00] Joerg Bruehe
Verified to work correctly in 5.1, too.

As it worked (for builds + tests) in both 5.0 and 5.1,
and most of the effort was testing and thoroughly checking the logs,
I want to get it into 5.0 and up.
[28 Sep 2009 8:45] 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:


2805 Joerg Bruehe	2009-09-28 [merge]
      Merge the fix for bug#47137 into 5.0-build
         Solaris binary packages should be compiled with '-g0', not '-g'
[28 Sep 2009 10:46] Joerg Bruehe
Patches are pushed into the build team trees
which are currently labeled 5.0.87, 5.1.40, and 5.4.5-beta.
[1 Oct 2009 21:10] Bugs System
Pushed into 5.1.40 (revid:joerg@mysql.com-20090928090731-63bocnp8vhwg809y) (version source revid:joerg@mysql.com-20090928090731-63bocnp8vhwg809y) (merge vers: 5.1.40) (pib:11)
[1 Oct 2009 21:21] Bugs System
Pushed into 5.0.87 (revid:joerg@mysql.com-20090928084326-z76pkkzt0jd34jco) (version source revid:joerg@mysql.com-20090928084326-z76pkkzt0jd34jco) (merge vers: 5.0.87) (pib:11)
[9 Oct 2009 8:47] Bugs System
Pushed into 6.0.14-alpha (revid:alik@ibmvm-20091009083208-0o0f0i9w1sq3c1kn) (version source revid:joerg@mysql.com-20091002141817-x2fhjck1tv5ej52o) (merge vers: 6.0.14-alpha) (pib:12)
[12 Oct 2009 15:29] Paul DuBois
Noted in 5.0.87, 5.1.40, 5.5.0, 6.0.14 changelogs.
[22 Oct 2009 7:05] Bugs System
Pushed into 5.5.0-beta (revid:alik@sun.com-20091022060553-znkmxm0g0gm6ckvw) (version source revid:alik@sun.com-20091013094238-g67x6tgdm9a7uik0) (merge vers: 5.5.0-beta) (pib:13)
[22 Oct 2009 19:30] Paul DuBois
Already noted for 5.5.0.
[18 Dec 2009 10:28] Bugs System
Pushed into 5.1.41-ndb-7.1.0 (revid:jonas@mysql.com-20091218102229-64tk47xonu3dv6r6) (version source revid:jonas@mysql.com-20091218095730-26gwjidfsdw45dto) (merge vers: 5.1.41-ndb-7.1.0) (pib:15)
[18 Dec 2009 10:43] Bugs System
Pushed into 5.1.41-ndb-6.2.19 (revid:jonas@mysql.com-20091218100224-vtzr0fahhsuhjsmt) (version source revid:jonas@mysql.com-20091217101452-qwzyaig50w74xmye) (merge vers: 5.1.41-ndb-6.2.19) (pib:15)
[18 Dec 2009 10:55] MC Brown
Added entry to 5.1.41-ndb-7.1.0
[18 Dec 2009 10:59] Bugs System
Pushed into 5.1.41-ndb-6.3.31 (revid:jonas@mysql.com-20091218100616-75d9tek96o6ob6k0) (version source revid:jonas@mysql.com-20091217154335-290no45qdins5bwo) (merge vers: 5.1.41-ndb-6.3.31) (pib:15)
[18 Dec 2009 11:06] MC Brown
Added entry to 5.1.41-ndb-6.3.31
[18 Dec 2009 11:13] Bugs System
Pushed into 5.1.41-ndb-7.0.11 (revid:jonas@mysql.com-20091218101303-ga32mrnr15jsa606) (version source revid:jonas@mysql.com-20091218064304-ezreonykd9f4kelk) (merge vers: 5.1.41-ndb-7.0.11) (pib:15)
[18 Dec 2009 11:46] MC Brown
Already documented in 5.1.41