This is the mail archive of the
mailing list for the binutils project.
gold vs ld-bfd mismatch on --wrap=
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Wed, 14 Sep 2016 17:09:56 +0200
- Subject: gold vs ld-bfd mismatch on --wrap=
- Authentication-results: sourceware.org; auth=none
an incompatibility between gold and ld-bfd is visible on this stackoverflow hack:
(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 ?