help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

g++ produces large executables on AIX 5.2


From: David
Subject: g++ produces large executables on AIX 5.2
Date: Wed, 17 Jun 2009 07:41:08 -0700 (PDT)
User-agent: G2/1.0

Hi

I'm working with gcc 3.3.2 on AIX 5.2, and I am finding that even the
simplest peices of code compiled with g++ produce verge large
executables, in comparison to both the IBM Visual Age (v6) compiler
and the same version of g++ on other platforms. Given the following
simple app, test.cpp:


#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
        cout << "Hello" << endl;
}


If I compile this twice, using g++ and xlC:

-rwxr-xr-x   1 david    staff       1120169 Jun 17 14:38 g++.out
-rwxr-xr-x   1 david    staff         61883 Jun 17 14:39 xlC.out

The g++ version comes in at over 1Mb, eighteen times larger than the
xlC version. The output from size is:

g++.out: 471994(.text) + 118814(.data) + 44(.bss) + 77809(.loader) =
668661
xlC.out: 25906(.text) + 1930(.data) + 12(.bss) + 4967(.loader) = 32815

Compiling the same code with gcc 3.3 on Linux comes in at about 6kB,
on HPUX at about 25kB.

I understand that AIX is a very different platform to Linux and other
UNIXes, and that shared libraries especially work in a very different
way. That said, should g++ be producing executables that are so much
bigger? Is there some issue with the way the g++ is calling the linker
perhaps? (g++ is configured to use the AIX ld, I've checked).

Note that the resulting code works fine - there's no issue there. What
I'm concerned about is that the large size suggests something is not
optimized correctly and that the resulting code will be inefficient in
a real application.

Any ideas? Thanks....


reply via email to

[Prev in Thread] Current Thread [Next in Thread]