@@ -104,10 +104,11 @@ def parse_mapfile(self, mapfile):
104
104
105
105
106
106
class _GccParser (_Parser ):
107
- RE_OBJECT_FILE = re .compile (r'^(.+\/.+\.o)$' )
108
- RE_LIBRARY_OBJECT = re .compile (r'^.+' + r'' .format (sep ) + r'lib((.+\.a)\((.+\.o)\))$' )
107
+ RE_OBJECT_FILE = re .compile (r'^(.+\/.+\.o(bj)? )$' )
108
+ RE_LIBRARY_OBJECT = re .compile (r'^.+' + r'' .format (sep ) + r'lib((.+\.a)\((.+\.o(bj)? )\))$' )
109
109
RE_STD_SECTION = re .compile (r'^\s+.*0x(\w{8,16})\s+0x(\w+)\s(.+)$' )
110
110
RE_FILL_SECTION = re .compile (r'^\s*\*fill\*\s+0x(\w{8,16})\s+0x(\w+).*$' )
111
+ OBJECT_EXTENSIONS = (".o" , ".obj" )
111
112
112
113
ALL_SECTIONS = _Parser .SECTIONS + _Parser .OTHER_SECTIONS + \
113
114
_Parser .MISC_FLASH_SECTIONS + ('unknown' , 'OUTPUT' )
@@ -214,12 +215,12 @@ def parse_mapfile(self, file_desc):
214
215
self .module_add (object_name , object_size , current_section )
215
216
216
217
common_prefix = dirname (commonprefix ([
217
- o for o in self .modules .keys () if (o .endswith (".o" ) and not o .startswith ("[lib]" ))]))
218
+ o for o in self .modules .keys () if (o .endswith (self . OBJECT_EXTENSIONS ) and not o .startswith ("[lib]" ))]))
218
219
new_modules = {}
219
220
for name , stats in self .modules .items ():
220
221
if name .startswith ("[lib]" ):
221
222
new_modules [name ] = stats
222
- elif name .endswith (".o" ):
223
+ elif name .endswith (self . OBJECT_EXTENSIONS ):
223
224
new_modules [relpath (name , common_prefix )] = stats
224
225
else :
225
226
new_modules [name ] = stats
@@ -229,15 +230,16 @@ def parse_mapfile(self, file_desc):
229
230
class _ArmccParser (_Parser ):
230
231
RE = re .compile (
231
232
r'^\s+0x(\w{8})\s+0x(\w{8})\s+(\w+)\s+(\w+)\s+(\d+)\s+[*]?.+\s+(.+)$' )
232
- RE_OBJECT = re .compile (r'(.+\.(l|ar))\((.+\.o)\)' )
233
+ RE_OBJECT = re .compile (r'(.+\.(l|ar))\((.+\.o(bj)?)\)' )
234
+ OBJECT_EXTENSIONS = (".o" , ".obj" )
233
235
234
236
def parse_object_name (self , line ):
235
237
""" Parse object file
236
238
237
239
Positional arguments:
238
240
line - the line containing the object or library
239
241
"""
240
- if line .endswith (".o" ):
242
+ if line .endswith (self . OBJECT_EXTENSIONS ):
241
243
return line
242
244
243
245
else :
@@ -305,12 +307,12 @@ def parse_mapfile(self, file_desc):
305
307
self .module_add (* self .parse_section (line ))
306
308
307
309
common_prefix = dirname (commonprefix ([
308
- o for o in self .modules .keys () if (o .endswith (" .o") and o != "anon$$obj.o " and not o .startswith ("[lib]" ))]))
310
+ o for o in self .modules .keys () if (o .endswith (self . OBJECT_EXTENSIONS ) and o != "anon$$obj .o" and o != "anon$$obj.obj " and not o .startswith ("[lib]" ))]))
309
311
new_modules = {}
310
312
for name , stats in self .modules .items ():
311
- if name == "anon$$obj.o" or name .startswith ("[lib]" ):
313
+ if name == "anon$$obj.o" or name == "anon$$obj.obj" or name .startswith ("[lib]" ):
312
314
new_modules [name ] = stats
313
- elif name .endswith (".o" ):
315
+ elif name .endswith (self . OBJECT_EXTENSIONS ):
314
316
new_modules [relpath (name , common_prefix )] = stats
315
317
else :
316
318
new_modules [name ] = stats
@@ -322,9 +324,10 @@ class _IarParser(_Parser):
322
324
r'^\s+(.+)\s+(zero|const|ro code|inited|uninit)\s'
323
325
r'+0x([\'\w]+)\s+0x(\w+)\s+(.+)\s.+$' )
324
326
325
- RE_CMDLINE_FILE = re .compile (r'^#\s+(.+\.o)' )
327
+ RE_CMDLINE_FILE = re .compile (r'^#\s+(.+\.o(bj)? )' )
326
328
RE_LIBRARY = re .compile (r'^(.+\.a)\:.+$' )
327
- RE_OBJECT_LIBRARY = re .compile (r'^\s+(.+\.o)\s.*' )
329
+ RE_OBJECT_LIBRARY = re .compile (r'^\s+(.+\.o(bj)?)\s.*' )
330
+ OBJECT_EXTENSIONS = (".o" , ".obj" )
328
331
329
332
def __init__ (self ):
330
333
_Parser .__init__ (self )
@@ -338,7 +341,7 @@ def parse_object_name(self, object_name):
338
341
Positional arguments:
339
342
line - the line containing the object or library
340
343
"""
341
- if object_name .endswith (".o" ):
344
+ if object_name .endswith (self . OBJECT_EXTENSIONS ):
342
345
try :
343
346
return self .cmd_modules [object_name ]
344
347
except KeyError :
@@ -432,7 +435,7 @@ def parse_command_line(self, lines):
432
435
break
433
436
for arg in line .split (" " ):
434
437
arg = arg .rstrip (" \n " )
435
- if (not arg .startswith ("-" )) and arg .endswith (".o" ):
438
+ if (not arg .startswith ("-" )) and arg .endswith (self . OBJECT_EXTENSIONS ):
436
439
self .cmd_modules [basename (arg )] = arg
437
440
438
441
common_prefix = dirname (commonprefix (list (self .cmd_modules .values ())))
0 commit comments