libs/libc/machine/risc-v/rv64/arch_elf.c: Fix syslog formats

This commit is contained in:
YAMAMOTO Takashi 2020-11-22 17:25:46 +09:00 committed by Xiang Xiao
parent 982061a9e0
commit c1f9d8adb1

View File

@ -24,6 +24,7 @@
#include <nuttx/config.h> #include <nuttx/config.h>
#include <inttypes.h>
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <debug.h> #include <debug.h>
@ -222,7 +223,7 @@ bool up_checkarch(FAR const Elf64_Ehdr *ehdr)
if ((ehdr->e_entry & 1) != 0) if ((ehdr->e_entry & 1) != 0)
{ {
berr("ERROR: Entry point is not properly aligned: %08x\n", berr("ERROR: Entry point is not properly aligned: %08" PRIx64 "\n",
ehdr->e_entry); ehdr->e_entry);
} }
@ -274,9 +275,9 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
{ {
/* NOTE: RELAX has no symbol, so just return */ /* NOTE: RELAX has no symbol, so just return */
binfo("%s at %08lx [%08x] \n", binfo("%s at %08" PRIxPTR " [%08" PRIx32 "] \n",
_get_rname(relotype), _get_rname(relotype),
(long)addr, _get_val((uint16_t *)addr)); addr, _get_val((uint16_t *)addr));
return OK; return OK;
} }
@ -292,10 +293,11 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
{ {
case R_RISCV_64: case R_RISCV_64:
{ {
binfo("%s at %08lx [%08x] to sym=%p st_value=%08lx\n", binfo("%s at %08" PRIxPTR " [%08" PRIx32 "] "
"to sym=%p st_value=%08" PRIx64 "\n",
_get_rname(relotype), _get_rname(relotype),
(long)addr, _get_val((uint16_t *)addr), addr, _get_val((uint16_t *)addr),
sym, (long)sym->st_value); sym, sym->st_value);
_set_val((uint16_t *)addr, _set_val((uint16_t *)addr,
(uint32_t)(sym->st_value + rel->r_addend)); (uint32_t)(sym->st_value + rel->r_addend));
@ -305,10 +307,11 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
case R_RISCV_PCREL_LO12_I: case R_RISCV_PCREL_LO12_I:
case R_RISCV_PCREL_LO12_S: case R_RISCV_PCREL_LO12_S:
{ {
binfo("%s at %08lx [%08x] to sym=%p st_value=%08lx\n", binfo("%s at %08" PRIxPTR " [%08" PRIx32 "] "
"to sym=%p st_value=%08" PRIx64 "\n",
_get_rname(relotype), _get_rname(relotype),
(long)addr, _get_val((uint16_t *)addr), addr, _get_val((uint16_t *)addr),
sym, (long)sym->st_value); sym, sym->st_value);
/* NOTE: imm value for mv has been adjusted in previous HI20 */ /* NOTE: imm value for mv has been adjusted in previous HI20 */
} }
@ -317,10 +320,11 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
case R_RISCV_PCREL_HI20: case R_RISCV_PCREL_HI20:
case R_RISCV_CALL: case R_RISCV_CALL:
{ {
binfo("%s at %08lx [%08x] to sym=%p st_value=%08lx\n", binfo("%s at %08" PRIxPTR " [%08" PRIx32 "] "
"to sym=%p st_value=%08" PRIx64 "\n",
_get_rname(relotype), _get_rname(relotype),
(long)addr, _get_val((uint16_t *)addr), addr, _get_val((uint16_t *)addr),
sym, (long)sym->st_value); sym, sym->st_value);
offset = (long)sym->st_value - (long)addr; offset = (long)sym->st_value - (long)addr;
@ -341,7 +345,7 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
(((int32_t)imm_lo >> 5) << 25) + (((int32_t)imm_lo >> 5) << 25) +
(((int32_t)imm_lo & 0x1f) << 7); (((int32_t)imm_lo & 0x1f) << 7);
binfo("imm_lo=%d (%x), val=%x \n", imm_lo, imm_lo, val); binfo("imm_lo=%ld (%lx), val=%x \n", imm_lo, imm_lo, val);
_add_val((uint16_t *)(addr + 4), val); _add_val((uint16_t *)(addr + 4), val);
} }
@ -370,7 +374,7 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
ASSERT(offset && val); ASSERT(offset && val);
binfo("offset for Bx=%ld (0x%x) (val=0x%08x) already set! \n", binfo("offset for Bx=%ld (0x%lx) (val=0x%08x) already set! \n",
offset, offset, val); offset, offset, val);
} }
break; break;
@ -393,7 +397,7 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
ASSERT(offset && val); ASSERT(offset && val);
binfo("offset for C.J=%ld (0x%x) (val=0x%04x) already set! \n", binfo("offset for C.J=%ld (0x%lx) (val=0x%04x) already set! \n",
offset, offset, val); offset, offset, val);
} }
break; break;
@ -416,13 +420,13 @@ int up_relocateadd(FAR const Elf64_Rela *rel, FAR const Elf64_Sym *sym,
ASSERT(offset && val); ASSERT(offset && val);
binfo("offset for C.Bx=%ld (0x%x) (val=0x%04x) already set!\n", binfo("offset for C.Bx=%ld (0x%lx) (val=0x%04x) already set!\n",
offset, offset, val); offset, offset, val);
} }
break; break;
default: default:
berr("ERROR: Unsupported relocation: %d\n", berr("ERROR: Unsupported relocation: %" PRId64 "\n",
ELF64_R_TYPE(rel->r_info)); ELF64_R_TYPE(rel->r_info));
ASSERT(false); ASSERT(false);
return -EINVAL; return -EINVAL;