Skip to content

Commit

Permalink
binfmt/libnxflat/libnxflat_bind.c: Fix syslog formats
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt authored and xiaoxiang781216 committed Nov 25, 2020
1 parent ca2cc51 commit 78797dc
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions binfmt/libnxflat/libnxflat_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>

#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <nxflat.h>
Expand Down Expand Up @@ -82,20 +83,22 @@ static inline int nxflat_bindrel32i(FAR struct nxflat_loadinfo_s *loadinfo,
{
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));

if (offset < loadinfo->dsize)
{
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));
binfo(" After: %08x\n", *addr);
binfo(" After: %08" PRIx32 "\n", *addr);
return OK;
}
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);
return -EINVAL;
}
Expand All @@ -122,20 +125,21 @@ static inline int nxflat_bindrel32d(FAR struct nxflat_loadinfo_s *loadinfo,
{
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);

if (offset < loadinfo->dsize)
{
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);
binfo(" After: %08x\n", *addr);
binfo(" After: %08" PRIx32 "\n", *addr);
return OK;
}
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);
return -EINVAL;
}
Expand Down Expand Up @@ -314,8 +318,8 @@ static inline int nxflat_gotrelocs(FAR struct nxflat_loadinfo_s *loadinfo)

default:
{
berr("ERROR: Unrecognized relocation type: %d\n",
NXFLAT_RELOC_TYPE(reloc.r_info));
berr("ERROR: Unrecognized relocation type: %" PRId32 "\n",
(uint32_t)NXFLAT_RELOC_TYPE(reloc.r_info));
result = -EINVAL;
}
break;
Expand Down Expand Up @@ -393,7 +397,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,

offset = ntohl(hdr->h_importsymbols);
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
* CONFIG_ARCH_ADDRENV=y, then that D-Space allocation lies in an address
Expand Down Expand Up @@ -438,7 +442,8 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,

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,
imports[i].i_funcaddress);

Expand Down Expand Up @@ -474,7 +479,7 @@ static inline int nxflat_bindimports(FAR struct nxflat_loadinfo_s *loadinfo,

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);
}
}
Expand Down

0 comments on commit 78797dc

Please sign in to comment.