It is likely that your glibc config.h values differ based on which compiler you are using and it's the combination of symbol features that get used with the problematic compile that tickles the ld bug.