Hello,
first of all I hope this is not a duplicated topic; I have searched before posting, but I may have missed something.
I'm using ChibiStudio preview 20, and the reported behaviour is valid both for GCC 5.4 and GCC 7.0.
If I do not include in the Makefile a particular source file of my project that, for example, contains declaration and definition of funcion foo(), at compile time I get the warning:
src/main.c:214:44: warning: implicit declaration of function 'foo' [-Wimplicit-function-declaration]
and this is reasonable, since no declaration is found
However, at link-time ld does not complain at all.
Is there any option for gcc or ld that can be passed in order to have the linking phase exit with an error in case of unresolved symbols (or, alternatively, to print out a list of all unresolved symbols) ?
Thank you in advance.
Alberto
How to make ld generate error on missing symbols
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: How to make ld generate error on missing symbols
Hi,
It is because garbage collector, unreferenced symbols are removed, so the function that refers the undefined symbol is removed because not called anywhere.
You can disable GC in makefile.
Giovanni
It is because garbage collector, unreferenced symbols are removed, so the function that refers the undefined symbol is removed because not called anywhere.
You can disable GC in makefile.
Giovanni
Who is online
Users browsing this forum: No registered users and 3 guests