From 78797dc1da9ec0fd039e73ad289683ffd3e9c76a Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 25 Nov 2020 20:24:27 +0900 Subject: [PATCH] binfmt/libnxflat/libnxflat_bind.c: Fix syslog formats --- binfmt/libnxflat/libnxflat_bind.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/binfmt/libnxflat/libnxflat_bind.c b/binfmt/libnxflat/libnxflat_bind.c index fb012d9f9b..ec038bc0fd 100644 --- a/binfmt/libnxflat/libnxflat_bind.c +++ b/binfmt/libnxflat/libnxflat_bind.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -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; } @@ -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; } @@ -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; @@ -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 @@ -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); @@ -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); } }