From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from aye.elm.relay.mailchannels.net (aye.elm.relay.mailchannels.net [23.83.212.6]) by sourceware.org (Postfix) with ESMTPS id 9384B3987C08 for ; Fri, 22 Jan 2021 01:25:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 9384B3987C08 X-Sender-Id: dreamhost|x-authsender|tuliom@ascii.art.br Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 7C1094022EA; Fri, 22 Jan 2021 01:25:33 +0000 (UTC) Received: from pdx1-sub0-mail-a50.g.dreamhost.com (100-96-11-10.trex.outbound.svc.cluster.local [100.96.11.10]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 5CCB940130B; Fri, 22 Jan 2021 01:25:32 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|tuliom@ascii.art.br Received: from pdx1-sub0-mail-a50.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/6.0.1); Fri, 22 Jan 2021 01:25:32 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|tuliom@ascii.art.br X-MailChannels-Auth-Id: dreamhost X-Occur-Eight: 53b0c0997f83c2f5_1611278732715_1461585174 X-MC-Loop-Signature: 1611278732715:2545327240 X-MC-Ingress-Time: 1611278732715 Received: from pdx1-sub0-mail-a50.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a50.g.dreamhost.com (Postfix) with ESMTP id 2525B7F624; Thu, 21 Jan 2021 17:25:32 -0800 (PST) Received: from ascii.art.br (ip-187-73-0-157.isp.valenet.com.br [187.73.0.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: tuliom@ascii.art.br) by pdx1-sub0-mail-a50.g.dreamhost.com (Postfix) with ESMTPSA id 5610E82F91; Thu, 21 Jan 2021 17:25:30 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a50 From: Tulio Magno Quites Machado Filho To: Szabolcs Nagy , libc-alpha@sourceware.org Subject: Re: [PATCH v5 7/7] Make libc symbols hidden in static PIE In-Reply-To: References: User-Agent: Notmuch/0.31.3 (http://notmuchmail.org) Emacs/27.1 (x86_64-redhat-linux-gnu) Date: Thu, 21 Jan 2021 22:25:27 -0300 Message-ID: <87y2gl3gqg.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org 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: , X-List-Received-Date: Fri, 22 Jan 2021 01:25:36 -0000 Szabolcs Nagy via Libc-alpha writes: > Hidden visibility can avoid indirections and RELATIVE relocs in > static PIE libc. > > The check should use IS_IN_LIB instead of IS_IN(libc) since all > symbols are defined locally in static PIE and the optimization is > useful in all libraries not just libc. However the test system > links objects from libcrypt.a into dynamic linked test binaries > where hidden visibility does not work. I think mixing static and > shared libc components in the same binary should not be supported > usage, but to be safe only use hidden in libc.a. > > On some targets (i386) this optimization cannot be applied because > hidden visibility PIE ifunc functions don't work, so it is gated by > NO_HIDDEN_EXTERN_FUNC_IN_PIE. > > From -static-pie linked 'int main(){}' this shaves off 71 relative > relocs on aarch64 and reduces code size by about 2k. After this patch got merged, I noticed that malloc/tst-malloc-stats-cancellation never returns on ppc (32-bit only). It seems stuck in a futex_wait: #0 0x6fddab58 in futex_wait (private=0, expected=2, futex_word=0x6ff405ec ) at ../sysdeps/nptl/futex-internal.h:146 #1 __lll_lock_wait_private (futex=0x6ff405ec ) at ./lowlevellock.c:35 #2 0x6fde3614 in __GI___libc_malloc (bytes=bytes@entry=4096) at malloc.c:3235 #3 0x6fdbf7f0 in __GI__IO_file_doallocate (fp=0xf7dc01a0) at filedoalloc.c:101 #4 0x6fdd6c20 in __GI__IO_doallocbuf (fp=0xf7dc01a0) at libioP.h:948 #5 __GI__IO_doallocbuf (fp=fp@entry=0xf7dc01a0) at genops.c:342 #6 0x6fdd5768 in _IO_new_file_overflow (f=0xf7dc01a0, ch=-1) at fileops.c:745 #7 0x6fdd41c0 in _IO_new_file_xsputn (n=37, data=, f=) at libioP.h:948 #8 _IO_new_file_xsputn (f=0xf7dc01a0, data=, n=37) at fileops.c:1197 #9 0x6fdc19e8 in __GI__IO_fwrite (buf=0x6ffc1880, size=1, count=37, fp=0xf7dc01a0) at libioP.h:948 #10 0x6ffc0e80 in ?? () #11 0x6fd6641c in generic_start_main (main=0x6ffc0b10, argc=1, argv=0xf6c00760, auxvec=0x0, init=, rtld_fini=, stack_end=, fini=) at ../csu/libc-start.c:332 #12 0x6fd665c0 in __libc_start_main (argc=, argv=, ev=, auxvec=, rtld_fini=, stinfo=, stack_on_entry=) at ../sysdeps/unix/sysv/linux/powerpc/libc-start.c:98 #13 0x00000000 in ?? () -- Tulio Magno