Commit 8f9ab18c authored by Luca Burelli's avatar Luca Burelli Committed by Benjamin Cabé
Browse files

llext: (cosmetic) log uniformity cleanups



Use the more compact %#x format for printing out hexadecimal values in
the LLEXT subsystem. This also uses a clearer wording for the
llext_link() log message that avoids repeating information.

No functional change is introduced by this commit.

Signed-off-by: default avatarLuca Burelli <l.burelli@arduino.cc>
parent 111d7c37
Loading
Loading
Loading
Loading
+5 −8
Original line number Diff line number Diff line
@@ -195,7 +195,7 @@ int llext_lookup_symbol(struct llext_loader *ldr, struct llext *ext, uintptr_t *
			return -ENODATA;
		}

		LOG_INF("found symbol %s at 0x%lx", name, *link_addr);
		LOG_INF("found symbol %s at %#lx", name, *link_addr);
	} else if (sym->st_shndx == SHN_ABS) {
		/* Absolute symbol */
		*link_addr = sym->st_value;
@@ -220,7 +220,7 @@ int llext_lookup_symbol(struct llext_loader *ldr, struct llext *ext, uintptr_t *
			(uintptr_t)llext_loaded_sect_ptr(ldr, ext, sym->st_shndx) + sym->st_value;
	} else {
		LOG_ERR("cannot apply relocation: "
			"target symbol has unexpected section index %d (0x%X)",
			"target symbol has unexpected section index %d (%#x)",
			sym->st_shndx, sym->st_shndx);
		return -ENOEXEC;
	}
@@ -492,18 +492,15 @@ int llext_link(struct llext_loader *ldr, struct llext *ext, const struct llext_l
					return ret;
				}

				LOG_DBG("relocation %d:%d info 0x%zx (type %zd, sym %zd) offset %zd"
				LOG_DBG("relocation %d:%d info %#zx (type %zd, sym %zd) offset %zd"
					" sym_name %s sym_type %d sym_bind %d sym_ndx %d",
					i, j, (size_t)rel.r_info, (size_t)ELF_R_TYPE(rel.r_info),
					(size_t)ELF_R_SYM(rel.r_info), (size_t)rel.r_offset,
					name, ELF_ST_TYPE(sym.st_info),
					ELF_ST_BIND(sym.st_info), sym.st_shndx);

				LOG_INF("writing relocation symbol %s type %zd sym %zd at addr "
					"0x%lx addr 0x%lx",
					name, (size_t)ELF_R_TYPE(rel.r_info),
					(size_t)ELF_R_SYM(rel.r_info),
					op_loc, link_addr);
				LOG_INF("writing relocation type %d at %#lx with symbol %s (%#lx)",
					(int)ELF_R_TYPE(rel.r_info), op_loc, name, link_addr);
			}
#endif /* CONFIG_LLEXT_LOG_LEVEL */

+6 −6
Original line number Diff line number Diff line
@@ -162,8 +162,8 @@ static int llext_find_tables(struct llext_loader *ldr, struct llext *ext)
	for (i = 0, table_cnt = 0; i < ext->sect_cnt && table_cnt < 3; ++i) {
		elf_shdr_t *shdr = ext->sect_hdrs + i;

		LOG_DBG("section %d at 0x%zx: name %d, type %d, flags 0x%zx, "
			"addr 0x%zx, size %zd, link %d, info %d",
		LOG_DBG("section %d at %#zx: name %d, type %d, flags %#zx, "
			"addr %#zx, size %zd, link %d, info %d",
			i,
			(size_t)shdr->sh_offset,
			shdr->sh_name,
@@ -410,8 +410,8 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
				     x->sh_addr + x->sh_size > y->sh_addr) ||
				    (y->sh_addr <= x->sh_addr &&
				     y->sh_addr + y->sh_size > x->sh_addr)) {
					LOG_ERR("Region %d VMA range (0x%zx +%zd) "
						"overlaps with %d (0x%zx +%zd)",
					LOG_ERR("Region %d VMA range (%#zx +%zd) "
						"overlaps with %d (%#zx +%zd)",
						i, (size_t)x->sh_addr, (size_t)x->sh_size,
						j, (size_t)y->sh_addr, (size_t)y->sh_size);
					return -ENOEXEC;
@@ -431,8 +431,8 @@ static int llext_map_sections(struct llext_loader *ldr, struct llext *ext,
			     x->sh_offset + x->sh_size > y->sh_offset) ||
			    (y->sh_offset <= x->sh_offset &&
			     y->sh_offset + y->sh_size > x->sh_offset)) {
				LOG_ERR("Region %d ELF file range (0x%zx +%zd) "
					"overlaps with %d (0x%zx +%zd)",
				LOG_ERR("Region %d ELF file range (%#zx +%zd) "
					"overlaps with %d (%#zx +%zd)",
					i, (size_t)x->sh_offset, (size_t)x->sh_size,
					j, (size_t)y->sh_offset, (size_t)y->sh_size);
				return -ENOEXEC;
+2 −2
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ static void llext_init_mem_part(struct llext *ext, enum llext_mem mem_idx,
	}
#endif

	LOG_DBG("region %d: start 0x%zx, size %zd", mem_idx, (size_t)start, len);
	LOG_DBG("region %d: start %#zx, size %zd", mem_idx, (size_t)start, len);
}

static int llext_copy_region(struct llext_loader *ldr, struct llext *ext,
@@ -181,7 +181,7 @@ int llext_copy_regions(struct llext_loader *ldr, struct llext *ext,

			/* only show sections mapped to program memory */
			if (mem_idx < LLEXT_MEM_EXPORT) {
				LOG_DBG("-s %s 0x%zx", name,
				LOG_DBG("-s %s %#zx", name,
					(size_t)ext->mem[mem_idx] + ldr->sect_map[i].offset);
			}
		}