Re: gcov fails to work with shared library on 64bit platform

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mu Qiao <qiaomuf@xxxxxxxxx> writes:

> I have a C++ shared library project. When I add "--coverage" to
> CXXFLAGS(I also added -g and -O0) and LDFLAGS, the project fails to
> compile, here's the error message:
>
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/../../../../x86_64-pc-linux-gnu/bin/ld:
> .libs/variable_printer: hidden symbol `atexit' in
> /usr/lib64/libc_nonshared.a(atexit.oS) is referenced by DSO
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.2/../../../../x86_64-pc-linux-gnu/bin/ld:
> final link failed: Nonrepresentable section on output
> collect2: ld returned 1 exit status
> make[1]: *** [variable_printer] Error 1

The linker message is not very helpful in that it doesn't tell us where
the hidden symbol is referenced from.  At a guess, the reference is from
your C++ shared library.  You can verify that by using "readelf -r" and
"readelf -s" on the shared library and looking for atexit.  If you find
it there as an undefined symbol, then what is the command that you use
to build your shared library?

> I tried with
> "configure --disable-shared" and it worked for us. But I don't know
> the reason of the above error and can't be sure if --disable-shared is
> the correct solution.

Which configure script do you mean here?  The gcc configure script or
yours?

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux