This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: object file splitting for space optimization
- To: iant at CS dot Stanford dot EDU
- Subject: Re: object file splitting for space optimization
- From: Mike Stump <mrs at windriver dot com>
- Date: Mon, 29 Jan 2001 16:15:29 -0800 (PST)
- Cc: gcc at gcc dot gnu dot org
> 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.