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

See the CrossGCC FAQ for lots more infromation.


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

Re: Avoid 'multiple definition' error during linking?


Do I need to rebuild the compiler with those options, or just use them when building my project?

Thanks
Chris

Jonathan Larmour wrote:

> Christopher Bahns wrote:
> >
> > Do you suppose this is why I'm having my size problems? I had some posts a few days ago about the 14% increase in my program's size when going from
> > Microtec Research's (MRI) M68K compiler to GNU's. This increase put me over the limit in my flash memory and now we may have to do something funky to get
> > the program to work under GNU. Maybe in the end the size increase with GNU will actually prevent us from converting over to it, which would be a bit
> > unfortunate.
> >
> > I don't know if I'm pulling in unused functions from object files that have at least one function that I am using, but now I suspect I might be (perhaps
> > MRI's engineers just did a better job of optimizing their code.....).
>
> GNU does support removal of unused functions. Compile with
> -ffunction-sections -fdata-sections (and with g++ also -fvtable-gc). And
> then invoke GNU ld with --gc-sections. If using gcc to invoke the linker
> (as you should be) this is done by using -Wl,--gc-sections on the link
> line.
>
> This only works for statically linked executables, but the size saving can
> be considerable.
>
> Jifl
> --
> Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
> "Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault
>
> ------
> Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
> Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
begin:vcard 
n:Bahns;Christopher
tel;home:812-342-4714
tel;work:812-342-4714
x-mozilla-html:FALSE
adr:;;;;;;
version:2.1
email;internet:chris@bahns.com
fn:Christopher Bahns
end:vcard

------
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]