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

[xen master] symbols: discard stray file symbols



commit 2f21ce1a6ad57a1a56840ab49c32d096160be595
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Tue Oct 21 14:10:46 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Oct 21 14:10:46 2025 +0200

    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>
    Release-Acked-by: Oleksii Kurochko<oleksii.kurochko@xxxxxxxxx>
---
 xen/tools/symbols.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 06ad2c25f5..399edc8578 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -224,6 +224,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#master



 


Rackspace

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