You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2020/11/25 13:12:12 UTC

[incubator-nuttx] 35/35: binfmt/libnxflat/libnxflat_bind.c: Fix syslog formats

This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 78797dc1da9ec0fd039e73ad289683ffd3e9c76a
Author: YAMAMOTO Takashi <ya...@midokura.com>
AuthorDate: Wed Nov 25 20:24:27 2020 +0900

    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 fb012d9..ec038bc 100644
--- a/binfmt/libnxflat/libnxflat_bind.c
+++ b/binfmt/libnxflat/libnxflat_bind.c
@@ -25,6 +25,7 @@
 #include <nuttx/config.h>
 #include <nuttx/compiler.h>
 
+#include <inttypes.h>
 #include <stdint.h>
 #include <string.h>
 #include <nxflat.h>
@@ -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);
         }
     }