$ cat /tmp/testa.c inline int isalnum(int _c) { return 1; } inline int _isalnum(int _c) { return 1; } $ /opt/local/bin/gcc-mp-4.8 -c /tmp/testa.c -o /tmp/test.o -std=c99 $ nm /tmp/test.o 0000000000000010 s EH_frame1 0000000000000000 T _isalnum --- isalnum is being emitted with external linkage even though it is inline and never declared as 'extern inline' It looks like gcc may have implicit extern declarations for some functions which is forcing this 'inline' definition to be treated asn an 'extern inline' definition.
Yes, I think this is a bug. But I suppose that nm output mentioned isalnum, not _isalnum.
Yes, I get: manuel@gcc10:~$ nm test.o 0000000000000000 T isalnum and with: ~/test1/216257/build/gcc/xgcc -B ~/test1/216257/build/gcc/ -std=c99 test.c -c -o test.o -fno-builtin-isalnum I get nothing. Thus the analysis seems right but not sure how to fix it.
On OSX, the _isalnum symbol corresponds to the isalnum() function and the __isalnum symbol would correspond to the _isalnum() function. It is emitting the _isalnum symbol (for isalnum()) but not the __isalnum symbol (because _isalnum() is being inlined). I suspect you seeing an isalnum symbol is because you're on a different platform that does not _-prefix.
The implicit builtin FUNCTION_DECL should have UNKNOWN_LOCATION or BUILTIN_LOCATION, so should be easy to differentiate from explicit user extern decl. Just it is important that when an inline without extern is merged with the implicit decl that the result doesn't look like user extern inline or user extern decl followed by inline decl.