avr-libc-dev
[Top][All Lists]
Advanced

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

Re: [avr-libc-dev] Selective Construction


From: E. Weddington
Subject: Re: [avr-libc-dev] Selective Construction
Date: Tue, 25 May 2004 17:17:44 -0600

On 18 May 2004 at 18:05, Bruce Graham wrote:

> Kreyl,
> 
> The question I think you are asking is..."At compile time, among the
> modules(files)  I have written, can the compiler know which functions
> from the different modules(files) will be required in the final build."
> In general the answer is NO, because each module (file)  is treated by
> the compiler as a separate entity.  The last stage in building an
> application is called "linkage editing" or "linking".  The linkage
> editor takes all the modules(files) which have been compiled, resolves
> all the references to code and data that it can, THEN it assumes that
> any remaining references must belong to LIBRARY functions.  It is this
> process of selecting only the required LIBRARY functions from a library
> file that you may be thinking of.
> 
> For your UART example.  If you compile the UART functions and place them
> in a library file similar to the ones which contain functions from the
> standard libraries then I think you can get the behavior that you want.
> 
> Someone else needs to weigh in because I've only been here a week.  Can
> we make our own libraries and tell the linker to use them either BEFORE
> or AFTER the standard libraries?
> 

IIRC, the linker will link them in "command-line order". If you put your custom 
library before the standard library, then your custom functions should be 
linked in first.

The usual authority on this issue is to look at the relevant user manual, in 
this case the GNU ld user manual.

Eric




reply via email to

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