This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

gold vs ld-bfd mismatch on --wrap=


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.


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