浏览代码

tools: fix readelf parsing with more than 100 sections

This fixes readelf parsing for SDK builds when an ELF has more than 100
sections. The parsing logic previously assumed that section IDs could only
go up to 99 (2 digits), this makes it look for a closing bracket instead.

Signed-off-by: Tamme Schichler <pebble-firmware@schichler.dev>
Rocco 5 月之前
父节点
当前提交
a8e3b95ebc
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      sdk/tools/inject_metadata.py

+ 4 - 3
sdk/tools/inject_metadata.py

@@ -145,9 +145,10 @@ def inject_metadata(target_binary, target_elf, resources_file, timestamp, allow_
                 continue
                 continue
 
 
             # Carve off the first column, since it sometimes has a space in it which screws up the
             # Carve off the first column, since it sometimes has a space in it which screws up the
-            # split. Two leading spaces, a square bracket, 2 digits (with space padding),
-            # a second square brack is 6
-            line = line[6:]
+            # split.
+            if not ']' in line:
+                continue
+            line = line[line.index(']') + 1:]
 
 
             columns = line.split()
             columns = line.split()
             if len(columns) < 6:
             if len(columns) < 6: