|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] symbols: prefer symbols which have a type
commit 18ba7e257e16fc3f2299d007af91603c6c83ecb3
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Mon Sep 1 11:12:14 2025 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Sep 1 13:07:01 2025 +0200
symbols: prefer symbols which have a type
... and thus typically also a size. Using global vs local is undesirable
in certain situations, e.g. when a "real" symbol is local and at the
same address as a section start/end one (which are all global).
Note that for xen.efi the checking for "Function" is only forward-
looking at this point: The function-ness of symbols (much like their
size) is lost when linking PE/COFF binaries from ELF objects with GNU ld
up to at least 2.44.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
xen/tools/symbols.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index d20e51a31c..06ad2c25f5 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -45,6 +45,7 @@ struct sym_entry {
unsigned int addr_idx;
unsigned int stream_offset;
unsigned char type;
+ bool typed;
};
#define SYMBOL_NAME(s) ((char *)(s)->sym + 1)
@@ -180,6 +181,9 @@ static int read_symbol(FILE *in, struct sym_entry *s)
s->type = stype; /* As s->sym[0] ends mangled. */
}
s->sym[0] = stype;
+ s->typed = strcmp(type, "FUNC") == 0 ||
+ strcmp(type, "OBJECT") == 0 ||
+ strcmp(type, "Function") == 0;
rc = 0;
skip_tail:
@@ -613,6 +617,13 @@ static int compare_value(const void *p1, const void *p2)
return -1;
if (sym1->addr > sym2->addr)
return +1;
+
+ /* Prefer symbols which have a type. */
+ if (sym1->typed && !sym2->typed)
+ return -1;
+ if (sym2->typed && !sym1->typed)
+ return +1;
+
/* Prefer global symbols. */
if (isupper(*sym1->sym))
return -1;
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |