On 28.08.2025 03:03, Jason Andryuk wrote: > On 2025-04-02 09:58, Jan Beulich wrote: >> When determining the symbol for a given address (e.g. for the %pS >> logging format specifier), so far the size of a symbol (function) was >> assumed to be everything until the next symbol. There may be gaps >> though, which would better be recognizable in output (often suggesting >> something odd is going on). >> >> Insert "fake" end symbols in the address table, accompanied by zero- >> length type/name entries (to keep lookup reasonably close to how it >> was). >> >> Note however that this, with present GNU binutils, won't work for
Btw, I've updated this to say "with GNU binutils prior to 2.45". >> --- a/xen/tools/symbols.c >> +++ b/xen/tools/symbols.c > >> @@ -318,24 +334,42 @@ static void write_src(void) >> printf("#else\n"); >> output_label("symbols_offsets"); >> printf("#endif\n"); >> - for (i = 0; i < table_cnt; i++) { >> + for (i = 0, ends = 0; i < table_cnt; i++) { >> printf("\tPTR\t%#llx - SYMBOLS_ORIGIN\n", table[i].addr); >> + >> + table[i].addr_idx = i + ends; >> + >> + if (!want_symbol_end(i)) { >> + /* If there's another symbol at the same address, >> + * propagate this symbol's size if the next one has >> + * no size, or if the next one's size is larger. */ > > Why do we want to shrink the next symbol's size? First (see related post-commit-message remarks): In principle section symbols could come with a size, too. That would break everything as long as we don't strip those. The main reason though is that imo smallest granularity is what we want here, together with predictability. One symbol with a huge size could cover multiple other symbols with smaller sizes. We could omit that part of the change here, but then the processing in the hypervisor would need to change, to fish out the "best suitable" symbol when dealing with multiple ones at the same address. Other changes may then also be needed to the tool, to have such symbols come in a well-defined order (to keep the then-new code in the hypervisor as simple as possible). Look for "aliased symbol" in common/symbols.c to see how simplistic respective code is right now. Jan