|
27 | 27 | RE_OBJECT_LIBRARY_IAR = re.compile(r'^\s+(.+\.o)\s.*')
|
28 | 28 |
|
29 | 29 | RE_OBJECT_FILE_GCC = re.compile(r'^(.+\/.+\.o)$')
|
30 |
| -RE_LIBRARY_OBJECT_GCC = re.compile(r'^.+\/(lib.+\.a)\((.+\.o)\)$') |
| 30 | +RE_LIBRARY_OBJECT_GCC = re.compile(r'^.+\/lib(.+\.a)\((.+\.o)\)$') |
31 | 31 | RE_STD_SECTION_GCC = re.compile(r'^\s+.*0x(\w{8,16})\s+0x(\w+)\s(.+)$')
|
32 | 32 | RE_FILL_SECTION_GCC = re.compile(r'^\s*\*fill\*\s+0x(\w{8,16})\s+0x(\w+).*$')
|
33 | 33 |
|
@@ -219,14 +219,25 @@ def parse_map_file_gcc(self, file_desc):
|
219 | 219 | next_section = self.check_new_section_gcc(line)
|
220 | 220 |
|
221 | 221 | if next_section == "OUTPUT":
|
222 |
| - return |
| 222 | + break |
223 | 223 | elif next_section:
|
224 | 224 | current_section = next_section
|
225 | 225 |
|
226 | 226 | object_name, object_size = self.parse_section_gcc(line, prefixes)
|
227 | 227 |
|
228 | 228 | self.module_add(object_name, object_size, current_section)
|
229 | 229 |
|
| 230 | + common_prefix = os.path.dirname(os.path.commonprefix([ |
| 231 | + o for o in self.modules.keys() if (o.endswith(".o") and not o.startswith("[lib]"))])) |
| 232 | + new_modules = {} |
| 233 | + for name, stats in self.modules.items(): |
| 234 | + if name.startswith("[lib]"): |
| 235 | + new_modules[name] = stats |
| 236 | + elif name.endswith(".o"): |
| 237 | + new_modules[os.path.relpath(name, common_prefix)] = stats |
| 238 | + else: |
| 239 | + new_modules[name] = stats |
| 240 | + self.modules = new_modules |
230 | 241 |
|
231 | 242 | def parse_object_name_armcc(self, line):
|
232 | 243 | """ Parse object file
|
|
0 commit comments