Include namespace in symbol table

This introduces its own issues, but without namespaces, symbol names end
up repeated and delinking fails.  The delinked symbols also end up
without namespaces, introducing yet more problems.  This is an
improvement for now, but we'll need proper namespace importing into
Ghidra at some point.
This commit is contained in:
KeybadeBlox 2026-02-01 21:11:26 -05:00
parent cef08bf624
commit 30f8a5879e
3 changed files with 817 additions and 791 deletions

View file

@ -9,11 +9,18 @@ main() {
>symboltable.tsv # Create/truncate output file
while IFS=, read -r name location type; do # Iterate over rows
while IFS=, read -r location namespace name type; do # Iterate rows
# Determine symbol type (skip if unrecognized, e.g. header row)
if [ "$type" == '"Function"' ]; then type_out=f
elif [ "$type" == '"Data Label"' ]; then type_out=l
else continue
if [ "$type" = '"Function"' ]; then type_out=f
elif [ "$type" = '"Data Label"' ]; then type_out=l
else continue
fi
# Add namespace prefix if not in global namespace
if [ "$namespace" = '"Global"' ]; then namespace_out=
else
namespace_out=${namespace#'"'}
namespace_out=${namespace_out%'"'}::
fi
# Strip quotes from other columns
@ -21,7 +28,8 @@ main() {
location_out=${location#'"'}; location_out=${location_out%'"'}
# Output row
printf '%s\t%s\t%s\n' "$name_out" "$location_out" "$type_out"\
printf '%s\t%s\t%s\n'\
"$namespace_out$name_out" "$location_out" "$type_out"\
>> symboltable.tsv
done < $1