This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: ld includes entire archive (.a) when compiling .elf file
On Fri, Mar 10, 2006 at 05:29:25PM -0500, Daniel Jacobowitz wrote:
> On Fri, Mar 10, 2006 at 04:57:26PM -0500, Josh Keller wrote:
> > I can't figure out what to do. I have tried the --gc-sections option
> > and the --no-whole-archive option but I still get a really large
> > executable. I created my archive from .o files using
> > arm-elf-ar -rcv libucos_ii.a $(OBJS).
> >
> > I can't seem to figure out a good solution. Any ideas? I'd rather not
> > create an archive file for each .o file (which sort of defeats the
> > purpose of having a .a file) Thanks for the help!
>
> Please try using the -Map option to ld (-Wl,-Map,filename if you're
> using GCC). That will tell you why each file is pulled in.
BTW, I see that you were using GCC; --no-whole-archive probably doesn't
get to LD, nor --gc-sections. You have to use -Wl for those options.
But --whole-archive should be the default anyway.
--
Daniel Jacobowitz
CodeSourcery