Skip to content

Commit 8f349d4

Browse files
committed
Fix bug when plugging alignment holes
Not all sections are within segments, so add a check for that, otherwise 2 consecutive sections which aren't in segments will be treated as in the same segment, which will throw an error (see micropython/micropython#17073)
1 parent 294ea20 commit 8f349d4

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

elf/elf_file.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ void elf_file::remove_sh_holes(void) {
263263
&& (sh0->size && sh1.size)
264264
&& (sh0->addr + sh0->size < sh1.addr)
265265
&& (segment_from_virtual_address(sh0->addr) == segment_from_virtual_address(sh1.addr))
266+
&& segment_from_virtual_address(sh0->addr) != NULL
266267
) {
267268
uint32_t gap = sh1.addr - sh0->addr - sh0->size;
268269
if (gap > sh1.addralign) {

0 commit comments

Comments
 (0)