scripts: size_report: add tree node for hidden symbols

The list of symbols only contain visible symbols that can be
obtained through ELF file. There are code and data where
the toolchain never emits symbols for them and thus are not
visible in the list. So add a "(hidden)" node to the tree
to show they are there.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
Daniel Leung 2021-05-10 17:32:25 -07:00 committed by Carles Cufí
commit c3e8c4e6dc

View file

@ -553,7 +553,7 @@ def sum_node_children_size(node):
return size return size
def generate_any_tree(symbol_dict, path_prefix): def generate_any_tree(symbol_dict, total_size, path_prefix):
""" """
Generate a symbol tree for output. Generate a symbol tree for output.
""" """
@ -637,6 +637,11 @@ def generate_any_tree(symbol_dict, path_prefix):
# Root node doesn't have sum of symbol size. So sum them up. # Root node doesn't have sum of symbol size. So sum them up.
root.size = sum_node_children_size(root) root.size = sum_node_children_size(root)
# Need to account for code and data where there are not emitted
# symbols associated with them.
node_hidden_syms = TreeNode('(hidden)', "(hidden)", parent=root)
node_hidden_syms.size = total_size - root.size
return root return root
@ -747,7 +752,7 @@ def main():
for sym in processed['unmapped_symbols']: for sym in processed['unmapped_symbols']:
print("INFO: Unmapped symbol: {0}".format(sym)) print("INFO: Unmapped symbol: {0}".format(sym))
root = generate_any_tree(symbol_dict, common_path_prefix) root = generate_any_tree(symbol_dict, symsize, common_path_prefix)
print_any_tree(root, symsize, args.depth) print_any_tree(root, symsize, args.depth)
if args.json: if args.json: