From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: "Fāng-ruì Sòng" <maskray@google.com>
Cc: Fangrui Song via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang
Date: Sat, 31 Jul 2021 08:41:21 +0200 [thread overview]
Message-ID: <87a6m3vvce.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAFP8O3LLHUWDgq3pZLmS5MLDU2fq9pZniAOmOzQJ5VJ1vG=COQ@mail.gmail.com> ("Fāng-ruì Sòng"'s message of "Fri, 30 Jul 2021 23:34:09 -0700")
* Fāng-ruì Sòng:
> 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: *; };
We currently generate this:
GLIBC_2.2.5 {
global:
__malloc_hook;
__memalign_hook;
__realloc_hook;
calloc;
free;
mallinfo;
malloc;
malloc_get_state;
malloc_set_state;
malloc_stats;
malloc_trim;
malloc_usable_size;
mallopt;
mcheck;
mcheck_check_all;
mcheck_pedantic;
memalign;
mprobe;
mtrace;
muntrace;
posix_memalign;
pvalloc;
realloc;
valloc;
local:
*;
};
See libc_malloc_debug.map in the build tree.
Thanks,
Florian
next prev parent reply other threads:[~2021-07-31 6:41 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 3:57 [PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang Fangrui Song via Libc-alpha
2021-07-26 3:58 ` [PATCH 1/3] elf: Replace .tls_common with .tbss definition Fangrui Song via Libc-alpha
2021-07-29 14:26 ` H.J. Lu via Libc-alpha
2021-07-29 16:21 ` Fangrui Song via Libc-alpha
2021-07-26 3:58 ` [PATCH 2/3] elf: Skip tst-auditlogmod-* if the linker doesn't support --depaudit Fangrui Song via Libc-alpha
2021-07-29 14:23 ` H.J. Lu via Libc-alpha
2021-07-29 16:28 ` Fangrui Song via Libc-alpha
2021-07-26 3:58 ` [PATCH 3/3] configure: Allow LD to be LLD 13.0.0 or above Fangrui Song via Libc-alpha
2021-07-28 18:02 ` [PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang H.J. Lu via Libc-alpha
2021-07-28 21:52 ` Fangrui Song via Libc-alpha
2021-07-29 14:45 ` H.J. Lu via Libc-alpha
2021-07-30 7:57 ` Florian Weimer via Libc-alpha
2021-07-31 6:34 ` Fāng-ruì Sòng via Libc-alpha
2021-07-31 6:41 ` Florian Weimer via Libc-alpha [this message]
2021-08-02 20:55 ` Fāng-ruì Sòng via Libc-alpha
2021-08-02 4:02 ` Siddhesh Poyarekar
2021-08-02 4:23 ` Siddhesh Poyarekar
2021-08-08 16:50 ` Fāng-ruì Sòng via Libc-alpha
2021-08-08 2:54 ` Fāng-ruì Sòng via Libc-alpha
2021-08-08 16:45 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a6m3vvce.fsf@oldenburg.str.redhat.com \
--to=libc-alpha@sourceware.org \
--cc=fweimer@redhat.com \
--cc=maskray@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).