Re: [hatari-devel] Symbol loading for upcoming MINT+ELF program format |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On 29.8.2023 13.36, Thorsten Otto wrote:
And another idea for better handling of weak symbols:
Most of them will be from mintlib.
In ScummVM case (which was initial reason for adding them), most of them
will be from C++ class template methods.
In that case, there is a weak symbol with
the exported name, and a "strong" symbol with the same name, and two
underscores prepended. Maybe that condition could be checked, and the weak
symbol turned into a normal symbol, and the other dupilcate symbol deleted.
There are many reasons for duplicate symbols, both their addresses, and
names.
I've added some heuristics to profiler post-processor to select most
suitable name for given address:
- drop 100% duplicates
- avoid lib/object names
- prefer shorter name for C/C++ symbols
- prefer longer names for ASM symbols
(Symbols not starting with '_' or including '::' or ' ' in their names,
are assumed to be ASM symbols.)
After that, it will rename duplicate symbol names that have different
addresses, by appending ".<idx>" to their names (or "2<char><char>" for
mangled C++ symbols names without vendor extension).
That way you will get a more consistent table, and avoid lots of warnings from
duplicate addresses.
If you're using GEMDOS HD, symbols are loaded automatically, either from
the program itself (or from <name>.sym override file if that exists),
and Hatari debugger _skips duplicate symbol address & name checks_.
You get warnings only when symbols are loaded manually from debugger
console or script.
If above profiler post-processor heuristics produce good enough results,
I'll eventually look later into adding pass with identical rules to to
Hatari debugger.
In profiler post-processor, symbol renaming could be avoided by using
addresses as IDs everywhere, and I'll do that eventually.
However, in Hatari debugger, users rather prefer using names for
things... So, either duplicate names need to be renamed, or debugger
needs to pick one of them at random (e.g. one with lowest address) for
breakpoints.
- Eero