binfmt/libnxflat/libnxflat_bind.c: Fix syslog formats

This commit is contained in:
YAMAMOTO Takashi 2020-11-25 20:24:27 +09:00 committed by Xiang Xiao
parent ca2cc5133d
commit 78797dc1da

View File

@ -25,6 +25,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <nuttx/compiler.h> #include <nuttx/compiler.h>
#include <inttypes.h>
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <nxflat.h> #include <nxflat.h>
@ -82,20 +83,22 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
{ {
FAR uint32_t *addr; FAR uint32_t *addr;
binfo("NXFLAT_RELOC_TYPE_REL32I Offset: %08x I-Space: %p\n", binfo("NXFLAT_RELOC_TYPE_REL32I Offset: %08" PRIx32
" I-Space: %" PRIxPTR "\n",
offset, loadinfo->ispace + sizeof(struct nxflat_hdr_s)); offset, loadinfo->ispace + sizeof(struct nxflat_hdr_s));
if (offset < loadinfo->dsize) if (offset < loadinfo->dsize)
{ {
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region); addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
binfo(" Before: %08x\n", *addr); binfo(" Before: %08" PRIx32 "\n", *addr);
*addr += (uint32_t)(loadinfo->ispace + sizeof(struct nxflat_hdr_s)); *addr += (uint32_t)(loadinfo->ispace + sizeof(struct nxflat_hdr_s));
binfo(" After: %08x\n", *addr); binfo(" After: %08" PRIx32 "\n", *addr);
return OK; return OK;
} }
else else
{ {
berr("Offset: %08 does not lie in D-Space size: %08x\n", berr("Offset: %08" PRIx32 " does not lie in "
"D-Space size: %08" PRIx32 "\n",
offset, loadinfo->dsize); offset, loadinfo->dsize);
return -EINVAL; return -EINVAL;
} }
@ -122,20 +125,21 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
{ {
FAR uint32_t *addr; FAR uint32_t *addr;
binfo("NXFLAT_RELOC_TYPE_REL32D Offset: %08x D-Space: %p\n", binfo("NXFLAT_RELOC_TYPE_REL32D Offset: %08" PRIx32 " D-Space: %p\n",
offset, loadinfo->dspace->region); offset, loadinfo->dspace->region);
if (offset < loadinfo->dsize) if (offset < loadinfo->dsize)
{ {
addr = (FAR uint32_t *)(offset + loadinfo->dspace->region); addr = (FAR uint32_t *)(offset + loadinfo->dspace->region);
binfo(" Before: %08x\n", *addr); binfo(" Before: %08" PRIx32 "\n", *addr);
*addr += (uint32_t)(loadinfo->dspace->region); *addr += (uint32_t)(loadinfo->dspace->region);
binfo(" After: %08x\n", *addr); binfo(" After: %08" PRIx32 "\n", *addr);
return OK; return OK;
} }
else else
{ {
berr("Offset: %08 does not lie in D-Space size: %08x\n", berr("Offset: %08" PRIx32 " does not lie in "
"D-Space size: %08" PRIx32 "\n",
offset, loadinfo->dsize); offset, loadinfo->dsize);
return -EINVAL; return -EINVAL;
} }
@ -314,8 +318,8 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)
default: default:
{ {
berr("ERROR: Unrecognized relocation type: %d\n", berr("ERROR: Unrecognized relocation type: %" PRId32 "\n",
NXFLAT_RELOC_TYPE(reloc.r_info)); (uint32_t)NXFLAT_RELOC_TYPE(reloc.r_info));
result = -EINVAL; result = -EINVAL;
} }
break; break;
@ -393,7 +397,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
offset = ntohl(hdr->h_importsymbols); offset = ntohl(hdr->h_importsymbols);
nimports = ntohs(hdr->h_importcount); nimports = ntohs(hdr->h_importcount);
binfo("Imports offset: %08x nimports: %d\n", offset, nimports); binfo("Imports offset: %08" PRIx32 " nimports: %d\n", offset, nimports);
/* The import[] table resides within the D-Space allocation. If /* The import[] table resides within the D-Space allocation. If
* CONFIG_ARCH_ADDRENV=y, then that D-Space allocation lies in an address * CONFIG_ARCH_ADDRENV=y, then that D-Space allocation lies in an address
@ -438,7 +442,8 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
for (i = 0; i < nimports; i++) for (i = 0; i < nimports; i++)
{ {
binfo("Import[%d] (%08p) offset: %08x func: %08x\n", binfo("Import[%d] (%p) "
"offset: %08" PRIx32 " func: %08" PRIx32 "\n",
i, &imports[i], imports[i].i_funcname, i, &imports[i], imports[i].i_funcname,
imports[i].i_funcaddress); imports[i].i_funcaddress);
@ -474,7 +479,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,
imports[i].i_funcaddress = (uint32_t)symbol->sym_value; imports[i].i_funcaddress = (uint32_t)symbol->sym_value;
binfo("Bound import[%d] (%08p) to export '%s' (%08x)\n", binfo("Bound import[%d] (%p) to export '%s' (%08" PRIx32 ")\n",
i, &imports[i], symname, imports[i].i_funcaddress); i, &imports[i], symname, imports[i].i_funcaddress);
} }
} }