gold vs ld-bfd mismatch on --wrap=
Tristan Gingold
gingold@adacore.com
Wed Sep 14 15:10:00 GMT 2016
Hello,
an incompatibility between gold and ld-bfd is visible on this stackoverflow hack:
http://stackoverflow.com/questions/8823267/linking-against-older-symbol-version-in-a-so-file
(in a short:
asm (".symver memcpy, memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
and link with --wrap=memcpy)
This works with ld-bfd, but not with gold. The reason is that gold wraps the symbols for all versions, so the call to memcpy becomes a call to __wrap_memcpy which results in an infinite recursion.
The presence of a comment in symtab.cc:add_from_object looks like this is an intentional decision.
Is it really the case ?
Does it make sense to follow more closely ld-bfd and to wrap only symbols without version ?
Regards,
Tristan.
More information about the Binutils
mailing list