2 Commits

Author SHA1 Message Date
Simon Glass
2812864362 check_linker_lists: Enhance detection of alignment problems
When linker-inserted padding breaks list integrity, pointer arithmetic
like (end - start) / sizeof(struct) produces garbage. GCC optimizes
division by constants using multiplicative inverses, which only works
when the dividend is an exact multiple. With padding, outputs like
"Running -858993444 bloblist tests" appear instead of the correct count.

Enhance the linker list checking script to detect these problems by
adding symbol size tracking using nm -S. This enables:

1. Padding detection: Compare symbol sizes to gaps. If gap > size,
   padding was inserted, breaking contiguous array assumptions.

2. Pointer arithmetic bugs: Check if (end - start) marker span is a
   multiple of struct size.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
2025-12-13 16:28:53 -07:00
Simon Glass
72afce26be scripts: Add a script check consistency of linker lists
If linker lists have inconsistent alignment it can cause strange
runtime errors. Add a script that can detect and report these problems.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-29 06:53:46 -06:00