Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Unified Diff: tools/binary_size/linker_map_parser.py

Issue 2792403002: //tools/binary_size: Change merge symbols to have their size as padding (Closed)
Patch Set: rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/binary_size/describe.py ('k') | tools/binary_size/map2size.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/binary_size/linker_map_parser.py
diff --git a/tools/binary_size/linker_map_parser.py b/tools/binary_size/linker_map_parser.py
index 5cbb106648d23382067d22d3226080032c3ba701..5c6eca40740c49c91c3196cbabcea0f191da0659 100644
--- a/tools/binary_size/linker_map_parser.py
+++ b/tools/binary_size/linker_map_parser.py
@@ -175,10 +175,16 @@ class MapFileParser(object):
# There seems to be no corelation between where these gaps occur
# and the symbols they come in-between.
# TODO(agrieve): Learn more about why this happens.
- address = -1
- if syms and syms[-1].address > 0:
- merge_symbol_start_address = syms[-1].end_address
- merge_symbol_start_address += size
+ if address_str2:
+ address = int(address_str2[2:], 16) - 1
+ elif syms and syms[-1].address > 0:
+ # Merge sym with no second line showing real address.
+ address = syms[-1].end_address
+ else:
+ logging.warning('First symbol of section had address -1')
+ address = 0
+
+ merge_symbol_start_address = address + size
else:
address = int(address_str[2:], 16)
# Finish off active address gap / merge section.
@@ -186,20 +192,16 @@ class MapFileParser(object):
merge_size = address - merge_symbol_start_address
logging.debug('Merge symbol of size %d found at:\n %r',
merge_size, syms[-1])
+ # Set size=0 so that it will show up as padding.
sym = models.Symbol(
- section_name, merge_size,
- address=merge_symbol_start_address,
+ section_name, 0,
+ address=address,
name='** symbol gap %d' % symbol_gap_count,
object_path=path)
symbol_gap_count += 1
syms.append(sym)
merge_symbol_start_address = 0
- if address == -1 and address_str2:
- address = int(address_str2[2:], 16) - 1
- # Merge sym with no second line showing real address.
- if address == -1:
- address = syms[-1].end_address
syms.append(models.Symbol(section_name, size, address=address,
name=name or mangled_name,
object_path=path))
« no previous file with comments | « tools/binary_size/describe.py ('k') | tools/binary_size/map2size.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698