From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
Anthony PERARD <anthony.perard@vates.tech>,
Michal Orzel <michal.orzel@amd.com>
Subject: Re: [PATCH] symbols: discard stray file symbols
Date: Tue, 21 Oct 2025 10:56:28 +0100 [thread overview]
Message-ID: <aPdYzDVniMV6-bHd@Mac.lan> (raw)
In-Reply-To: <2412a7a0-bdcd-4647-8ea2-8d2a927dcde3@suse.com>
On Wed, Apr 16, 2025 at 11:00:57AM +0200, Jan Beulich wrote:
> By observation GNU ld 2.25 may emit file symbols for .data.read_mostly
> when linking xen.efi. Due to the nature of file symbols in COFF symbol
> tables (see the code comment) the symbols_offsets[] entries for such
> symbols would cause assembler warnings regarding value truncation. Of
> course the resulting entries would also be both meaningless and useless.
> Add a heuristic to get rid of them, really taking effect only when
> --all-symbols is specified (otherwise these symbols are discarded
> anyway).
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Factor 2 may in principle still be too small: We zap what looks like
> real file symbols already in read_symbol(), so table_cnt doesn't really
> reflect the number of symbol table entries encountered. It has proven to
> work for me in practice though, with still some leeway left.
>
> --- a/xen/tools/symbols.c
> +++ b/xen/tools/symbols.c
> @@ -213,6 +213,16 @@ static int symbol_valid(struct sym_entry
> if (strstr((char *)s->sym + offset, "_compiled."))
> return 0;
>
> + /* At least GNU ld 2.25 may emit bogus file symbols referencing a
> + * section name while linking xen.efi. In COFF symbol tables the
> + * "value" of file symbols is a link (symbol table index) to the next
> + * file symbol. Since file (and other) symbols (can) come with one
> + * (or in principle more) auxiliary symbol table entries, the value in
> + * this heuristic is bounded to twice the number of symbols we have
> + * found. See also read_symbol() as to the '?' checked for here. */
> + if (s->sym[0] == '?' && s->sym[1] == '.' && s->addr < table_cnt * 2)
Maybe a naive question, but couldn't you drop everything below
__XEN_VIRT_START, as we shouldn't have any symbols below that
address?
Thanks, Roger.
next prev parent reply other threads:[~2025-10-21 9:56 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 9:00 [PATCH] symbols: discard stray file symbols Jan Beulich
2025-09-04 21:53 ` Jason Andryuk
2025-09-05 6:23 ` Jan Beulich
2025-09-25 7:36 ` Ping: " Jan Beulich
2025-09-25 20:39 ` Oleksii Kurochko
2025-10-21 9:56 ` Roger Pau Monné [this message]
2025-10-21 10:13 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aPdYzDVniMV6-bHd@Mac.lan \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.