Avoid 'multiple definition' error during linking?
Wed Jul 19 12:19:00 GMT 2000
Do I need to rebuild the compiler with those options, or just use them when building my project?
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
> This only works for statically linked executables, but the size saving can
> be considerable.
> 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 firstname.lastname@example.org
More information about the crossgcc