scripts: Replaced nm with objdump in code.py/data.py
There is an argument for prefering nm for code size measurements due to portability. But I'm not sure this really holds up these days with objdump being so prevalent. We already depend on objdump for ctx/structs/perf and other dwarf info, so using objdump -t to get symbol information means one less tool to depend on/pass around when cross-compiling. As a minor benefit this also gives us more control over which sections to include, instead of relying on nm's predefined t/r/d/b section types. --- Note code.py/data.py did _not_ require objdump before this. They did use objdump to map symbols to source files, but would just guess if objdump wasn't available.
This commit is contained in:
+2
-4
@@ -311,11 +311,9 @@ class DwarfInfo:
|
||||
def __iter__(self):
|
||||
return (v for k, v in self.entries.items())
|
||||
|
||||
def collect_dwarf_info(obj_path, filter=None, *,
|
||||
def collect_dwarf_info(obj_path, tags=None, *,
|
||||
objdump_path=OBJDUMP_PATH,
|
||||
**args):
|
||||
filter_, filter = filter, __builtins__.filter
|
||||
|
||||
info_pattern = re.compile(
|
||||
'^\s*(?:<(?P<level>[^>]*)>'
|
||||
'\s*<(?P<off>[^>]*)>'
|
||||
@@ -350,7 +348,7 @@ def collect_dwarf_info(obj_path, filter=None, *,
|
||||
# keep track of top-level entries
|
||||
if (entry.level == 1 and (
|
||||
# unless this entry is filtered
|
||||
filter_ is None or entry.tag in filter_)):
|
||||
tags is None or entry.tag in tags)):
|
||||
info[entry.off] = entry
|
||||
# store entry in parent
|
||||
levels[entry.level] = entry
|
||||
|
||||
Reference in New Issue
Block a user