[PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang
Fāng-ruì Sòng
maskray@google.com
Sat Jul 31 06:34:09 GMT 2021
On Fri, Jul 30, 2021 at 12:57 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Fangrui Song via Libc-alpha:
>
> > For malloc/tst-compathooks-on,
> >
> > malloc/tst-compathooks-on: Symbol `__free_hook' has different size in shared object, consider re-linking
> >
> > the root cause is that lld's symbol versioning is different from GNU ld in an unusal case:
> >
> > __asm__ (".symver " "__free_hook" "," "__free_hook" "@" "GLIBC_2.2.5");
> >
> > This leaves two symbols __free_hook and __free_hook@GLIBC_2.2.5.
> > __free_hook is then attached a default version GLIBC_2.2.5.
> > I think malloc/malloc-debug.c uses a fragile versioned symbol here.
> > If the inline asm uses @@ the failure should go away.
>
> But we want to produce a compat symbol here. With the current version
> scripts, BFD ld will not export a symbol unless it is listed in the
> version script. That is, if I remove __free_hook from libc_malloc_debug
> in malloc/Versions, I get an ABI check failure:
>
> --- ../sysdeps/unix/sysv/linux/x86_64/64/libc_malloc_debug.abilist 2021-07-27 16:14:51.516781791 +0200
> +++ …/malloc/libc_malloc_debug.symlist 2021-07-30 09:55:09.818875449 +0200
> @@ -3 +2,0 @@ GLIBC_2.16 aligned_alloc F
> -GLIBC_2.2.5 __free_hook D 0x8
>
> If this works with a linker, it appears to ignore “local: *;” in version
> nodes for versioned symbols. That looks like a linker bug.
>
> Thanks,
> Florian
>
I have a comment on https://sourceware.org/bugzilla/show_bug.cgi?id=23328#c6
How does removing __free_hook from malloc/Versions break the ABI check test?
% cat a.s
.symver __free_hook, __free_hook@GLIBC_2.2.5
.globl __free_hook
__free_hook:
nop
% cat a.ver
GLIBC_2.2.5 {}; /* should not list the non-default version __free_hook */
local { local: *; };
% cc -c a.s
% ld.bfd -shared --version-script=a.ver a.o -o a.so
% readelf -W --dyn- a.so | grep free_hook
3: 0000000000001000 0 NOTYPE GLOBAL DEFAULT 7
__free_hook@GLIBC_2.2.5
One non-default version symbol, as expected.
More information about the Libc-alpha
mailing list