public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Increase in code size for c++ applications using GCC-4.4.1
@ 2009-08-27 20:10 Suma Sharma
  2009-08-28 17:29 ` Ian Lance Taylor
  0 siblings, 1 reply; 3+ messages in thread
From: Suma Sharma @ 2009-08-27 20:10 UTC (permalink / raw)
  To: gcc-help

Hi,
I have built two toolchains for the H8 target. 
H8-Toolchain-I was built using the following source versions:
GCC-4.4.1
Newlib-1.17.0

H8-Toolchain-II was built using the following:
GCC-4.3.3
Newlib-1.16.0

While doing benchmarking of the above two toolchains (for C++ application) it was observed that the size of the text section for H8-Toolchain-I had increased by approximately 66% as compared to that of H8-Toolchain-II.

In order to narrow down my focus of investigation, I built another toolchain with the following source versions:
GCC-4.4.1
Newlib-1.16.0
This too exhibited behaviour similar to H8-Toolchain-I.

Therefore, it seems that this issue is mainly due to GCC.

In order to check if it was specific to H8 target, I built similar toolchains for SH as well.
The SH toolchain with GCC-4.4.1 showed similar behaviour as the H8-Toolchain-I.

I tried compiling the test case with different optimization options ("O1", "O2", "O3" and "Os") and also with the option "--gc-sections" to linker. The "-gc-sections" option did help but not to a great extent.

Could anyone point out as to what changes in GCC are leading to such increase in code size?
Also could anyone suggest if there are any options that could be enabled / disabled in GCC-4.4.1 in order to reduce code size?

Any help will be highly appreciated.

Regards,
Suma Sharma


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Increase in code size for c++ applications using GCC-4.4.1
  2009-08-27 20:10 Increase in code size for c++ applications using GCC-4.4.1 Suma Sharma
@ 2009-08-28 17:29 ` Ian Lance Taylor
  2009-09-01 14:56   ` Suma Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2009-08-28 17:29 UTC (permalink / raw)
  To: Suma Sharma; +Cc: gcc-help

Suma Sharma <Suma.Sharma@kpitcummins.com> writes:

> While doing benchmarking of the above two toolchains (for C++
> application) it was observed that the size of the text section for
> H8-Toolchain-I had increased by approximately 66% as compared to that
> of H8-Toolchain-II.

I don't know what your test case is, but my first guess would be that
this is due to changes in the inliner.  If code size is of primary
concern, you should compile with -Os.  If it is only secondary, then use
-O2 and experiment with -finline-limit=NNN.

Ian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Increase in code size for c++ applications using GCC-4.4.1
  2009-08-28 17:29 ` Ian Lance Taylor
@ 2009-09-01 14:56   ` Suma Sharma
  0 siblings, 0 replies; 3+ messages in thread
From: Suma Sharma @ 2009-09-01 14:56 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: gcc-help

Hi,
Thank you for your suggestions.

> I don't know what your test case is,
We do understand this but unfortunately we cannot disclose the test case.

> If code size is of primary
> concern, you should compile with -Os.
We did try compiling with "-Os" option but it was of no help. The size of the text section remained the same.

> experiment with -finline-limit=NNN.	
This too wasn't much of a help to us.

Regards,
Suma Sharma

-----Original Message-----
From: Ian Lance Taylor [mailto:iant@google.com] 
Sent: Friday, August 28, 2009 7:43 PM
To: Suma Sharma
Cc: gcc-help@gcc.gnu.org
Subject: Re: Increase in code size for c++ applications using GCC-4.4.1

Suma Sharma <Suma.Sharma@kpitcummins.com> writes:

> While doing benchmarking of the above two toolchains (for C++
> application) it was observed that the size of the text section for
> H8-Toolchain-I had increased by approximately 66% as compared to that
> of H8-Toolchain-II.

I don't know what your test case is, but my first guess would be that
this is due to changes in the inliner.  If code size is of primary
concern, you should compile with -Os.  If it is only secondary, then use
-O2 and experiment with -finline-limit=NNN.

Ian


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-01 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-27 20:10 Increase in code size for c++ applications using GCC-4.4.1 Suma Sharma
2009-08-28 17:29 ` Ian Lance Taylor
2009-09-01 14:56   ` Suma Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).