From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-1.6 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FSL_HELO_FAKE, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,URIBL_BLACK shortcircuit=no autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 07D031F8C6 for ; Mon, 2 Aug 2021 20:55:59 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 423E03838012 for ; Mon, 2 Aug 2021 20:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 423E03838012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1627937758; bh=KakWV4OIhDrL/vWJtZWPjEpnNlcmw1WxZ5MNI+FoChk=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=UCKQJzzTlYCUaZgZ74We/VdoRQ4rC4qOXUyxFD99YwP29qFiDNcP0SmYoupJuhwus MMC0KaA7Cz1WnAbAQQ6nKEt0wh9156hoBqMAjZ3/cD+MItovmuFhoeDYulC3X7Gmlb c6agiy7waSbMt60RAjQI0vELQDJ5eS57TXl0eJ8E= Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id 182FC3853800 for ; Mon, 2 Aug 2021 20:55:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 182FC3853800 Received: by mail-pl1-x62b.google.com with SMTP id k1so21095820plt.12 for ; Mon, 02 Aug 2021 13:55:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=KakWV4OIhDrL/vWJtZWPjEpnNlcmw1WxZ5MNI+FoChk=; b=pc+y/3KYMr1gIzHnudeE32Q/TLcL7crfXe7QOg7/GuP3Kq0hpTlT6Cs+MSlEifHLfC c7fwPxgvVnlytBsclOmyW2su7w4KF6D5zCvZQq3tVazVkexmZyL4nzBLHrKO7Epj7n6J Uegu4TzXjA/LCkhIBESOBlfIBF3mJQrWfVcp3NnroOM6Zju7g4g9P/aA5j+zsGPhATsX y3IEQeMefxTqOe0k7MYSMuj1E6BjUGkzFnOX8iDhLG8CnzoHBlUOfQMQkENwugm8UTtV /7I8fPl9K5QYeu9rVVepy2he/f53PPIDDsaHgjzKnBqVi5IiK1AEQslPbetMDxfVkrFd nGaw== X-Gm-Message-State: AOAM532LqK3qnqbGA/Afr70AeRhnsWSIXwbNjfZ5VfdKVBjVwZc620bK Rl3SLlg9KVzMjCILfHsP668CmA== X-Google-Smtp-Source: ABdhPJwAEUQ7VKxoznhxikv30zrIVkRZRBJ1EHMMgvlKKxeOvhSr8qB8FdxgAFVdYDYs7m0DI82w5w== X-Received: by 2002:a17:90b:33c5:: with SMTP id lk5mr734812pjb.129.1627937738036; Mon, 02 Aug 2021 13:55:38 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:8e5a:cd3e:9a6e:ad84]) by smtp.gmail.com with ESMTPSA id s3sm13012827pfk.61.2021.08.02.13.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Aug 2021 13:55:37 -0700 (PDT) Date: Mon, 2 Aug 2021 13:55:32 -0700 To: Florian Weimer Subject: Re: [PATCH 0/3] Allow LLD 13.0.0 and improve compatibility with gold and clang Message-ID: <20210802205532.75s4epdjdwu7z6rc@google.com> References: <20210726035802.275992-1-maskray@google.com> <87o8akz12h.fsf@oldenburg.str.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: =?utf-8?q?F=C4=81ng-ru=C3=AC_S=C3=B2ng_via_Libc-alpha?= Reply-To: =?utf-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Cc: Fangrui Song via Libc-alpha Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 2021-07-30, Fāng-ruì Sòng wrote: >On Fri, Jul 30, 2021 at 12:57 AM Florian Weimer 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. I'll implement the behavior in https://reviews.llvm.org/D107234 and https://reviews.llvm.org/D107235 ld.lld linked libc.so has exactly the same set of non-SHN_ABS dynamic symbols as ld.bfd linked libc.so. (ld.bfd places version nodes into SHN_ABS symbols but they are unused by ld.so)