From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta1.formilux.org (mta1.formilux.org [51.159.59.229]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE561270ED2 for ; Sat, 7 Feb 2026 15:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=51.159.59.229 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770478483; cv=none; b=g5+tRg2m/I3D2VA/h9ikTX7i8Hsi0aIoknw5OMwVsZat1qpjKyEFL19LBflpgWjz2g42pL02TST6gFZH6RXmHv4968gAkntaTW4nFwkR52YlUcy8UYhy9u0o28QEkMPEdxHCN+W8+6vmrPrH4Mp4GsOnyBUd7gYECdre04Joi+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770478483; c=relaxed/simple; bh=aBuiSDwCmTa8QCe85gkSEKJjgo9NCqXBB5Mq26JrS5U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=IQpGHbsmI1JMGCf/gkU2YJGiR/h5y1Rc6xoQB0eJAzVZwcDrF9a9vQ/zOY5J9qsw/2KOdQkugzzbqfGzK4vLgomdETAwkLGHB6w06fZ5evpS0HaW4or7q4FK0dqDfaqVB2IF1qJtxluLyUo0ux9yH9Z9UWGuZp27FS7yX6rOl4c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu; spf=pass smtp.mailfrom=1wt.eu; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b=awCZlJyx; arc=none smtp.client-ip=51.159.59.229 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=1wt.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=1wt.eu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=1wt.eu header.i=@1wt.eu header.b="awCZlJyx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1wt.eu; s=mail; t=1770478481; bh=X6x0yAhMS4SGCerHzsgZl9sG0+G5LTnMJr5MPRG3fZ0=; h=From:Message-ID:From; b=awCZlJyxYQ8yjOh7sUkYpsqZAe3C+mpkGR/DE0tjKqGuGWkTPLGSlLBrmt8GwMEAo BoNa3hHmYpB9yY6o8YswU3xC56USL2N2hJLiwKK0lvQyWXHVo1IM7pvHOUit0CRHM4 ydViTO0zv19PqAvdfloykDYlzY71fSuq925fSiX8= Received: from 1wt.eu (ded1.1wt.eu [163.172.96.212]) by mta1.formilux.org (Postfix) with ESMTP id F2B14C0B44; Sat, 07 Feb 2026 16:34:40 +0100 (CET) Date: Sat, 7 Feb 2026 16:34:40 +0100 From: Willy Tarreau To: Daniel Palmer Cc: linux@weissschuh.net, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 00/10] nolibc: Add static-pie support Message-ID: References: <20260204124542.523567-1-daniel@thingy.jp> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260204124542.523567-1-daniel@thingy.jp> Hi Daniel, On Wed, Feb 04, 2026 at 09:45:32PM +0900, Daniel Palmer wrote: > v2: > > - This is still RFC quality > - I have gotten a few more archs to work (not crash in nolibc-test) so I have added them > to show the that the arch specific parts are pretty small. > - This should now only add this extra code if NOLIBC_WANT_RELOC is defined, which happens > automatically if you compile with -fpie. Should address Willy's concern with the size > blowing up for even binaries that don't need this. Oh yes that's a nice improvement indeed, thank you: $ size init-master init-dpalmer* text data bss dec hex filename 22519 24 39424 61967 f20f init-master 22562 24 39424 62010 f23a init-dpalmer 22710 56 39424 62190 f2ee init-dpalmer-pie 22816 24 39424 62264 f338 init-dpalmer-want-reloc I think the 43 bytes increase on the _start_c part remains acceptable, especially compared to the +300 before :-) > Size difference on ppc64 is massive, I guess PIC code is big there. > > static: > > $ file nolibc-test > nolibc-test: ELF 64-bit MSB executable, 64-bit PowerPC or cisco 7500, Power ELF V1 ABI, version 1 (SYSV), statically linked, not stripped > $ size nolibc-test > text data bss dec hex filename > 59560 3240 104 62904 f5b8 nolibc-test > > static pie: > > $ file nolibc-test > nolibc-test: ELF 64-bit MSB pie executable, 64-bit PowerPC or cisco 7500, Power ELF V1 ABI, version 1 (SYSV), static-pie linked, with debug_info, not stripped > $ size nolibc-test > text data bss dec hex filename > 67801 3656 104 71561 11789 nolibc-test > > - Each of the archs checks that the relocations they need (just the one at the moment) is defined > before defining the relocation defines. So this shouldn't break with older UAPI headers. I confirm, I've built against 5.10 to 6.18 and it's OK, and if -fpie is passed we get an error saying the arch doesn't support it. > - I think maybe you might want to set NOLIBC_WANT_RELOC even if __pie__ is not defined, > maybe for testing? So I didn't make it _NOLIBC_WANT_RELOC. It's possible, at least for developers/maintainers maybe. Above I used it to compare the size increase caused by the changes. > - I was worried some archs didn't work because calling the relocation functions was > causing things like accessing the stack canary before it was accessible. So I added > __inline__ to all of the relocation functions to force them to get inlined into _start_c(). If you absolutely need to forcefully inline, you should add __attribute__((always_inline)) in addition to __inline__, as it will override the default compiler setting based on the optimization level. However the functions are short enough that they were always inlined in my tests regardless of the attribute. > This might be too much. checkpatch certainly hates it. No big deal. Thanks, Willy