Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 168DBCCF9E3 for ; Thu, 30 Oct 2025 16:03:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.1153854.1484111 (Exim 4.92) (envelope-from ) id 1vEV7B-0001WM-SP; Thu, 30 Oct 2025 16:03:05 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1153854.1484111; Thu, 30 Oct 2025 16:03:05 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vEV7B-0001WF-Pr; Thu, 30 Oct 2025 16:03:05 +0000 Received: by outflank-mailman (input) for mailman id 1153854; Thu, 30 Oct 2025 16:03:04 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vEV7A-0001W8-0X for xen-devel@lists.xenproject.org; Thu, 30 Oct 2025 16:03:04 +0000 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [2a00:1450:4864:20::536]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id e78ca313-b5a9-11f0-980a-7dc792cee155; Thu, 30 Oct 2025 17:02:58 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-63e18829aa7so1716262a12.3 for ; Thu, 30 Oct 2025 09:02:58 -0700 (PDT) Received: from [192.168.1.5] (user-109-243-71-38.play-internet.pl. [109.243.71.38]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-63e7ef6c129sm15306299a12.3.2025.10.30.09.02.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Oct 2025 09:02:57 -0700 (PDT) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: e78ca313-b5a9-11f0-980a-7dc792cee155 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1761840178; x=1762444978; darn=lists.xenproject.org; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=uTWYYeImcGjWZUiPWsuMRdZ0/0ySL8/qYM877Yoyssw=; b=DTaKRiJxLNYBU9LL9o6sZCDgwL/g245vsloAP1979he+OMnljU1/EdKmTewZZNDi1g g5jPYNfv5zUhIhuJmyUWlWpzt4aVEiM/OtjTEuEiDbM9ZkAH2noPT08n7EPnGaNxc7A4 9kRfcdc1N1muQPhFD59dcN06O3AZyqX5TAaN6jLaKzOodqzpqwDjLS+Q4uSvMVBbiZhz ilIZQ0Iluybh77F6r5CX2Ptb+Z5gXiIK9rQfl96GJLZCHoBp0zrldT//zk5byTpfivht /C7rvct8PVELv2GeQ9AqK8vDM7zpLlq9pxJz55AI83LpPoV2deGrMK9TL2jkth2shx/0 ksvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761840178; x=1762444978; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=uTWYYeImcGjWZUiPWsuMRdZ0/0ySL8/qYM877Yoyssw=; b=GKIdJ1hRvzZNZVreQNHuuTieqVWPFzqdz+LAO4SP0C11pXs4jeZoZzBgSmipilEqsC 8vn3dzjo5oR/lOWIdv6wAZSG8dxgl+cxjgH3/RB06llua2h3majRG43ebtfJo94LkX/G odU39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by 2002:a05:6402:d0b:b0:640:325d:3dba with SMTP id 4fb4d7f45d1cf-64061a83b71mr2914338a12.35.1761840177886; Thu, 30 Oct 2025 09:02:57 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------fLVn3BV11kTRyC7YX7U5XosF" Message-ID: Date: Thu, 30 Oct 2025 17:02:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH for-4.21] symbols: avoid emitting "end" symbols for data items To: Jan Beulich , "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Julien Grall , Stefano Stabellini , Anthony PERARD , Michal Orzel , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= References: <6fdfd369-6c1e-48a5-8189-4999d566788a@suse.com> Content-Language: en-US From: Oleksii Kurochko In-Reply-To: <6fdfd369-6c1e-48a5-8189-4999d566788a@suse.com> This is a multi-part message in MIME format. --------------fLVn3BV11kTRyC7YX7U5XosF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 10/29/25 2:34 PM, Jan Beulich wrote: > symbols-dummy.c and the generated .xen-syms.?.S may place their symbols in > different sections: Like for all C files, -fdata-sections may be in effect > there. As a result, besides moving these symbols may then also have > different amounts of "end" symbols inserted between them. While the > movement is likely not problematic, the change in table size is - linking > passes 2 and 3 want no address (and hence no size) changes between them. > > As, at least right now, the "end" symbols are useful only for code, limit > their emission accordingly. When data symbols are emitted (i.e. when > LIVEPATCH=y), this obviously also has a positive effect on overall table > size (I'm seeing almost 600 entries going away in the build I'm looking > at). > > Fixes: d3b637fba31b ("symbols: arrange to know where functions end") > Reported-by: Roger Pau Monné > Signed-off-by: Jan Beulich Release-Acked-By: Oleksii Kurochko Thanks. ~ Oleskii > --- > Furthermore at least some gcc versions emit the (read-only) data there into > .bss.symbols_* rather than the expected (but still potentially problematic) > .rodata.symbols_*. > > --- a/xen/tools/symbols.c > +++ b/xen/tools/symbols.c > @@ -176,10 +176,9 @@ static int read_symbol(FILE *in, struct > *sym++ = '#'; > } > strcpy(sym, str); > - if (sort_by_name || map_only) { > + if (sort_by_name || map_only) > s->orig_symbol = strdup(SYMBOL_NAME(s)); > - s->type = stype; /* As s->sym[0] ends mangled. */ > - } > + s->type = stype; /* As s->sym[0] may end up mangled. */ > s->sym[0] = stype; > s->typed = strcmp(type, "FUNC") == 0 || > strcmp(type, "OBJECT") == 0 || > @@ -313,6 +312,7 @@ static int compare_name_orig(const void > static bool want_symbol_end(unsigned int idx) > { > return table[idx].size && > + toupper(table[idx].type) == 'T' && > (idx + 1 == table_cnt || > table[idx].addr + table[idx].size < table[idx + 1].addr); > } --------------fLVn3BV11kTRyC7YX7U5XosF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 10/29/25 2:34 PM, Jan Beulich wrote:
symbols-dummy.c and the generated .xen-syms.?.S may place their symbols in
different sections: Like for all C files, -fdata-sections may be in effect
there. As a result, besides moving these symbols may then also have
different amounts of "end" symbols inserted between them. While the
movement is likely not problematic, the change in table size is - linking
passes 2 and 3 want no address (and hence no size) changes between them.

As, at least right now, the "end" symbols are useful only for code, limit
their emission accordingly. When data symbols are emitted (i.e. when
LIVEPATCH=y), this obviously also has a positive effect on overall table
size (I'm seeing almost 600 entries going away in the build I'm looking
at).

Fixes: d3b637fba31b ("symbols: arrange to know where functions end")
Reported-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Thanks.

~ Oleskii

---
Furthermore at least some gcc versions emit the (read-only) data there into
.bss.symbols_* rather than the expected (but still potentially problematic)
.rodata.symbols_*.

--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -176,10 +176,9 @@ static int read_symbol(FILE *in, struct
 		*sym++ = '#';
 	}
 	strcpy(sym, str);
-	if (sort_by_name || map_only) {
+	if (sort_by_name || map_only)
 		s->orig_symbol = strdup(SYMBOL_NAME(s));
-		s->type = stype; /* As s->sym[0] ends mangled. */
-	}
+	s->type = stype; /* As s->sym[0] may end up mangled. */
 	s->sym[0] = stype;
 	s->typed = strcmp(type, "FUNC") == 0 ||
 	           strcmp(type, "OBJECT") == 0 ||
@@ -313,6 +312,7 @@ static int compare_name_orig(const void
 static bool want_symbol_end(unsigned int idx)
 {
 	return table[idx].size &&
+	       toupper(table[idx].type) == 'T' &&
 	       (idx + 1 == table_cnt ||
 	        table[idx].addr + table[idx].size < table[idx + 1].addr);
 }
--------------fLVn3BV11kTRyC7YX7U5XosF--