Re: Problem linking *without* avr-libc, libm, etc.

David Brown <[email protected]> Fri, 30 Apr 2021 10:03:28 +0200
Newsgroups gmane.comp.hardware.avr.gcc
Message-ID <[email protected]>
On 29/04/2021 21:43, Ian Molton wrote:
> Hi,
> 
> I'm attempting to build my project, which does not use libc, or libm,
> but I do want to link with libgcc.
> 
> additionally, I don't want any startup code to be linked - the project
> is intended to be fully standalone.
> 

If you don't use any functions from these libraries, nothing from them
will be linked into your project - it doesn't matter if the linker has them.

(I can't remember the details for the avr, but often "libm" is actually
empty, and exists only for compatibility - all the maths functions are
frequently included in the main libc.)

Sometimes (again, this is from other targets rather than the avr, which
I have not used for many years) it is useful to provide stubs of
functions like "exit()" and "atexit()" - just add these as extra empty
functions in your code.  That will ensure the library versions are not
used, and they do not pull in any other bits and pieces.