https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78879
Bug ID: 78879 Summary: -fprofile-generate causes undefined reference to `____ilog2_NaN' Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: coolypf at qq dot com Target Milestone: --- Created attachment 40385 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40385&action=edit test case When building Linux kernel 3.10 for aarch64 with -fprofile-generate, I encountered undefined reference to `____ilog2_NaN'. Here are steps to reproduce: coolypf@experiment:~$ aarch64-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=aarch64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/aarch64-linux-gnu/6.2.1/lto-wrapper Target: aarch64-linux-gnu Configured with: ../gcc/configure --enable-languages=c --disable-threads --disable-nls --disable-tls --disable-plugin --disable-bootstrap --disable-werror --enable-cloog-backend=isl --disable-lto --enable-multiarch --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=aarch64-linux-gnu Thread model: single gcc version 6.2.1 20161221 (GCC) coolypf@experiment:~$ aarch64-linux-gnu-gcc -c -O2 test.i coolypf@experiment:~$ nm test.o | grep ilog2 coolypf@experiment:~$ aarch64-linux-gnu-gcc -c -O2 -fprofile-generate test.i coolypf@experiment:~$ nm test.o | grep ilog2 U ____ilog2_NaN Related source code location is http://lxr.free-electrons.com/source/drivers/scsi/sd.c?v=3.10#L2197