From 3e3364d1a924f29aee26898eae20e60f9378332d Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Mon, 31 Oct 2022 00:10:24 +0800 Subject: [PATCH] Fix the format string mismatch warning Signed-off-by: Xiang Xiao --- arch/arm/src/cxd56xx/cxd56_timer.c | 4 ++-- libs/libc/machine/arm/armv6-m/arch_elf.c | 4 ++-- libs/libc/machine/arm/armv7-a/arch_elf.c | 10 +++++----- libs/libc/machine/arm/armv7-m/arch_elf.c | 16 ++++++++-------- libs/libc/machine/arm/armv8-m/arch_elf.c | 16 ++++++++-------- 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/arch/arm/src/cxd56xx/cxd56_timer.c b/arch/arm/src/cxd56xx/cxd56_timer.c index 4369b5d2d59..9c93907c9a5 100644 --- a/arch/arm/src/cxd56xx/cxd56_timer.c +++ b/arch/arm/src/cxd56xx/cxd56_timer.c @@ -379,8 +379,8 @@ static int cxd56_settimeout(struct timer_lowerhalf_s *lower, if (timeout < 1 || timeout > TIMER_MAXTIMEOUT) { - tmrerr("ERROR: Cannot represent timeout=%lu > %lu\n", timeout, - TIMER_MAXTIMEOUT); + tmrerr("ERROR: Cannot represent timeout=%" PRIu32 " > %lu\n", + timeout, TIMER_MAXTIMEOUT); return -ERANGE; } diff --git a/libs/libc/machine/arm/armv6-m/arch_elf.c b/libs/libc/machine/arm/armv6-m/arch_elf.c index 3bdad9d5999..60001cbf859 100644 --- a/libs/libc/machine/arm/armv6-m/arch_elf.c +++ b/libs/libc/machine/arm/armv6-m/arch_elf.c @@ -423,8 +423,8 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ - binfo(" offset=%08lx branch target=%08lx\n", - (long)offset, offset + sym->st_value); + binfo(" offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", + offset, offset + sym->st_value); offset += sym->st_value; diff --git a/libs/libc/machine/arm/armv7-a/arch_elf.c b/libs/libc/machine/arm/armv7-a/arch_elf.c index a8f7ac33679..1ecacf3de7b 100644 --- a/libs/libc/machine/arm/armv7-a/arch_elf.c +++ b/libs/libc/machine/arm/armv7-a/arch_elf.c @@ -307,8 +307,8 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ - binfo(" offset=%08lx branch target=%08lx\n", - (long)offset, offset + sym->st_value); + binfo(" offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", + offset, offset + sym->st_value); offset += sym->st_value; @@ -413,7 +413,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ binfo(" S=%" PRId32 " J1=%" PRId32 " J2=%" PRId32 - " offset=%08" PRIx32 " branch target=%08lx\n", + " offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", S, J1, J2, offset, offset + sym->st_value - addr); offset += sym->st_value - addr; @@ -425,7 +425,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "requires odd offset, offset=%08lx\n", + "requires odd offset, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -436,7 +436,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (offset < (int32_t)0xff000000 || offset >= (int32_t)0x01000000) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "relocation out of range, branch target=%08lx\n", + "relocation out of range, branch target=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; diff --git a/libs/libc/machine/arm/armv7-m/arch_elf.c b/libs/libc/machine/arm/armv7-m/arch_elf.c index cbf454d38ce..c2e6c270565 100644 --- a/libs/libc/machine/arm/armv7-m/arch_elf.c +++ b/libs/libc/machine/arm/armv7-m/arch_elf.c @@ -159,7 +159,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) offset >= (int32_t) 0x02000000) { berr("ERROR: ERROR: PC24 [%" PRId32 "] " - "relocation out of range, offset=%08lx\n", + "relocation out of range, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -276,7 +276,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ binfo(" S=%" PRId32 " J1=%" PRId32 " J2=%" PRId32 - " offset=%08" PRIx32 " branch target=%08lx\n", + " offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", S, J1, J2, offset, offset + sym->st_value - addr); offset += sym->st_value - addr; @@ -288,7 +288,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "requires odd offset, offset=%08lx\n", + "requires odd offset, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -299,7 +299,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (offset < (int32_t)0xff000000 || offset >= (int32_t)0x01000000) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "relocation out of range, branch target=%08lx\n", + "relocation out of range, branch target=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -428,8 +428,8 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ - binfo(" offset=%08lx branch target=%08lx\n", - (long)offset, offset + sym->st_value); + binfo(" offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", + offset, offset + sym->st_value); offset += sym->st_value; @@ -469,7 +469,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0) { berr("ERROR: JUMP11 [%" PRId32 "] " - "requires odd offset, offset=%08lx\n", + "requires odd offset, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -480,7 +480,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (offset < (int32_t)0xfffff800 || offset >= (int32_t)0x0800) { berr("ERROR: JUMP11 [%" PRId32 "] " - "relocation out of range, branch target=%08lx\n", + "relocation out of range, branch target=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; diff --git a/libs/libc/machine/arm/armv8-m/arch_elf.c b/libs/libc/machine/arm/armv8-m/arch_elf.c index 2d2572e7bbf..d63e5edc7d3 100644 --- a/libs/libc/machine/arm/armv8-m/arch_elf.c +++ b/libs/libc/machine/arm/armv8-m/arch_elf.c @@ -159,7 +159,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) offset >= (int32_t) 0x02000000) { berr("ERROR: ERROR: PC24 [%" PRId32 "] " - "relocation out of range, offset=%08lx\n", + "relocation out of range, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -276,7 +276,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ binfo(" S=%" PRId32 " J1=%" PRId32 " J2=%" PRId32 - " offset=%08" PRIx32 " branch target=%08lx\n", + " offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", S, J1, J2, offset, offset + sym->st_value - addr); offset += sym->st_value - addr; @@ -288,7 +288,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "requires odd offset, offset=%08lx\n", + "requires odd offset, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -299,7 +299,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (offset < (int32_t)0xff000000 || offset >= (int32_t)0x01000000) { berr("ERROR: ERROR: JUMP24 [%" PRId32 "] " - "relocation out of range, branch target=%08lx\n", + "relocation out of range, branch target=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -428,8 +428,8 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) /* And perform the relocation */ - binfo(" offset=%08lx branch target=%08lx\n", - (long)offset, offset + sym->st_value); + binfo(" offset=%08" PRIx32 " branch target=%08" PRIx32 "\n", + offset, offset + sym->st_value); offset += sym->st_value; @@ -469,7 +469,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC && (offset & 1) == 0) { berr("ERROR: JUMP11 [%" PRId32 "] " - "requires odd offset, offset=%08lx\n", + "requires odd offset, offset=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -480,7 +480,7 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr) if (offset < (int32_t)0xfffff800 || offset >= (int32_t)0x0800) { berr("ERROR: JUMP11 [%" PRId32 "] " - "relocation out of range, branch target=%08lx\n", + "relocation out of range, branch target=%08" PRIx32 "\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL;