From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by sourceware.org (Postfix) with ESMTPS id F32573858D38 for ; Wed, 11 Jan 2023 16:24:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F32573858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1673454257; x=1704990257; h=from:to:in-reply-to:subject:mime-version: content-transfer-encoding:references:message-id:date; bh=y4o+vPfVKM5FQM6AnmUWemeVY6aQkr7sL/2qstSCldA=; b=ahKH7vry0qUuyY9sfJRtA1oQ7wrZuqJy4/yZyjjfjnP8xf6wY7BnI/2A B1vZD7UAYMuEUc085VO6qOLO01+yEwWycgbUNRQL/lXsKib0Bn4OsbXhq poeH5M9dyRNDRWRxwWcQ93v57oMZv81oJRq03dbMZvssfpDvoqaujnM9w BR5xSt53t8KUQkmEBY3O0sykRx6ch1ns2SUNhOQ7qlf7OZB5FpyGiH8tt 5PiyQG2Lf3wo/sxBJ9jW3PedoHYp1JbjzR0cGO1ORvxqeRY7fkXhCOnCI aRkfClRiUo/imdRHgTVE8gIieed73WgDpQmiwD9bY3oHxnncaS2JUsueh Q==; From: Hans-Peter Nilsson To: , , , In-Reply-To: <20230103151629.8263320430@pchp3.se.axis.com> (message from Hans-Peter Nilsson on Tue, 3 Jan 2023 16:16:29 +0100) Subject: Re: ARM: Fix ld bloat introduced between binutils-2.38 and 2.39 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8BIT References: <20230102160857.ABA7F2042C@pchp3.se.axis.com> <20230103024119.12F182042C@pchp3.se.axis.com> <20230103151629.8263320430@pchp3.se.axis.com> Message-ID: <20230111162415.5CBC420422@pchp3.se.axis.com> Date: Wed, 11 Jan 2023 17:24:15 +0100 X-Spam-Status: No, score=-10.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > From: Hans-Peter Nilsson > Date: Tue, 3 Jan 2023 16:16:29 +0100 PING. Ok for master, 2.40 and 2.39? Refreshed patch, i.e. without errata (to be followed by a testsuite fix, to be committed before this one for bisection cleanliness): ---- 8< ---- Since commit 9833b7757d24, "PR28824, relro security issues", ELF_MAXPAGESIZE matters much more, with regards to layout of the linked file. That commit fixed an actual bug, but also exposes a problem for targets were that value is too high. For example, for ARM(32, a.k.a. "Aarch32") specifically bfd_arch_arm, it's set to 64 KiB, making all Linux(/GNU) targets pay an extra amount of up to 60 KiB of bloat in DSO:s and executables. This matters when there are many such files, and where storage is expensive. It's *mostly* bloat when using a Linux kernel, as ARM(32) is a good example of an target where ELF_MAXPAGESIZE is set to an extreme value for an obscure corner-case. The ARM (32-bit) kernel has 4 KiB pages, has had that value forever, and can't be configured to any other value. The use-case is IIUC "Aarch32" emulation on an "Aarch64" (arm64) kernel, but not just that, but a setup where the Linux page-size is configured to something other than the *default* 4 KiB. Not sure there actually any such systems in use, again with both Aarch32 compatibility support and a non-4KiB pagesize, with all the warnings in the kernel config and requiring the "EXPERT" level set on. So, let's do like x86-64 in a2267dbfc9e1 "x86-64: Use only one default max-page-size" and set ELF_MAXPAGESIZE to 4096. bfd: * elf32-arm.c (ELF_MAXPAGESIZE): Always set to 0x1000. --- bfd/elf32-arm.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 96ba509f505d..a6d83b97c97d 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -20290,11 +20290,7 @@ elf32_arm_backend_symbol_processing (bfd *abfd, asymbol *sym) #define ELF_ARCH bfd_arch_arm #define ELF_TARGET_ID ARM_ELF_DATA #define ELF_MACHINE_CODE EM_ARM -#ifdef __QNXTARGET__ #define ELF_MAXPAGESIZE 0x1000 -#else -#define ELF_MAXPAGESIZE 0x10000 -#endif #define ELF_COMMONPAGESIZE 0x1000 #define bfd_elf32_mkobject elf32_arm_mkobject -- 2.30.2