Hello, I have some problems with profiling. I have compiled and
installed newlib.
cd objdir/
../newlib-1.17.0/configure --disable-multilib --with-newlib
--prefix=<installdir>
make
make install
Then I compile my programs with:
/opt/gcc-4.4.1/lib/gcc -nostdlib
<installdir>/i686-pc-linux-gnu/lib/crt0.o HelloWorld.c -I
<installdir>/i686-pc-linux-gnu/include -L
<installdir>/i686-pc-linux-gnu/lib -lc -lm -o Helloworld
So far everything works fine. But when I add the parameter
-fprofile-arcs to gcc, I get this error:
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `gcov_version':
<gccSrcDir>/libgcc/../gcc/libgcov.c:141: undefined reference to `stderr'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `__gcov_open':
<gccSrcDir>/libgcc/../gcc/gcov-io.c:92: undefined reference to
`__errno_location'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `fstat':
/usr/include/sys/stat.h:467: undefined reference to `__fxstat'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `gcov_exit':
<gccSrcDir>/libgcc/../gcc/libgcov.c:461: undefined reference to `stderr'
<gccSrcDir>/libgcc/../gcc/libgcov.c:323: undefined reference to `stderr'
<gccSrcDir>/libgcc/../gcc/libgcov.c:524: undefined reference to `stderr'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `create_file_directory':
<gccSrcDir>/libgcc/../gcc/libgcov.c:111: undefined reference to
`__errno_location'
<gccSrcDir>/libgcc/../gcc/libgcov.c:113: undefined reference to `stderr'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `gcov_exit':
<gccSrcDir>/libgcc/../gcc/libgcov.c:312: undefined reference to `stderr'
/opt/gcc-4.4.1/lib/gcc/i686-pc-linux-gnu/4.4.1/libgcov.a(_gcov.o): In
function `gcov_version':
<gccSrcDir>/libgcc/../gcc/libgcov.c:141: undefined reference to `stderr'
collect2: ld returned 1 exit status
It's like libgcov.a uses libc, but libc in newlib doesn't contain these
references. But I know that stderr is in libc, because I have used it in
my program and it works fine. I get the same errors when I use my built
in gcc, so I haven't done anything special with my gcc. Is there anyway
to use fprofile-arcs with newlib?