without -flto or without -O2 produce good (expected) result: ================================ configure:5332: checking for dlsym configure:5369: clang -o conftest -O2 -pipe -march=ivybridge -O2 -pipe conftest.c >&5 /tmp/conftest-597c62.o:conftest.c:function main: error: undefined reference to 'dlsym' clang-3.9: error: linker command failed with exit code 1 (use -v to see invocation) configure:5372: $? = 1 configure: failed program was: #line 5338 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char dlsym (); below. */ #include <assert.h> /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char dlsym (); char (*f) ();
int main () { /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined (__stub_dlsym) || defined (__stub___dlsym) choke me #else f = dlsym; /* workaround for ICC 12.0.3 */ if (f == 0) return 1; #endif ; return 0; } ================================ with both -flto and -O2 produce bad result (tested with clang and gcc), this is reproduced when i build ncurses which have strange configure script built with many workaround, unlike other configure script ================================ configure:5332: checking for dlsym configure:5369: clang -o conftest -flto -O2 -pipe -march=ivybridge -O2 -pipe conftest.c >&5 configure:5372: $? = 0 configure:5375: test -s conftest configure:5378: $? = 0 configure:5388: result: yes ================================ _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils