This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: object file splitting for space optimization


> Date: Mon, 29 Jan 2001 12:53:26 -0800 (PST)
> From: Ian Thompson <iant@CS.Stanford.EDU>

> i have an object file that is a little over 1k in size, but i'm only
> using one function in it (which is maybe 100 bytes).  the problem is
> -- how can i link in that object file but have the extra code
> removed?  i've tried using the -Os flag, which didn't help much.
> the problem can easily be solved with ifdefs or manually splitting
> up the object, but i was wondering if there was a more elegant way
> to do it.  i'm using gcc 2.96 and cross-compiling for 32-bit mips.

You might be able to use -ffunction-sections, and then objcopy to
remove all the sections you don't want.  If you are using the GNU
linker, you can try and use --gc-sections to discard the unused
sections.

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