Commit 4b34163f authored by Luca Burelli's avatar Luca Burelli Committed by Benjamin Cabé
Browse files

llext: (cosmetic) llext_map_sections() cleanups



Add a 'continue' statement when the first section of a region is
detected, to avoid unnecessary indentation.

No functional change is introduced in this commit.

Signed-off-by: default avatarLuca Burelli <l.burelli@arduino.cc>
parent 05c3775f
Loading
Loading
Loading
Loading
+60 −57
Original line number Diff line number Diff line
@@ -291,9 +291,11 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
		elf_shdr_t *region = ldr->sects + mem_idx;

		/*
		 * ELF objects can have sections for memory regions, detached from
		 * other sections of the same type. E.g. executable sections that will be
		 * placed in slower memory. Don't merge such sections into main regions
		 * Some applications may require specific ELF sections to not
		 * be included in their default memory regions; e.g. the ELF
		 * file may contain executable sections that are designed to be
		 * placed in slower memory. Don't merge such sections into main
		 * regions.
		 */
		if (ldr_parm->section_detached && ldr_parm->section_detached(shdr)) {
			continue;
@@ -304,8 +306,10 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
			 * region descriptor.
			 */
			memcpy(region, shdr, sizeof(*region));
		} else {
			/* Make sure this section is compatible with the region */
			continue;
		}

		/* Make sure this section is compatible with the existing region */
		if ((shdr->sh_flags & SHF_BASIC_TYPE_MASK) !=
		    (region->sh_flags & SHF_BASIC_TYPE_MASK)) {
			LOG_ERR("Unsupported section flags %#x / %#x for %s (region %d)",
@@ -344,8 +348,8 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
			 */
			if (shdr->sh_addr - region->sh_addr !=
			    shdr->sh_offset - region->sh_offset) {
					LOG_ERR("Incompatible section addresses "
						"for %s (region %d)", name, mem_idx);
				LOG_ERR("Incompatible section addresses for %s (region %d)",
					name, mem_idx);
				return -ENOEXEC;
			}
		}
@@ -363,7 +367,6 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
		region->sh_offset = bot_ofs;
		region->sh_size = top_ofs - bot_ofs;
	}
	}

	/*
	 * Test that no computed region overlaps. This can happen if sections of