This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: unused functions removal of gcc toolchain?


Actually, I have seen some traces of the feature that you are looking
for in the gcc documentation.  However, I was unable to make it work, as
it does not seem to:).  A good idea would be to look into source code
for gcc and linker to see if there is anything there.  I know that hp-ux
linker eliminates unreferenced functions:

+O[no]procelim Enable [disable] the elimination of procedures
                          that are not referenced by the application.
			  The default is +Onoprocelim.  Procedure elimination
                          can occur at any optimization level, including
                          level 0.  For more details refer to the +help
                          option or the HP-UX Linker and Libraries 			 
User's Guide manual.

Here is what I found for gcc linker:

 -O                          Optimize output file

That came out of --help for ldarm 2.9 modified by Wind River, although
based upon some pre 2.96 version of normal ldarm.  Anyway, wind river,
had no answer in regards of what that options actually does, and ldarm
2.79 marks this option as ignored.  So, may be it is not what I think it
is, however, could be worth exploring.

At this point, we are also looking to eliminate 'dead wood' from our
code.  Current idea is to write a set of scripts to parse libs and map
files and re-engineer the linking tree, and therefore to eliminate all
function calls (and globals) that are not referenced and then spilt
those objects files, and eliminate these symbols.

Sergey




On Wed, 2001-10-10 at 04:20, David Korn wrote:
> >-----Original Message-----
> >From: SungKunCho [mailto:s-kcho@hanmail.net]
> >Sent: 10 October 2001 00:43
> 
> 
> >Hi,
> >
> >Does gcc toochain have "unreferenced functions(not unused virtual
> >functions) removal" feature?(any options etc)
> >It seems like if gcc toolchain provides this feature, 
> >oversized C++ code
> >could be reduced.
> >In my case, due to the link of unnecessary functions, C++ 
> >executable image
> >is oversized. It looks like this problem is partially resolved 
> >if class is redefined and big object codes are divided to smaller ones.
> 
>   This is usually done by making a library archive file (.a) which contains
> each function in a separate .o module.  The linker only pulls the .o files
> that contain symbols that are referenced into the final executable.
> 
>   You might be able to approximate a solution to this problem by combining
> the -ffunction-sections argument of gcc with the --gc-sections option for
> ld, but this apparently doesn't work on all targets.  Check the docs for
> gcc and ld to see how these switches work.
> 
> 
>      DaveK
> -- 
> Burn your ID card!  http://www.optional-identity.org.uk/
> Help support the campaign, copy this into your .sig!
> 
> 
> **********************************************************************
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> the system manager.
> 
> This footnote also confirms that this email message has been swept by
> MIMEsweeper for the presence of computer viruses.
> 
> www.mimesweeper.com
> **********************************************************************
> 
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com



------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]