[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Forced Linking

From: Keith Gudger
Subject: Re: [avr-gcc-list] Forced Linking
Date: Thu, 6 Mar 2003 15:18:28 -0800 (PST)

The key to my problem is "AVR interrupt routines".  Interrupt functions
are not referenced by anything else, so the linker thinks they're not
needed.  Since the design requires the interrupts to work, the linked code
fails.  If I just include the .o file in the compile command, everything
works OK.  I don't want to do this, however.  I want the file in my
archive - I guess I'm too picky.

I already tried the -( option to fix the circular linking issues, and it
didn't work.  I now just list my archives twice:  
lib1.a lib2.a lib1.a lib2.a
and it works fine.


On Thu, 6 Mar 2003, E. Weddington wrote:

> On 6 Mar 2003 at 13:47, Keith Gudger wrote:
> > I have some AVR interrupt routines in an archive file.  When I run the
> > linker, they get left out, as nothing in my source files refers to
> > them. Obviously, the linked code doesn't work.
> > 
> > I've searched the linker manual and found no option to make it include
> > functions.  I've searched the ar and ranlib manuals to see if there's
> > a way to "flag" functions or included files as "must include".  I
> > couldn't find a way.
> > 
> > Any ideas?  Thanks.
> > 
> Looking through the ld manual, I see the --whole-archive option, but 
> that's going to slurp in the whole thing.
> If you know beforehand that when a user links in x that y should 
> always go with it, you can include both x and y in the same object 
> file before you create the archive.
> Also from personal email with you, take a look at the -( option in 
> ld. This would solve your circular reference issue with your 2 libs.
> Anyway, why do you need to link a function when it isn't being 
> referenced in the code?
> Eric Weddington

reply via email to

[Prev in Thread] Current Thread [Next in Thread]