Modifying Newlib-nano library

Asked by Joel Rose on 2018-03-07


I am struggling to understand the build process for newlib and newlib-nano. I can see the build-toolchain script has a unique configuration for nano, but I don't see how that controls which sources / objects end up in the libc_nano.a output.

For example, fnmatch.c is in the src/newlib/newlib/libc/posix/, but not in the nano library.

How is this controlled? Is there a rule that prevents some files from from being built, or are they stripped from the output?

Apologies if this seems naive, I'm new to the GNU toolchain -- though I have been doing embedded devlopment for 15+ years with commercial IDE/compiler and pre-built target libraries.

Kind Regards,

Question information

English Edit question
GNU Arm Embedded Toolchain Edit question
No assignee Edit question
Last query:
Last reply:
Tejas Belagod (belagod-tejas) said : #1

Hi Joel,

I'm curious to know how this information may be of use to you?

What the special config options do is define autoconfig and preprocesssor symbols that cause files to be excluded and parts of headers to be included. This is not obvious from the Makefile(s), you'll need to dive into the newlib/config* files to discover.


Joel Rose (thejoel) said : #2

Ah, another layer to the onion! Perhaps I'll poke around in there.

I suppose I should have been clear about my end goal. I am actually looking to use fnmatch() in an embedded application, (currently built with the nano libs). I think I was more confused about the process because we have another, very similar product using it. I was trying to understand if I had to rebuild the libraries to get it -- turns out he copy / pasted that function from the gnu source file!

Anyways, I know the high-level options for nano (in are documented, but I couldn't find an explicit list of what modules are removed from glibc -> newlib -> newlib-nano. I think this would extremely helpful.

In the short term, I can duplicate the fnmatch code in my project. However, being able to re-build the libraries and control what modules are included would be very helpful for future tweaks.

Thanks for your time,

Can you help with this problem?

Provide an answer of your own, or ask Joel Rose for more information if necessary.

To post a message you must log in.