[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.20] symbols: discard stray file symbols



commit 74af7cf30b2b384a8bb50b5c4854c4ddcb16ed97
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Nov 10 15:57:41 2025 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Nov 10 15:57:41 2025 +0100

    symbols: discard stray file symbols
    
    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@xxxxxxxx>
    Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    master commit: 2f21ce1a6ad57a1a56840ab49c32d096160be595
    master date: 2025-10-21 14:10:46 +0200
---
 xen/tools/symbols.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 67560605f2..e532709ba7 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -213,6 +213,16 @@ static int symbol_valid(struct sym_entry *s)
        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)
+               return 0;
+
        return 1;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.