Skip to content

Commit dbec70d

Browse files
author
Nikolay Agishev
committed
scripts: build: Fix check_init_priorities.py for ARCMWDT compatibility
#58388 breaks ARCMWDT building. ARCMWDT linker generates extended section names (ex.: .rela.z_init_POST_KERNEL40_0_.__init_k_sys_work_q_init). Default script "build/check_init_priorities.py" is unable to parse such format. This fixup adds limitation for reading only 2 parameters from priority string. Signed-off-by: Nikolay Agishev <[email protected]>
1 parent e80f71a commit dbec70d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/build/check_init_priorities.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import pathlib
2323
import pickle
2424
import sys
25+
import re
2526

2627
from elftools.elf.elffile import ELFFile
2728
from elftools.elf.relocation import RelocationSection
@@ -75,9 +76,18 @@ class Priority:
7576
"""
7677
def __init__(self, name):
7778
for idx, level in enumerate(_DEVICE_INIT_LEVELS):
79+
expr = re.compile(rf".*{level}(\d+)_(\d+).*")
7880
if level in name:
7981
_, priority_str = name.strip("_").split(level)
80-
priority, sub_priority = priority_str.split("_")
82+
83+
# ARCMWDT linker generates extended section names
84+
# (ex.: .rela.z_init_POST_KERNEL40_0_.__init_k_sys_work_q_init).
85+
# limitation is required for reading only 2 parameters from
86+
# priority string.
87+
m = expr.match(name)
88+
if not m:
89+
continue
90+
priority, sub_priority = m.groups()
8191
self._level = idx
8292
self._priority = int(priority)
8393
self._sub_priority = int(sub_priority)

0 commit comments

Comments
 (0)