scripts: gen_handles.py: remove size restrictions

With `gen_handles.py` now running on the first pre-built image,
`zephyr_pre0.elf` there is no requirement for the device handle arrays
to remain the same size after processing.

Remove the padding generated in `gen_handles.py`, as well as the
temporary option `CONFIG_DEVICE_HANDLE_PADDING` which was added to work
around this issue.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
Jordan Yates 2021-10-20 20:29:10 +10:00 committed by Carles Cufí
commit 44b8a0d199
3 changed files with 2 additions and 77 deletions

View file

@ -306,21 +306,8 @@ def main():
hdls.append(DEVICE_HANDLE_SEP)
hdls.extend(hs.ext_deps)
# When CONFIG_USERSPACE is enabled the pre-built elf is
# also used to get hashes that identify kernel objects by
# address. We can't allow the size of any object in the
# final elf to change. We also must make sure at least one
# DEVICE_HANDLE_ENDS is inserted.
padding = len(hs.handles) - len(hdls)
assert padding > 0, \
(f"device {dev.sym.name}: "
"linker pass 1 left no room to insert DEVICE_HANDLE_ENDS. "
"To work around, increase CONFIG_DEVICE_HANDLE_PADDING by " +
str(1 + (-padding)))
while padding > 0:
hdls.append(DEVICE_HANDLE_ENDS)
padding -= 1
assert len(hdls) == len(hs.handles), "%s handle overflow" % (dev.sym.name,)
# Terminate the array with the end symbol
hdls.append(DEVICE_HANDLE_ENDS)
lines = [
'',