I got an embedded project for cortex-m0+ and I would like to link with newlib-nano library. I'm learning, how things work (that you need to implement stubs for certain functions etc.). I've managed to create a working example which builds.
Source code:
int main(void)
{
uint32_t i = 0;
printf("Hello Wordl!");
while (1)
{
i += 1;
}
}
I was curious, which functions get invoked, to peek behind the scene a bit so I made a dump of the final elf file and to my surprise, the code invokes "iprintf" instead of printf.
However, I failed to locate, where the iprintf get's mapped to printf. I would expect some macro in the headers or so, but I'm not able to locate it.
Could anyone explain what is happening or direct me, where to find this "mapping"?
Thx a lot
At https://github.com/32bitmicro/newlib-nano-1.0/blob/master/newlib/libc/stdio/printf.c
iprintf
is an alias forprintf
:The nano
printf()
does not have floating-point support, so theiprintf()
variant is the same function whereas in full Newlib, they would be distinct implementations.Since they refer to the same implementation, whether your elf dump emits
iprintf
orprintf
as a matching symbol is perhaps arbitrary and possibly non-deterministic - that is a question about the how the linker symbol table is formed and perhaps the behaviour ofobjdump
ornm
whatever you used. They are simply different names for the same thing.