This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC 4.7.2: Mudflap linker errors


Here is the output of (gcc -v):
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/home/user/installed/gcc
--enable-languages=c,c++ --disable-multilib --disable-multiarch
--enable-checking=runtime --enable-libmudflap --enable-libgomp
--disable-bootstrap --enable-static --disable-shared
--disable-decimal-float --with-system-zlib --disable-libitm
--disable-build-poststage1-with-cxx --disable-build-with-cxx
--without-cloog --without-ppl --disable-nls --enable-threads
--enable-__cxa_atexit --with-gmp=/home/bdsatish/foss/installed/gmp
Thread model: posix
gcc version 4.7.2 (GCC)

Thanks & Regards,

On 22 September 2012 04:33, Frank Ch. Eigler <> wrote:
> bd satish <> writes:
>> [...]
>> The following piece of code, gives "undefined references" to
>> __real_malloc, __real_free, etc.:
>> Compiled with:
>> g++ -fmudflap -lmudflap
>> /lib64/libmudflap.a(mf-runtime.o): In function `__mfu_check':
>> ../libmudflap/mf-runtime.c:912: undefined reference to `__real_malloc'
>> [...]
> According to libmudflap/mf-impl.h, since you're using ordinary
> archives rather than shared libraries (-fPIC) these __real_FOO
> functions are expected to be provided by the linker:
>    (1) The static method involves a list of -wrap=foo flags being passed to
>    the linker, which then links references to "foo" to the symbol
>    "__wrap_foo", and links references to "__real_foo" to the symbol "foo".
>    When compiled without -DPIC, libmudflap.a contains such __wrap_foo
>    functions which delegate to __real_foo functions in libc to get their
>    work done.
> So, something appears wrong with this wrapping mechanism in your case.
> Can you rerun g++ with -v to see how the linker is invoked?  Perhaps
> there is something missing for the C++ static-linking case.
> - FChE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]