diff options
| author | Shicheng Chu <[email protected]> | 2023-06-29 23:24:25 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-29 11:24:25 -0400 |
| commit | e2c031643c8dec7c9ea1581216e19bf19c8f73f0 (patch) | |
| tree | 926536732e7472c5e86ac5198b239d82f9f55da4 /components/libc | |
| parent | 148ae53cf8d3abc2c2e11c94c171b123b950b2fc (diff) | |
[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)
Diffstat (limited to 'components/libc')
| -rw-r--r-- | components/libc/posix/libdl/arch/arm.c | 34 | ||||
| -rw-r--r-- | components/libc/posix/libdl/arch/riscv.c | 16 | ||||
| -rw-r--r-- | components/libc/posix/libdl/arch/x86.c | 18 |
3 files changed, 46 insertions, 22 deletions
diff --git a/components/libc/posix/libdl/arch/arm.c b/components/libc/posix/libdl/arch/arm.c index 6a884bdb54..a1ab506a55 100644 --- a/components/libc/posix/libdl/arch/arm.c +++ b/components/libc/posix/libdl/arch/arm.c @@ -12,6 +12,15 @@ #include "../dlelf.h" #ifdef __arm__ + +#define DBG_TAG "kernel.module" +#ifdef RT_DEBUG_MODULE +#define DBG_LVL DBG_LOG +#else +#define DBG_LVL DBG_WARNING +#endif /* defined (RT_DEBUG_MODULE) */ +#include <rtdbg.h> + int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym_val) { Elf32_Addr *where, tmp; @@ -27,8 +36,8 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym break; case R_ARM_ABS32: *where += (Elf32_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_ABS32: %x -> %x\n", - where, *where)); + LOG_D("R_ARM_ABS32: %x -> %x", + where, *where); break; case R_ARM_PC24: case R_ARM_PLT32: @@ -40,14 +49,13 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym tmp = sym_val - (Elf32_Addr)where + (addend << 2); tmp >>= 2; *where = (*where & 0xff000000) | (tmp & 0x00ffffff); - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_PC24: %x -> %x\n", - where, *where)); + LOG_D("R_ARM_PC24: %x -> %x", + where, *where); break; case R_ARM_REL32: *where += sym_val - (Elf32_Addr)where; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_REL32: %x -> %x, sym %x, offset %x\n", - where, *where, sym_val, rel->r_offset)); + LOG_D("R_ARM_REL32: %x -> %x, sym %x, offset %x", + where, *where, sym_val, rel->r_offset); break; case R_ARM_V4BX: *where &= 0xf000000f; @@ -57,22 +65,22 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: *where = (Elf32_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + LOG_D("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x", + where, *where, sym_val); break; #if 0 /* To do */ case R_ARM_GOT_BREL: temp = (Elf32_Addr)sym_val; *where = (Elf32_Addr)&temp; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_GOT_BREL: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + LOG_D("R_ARM_GOT_BREL: 0x%x -> 0x%x 0x%x", + where, *where, sym_val); break; #endif case R_ARM_RELATIVE: *where = (Elf32_Addr)sym_val + *where; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + LOG_D("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x", + where, *where, sym_val); break; case R_ARM_THM_CALL: case R_ARM_THM_JUMP24: diff --git a/components/libc/posix/libdl/arch/riscv.c b/components/libc/posix/libdl/arch/riscv.c index c7c454e168..cf0eb193af 100644 --- a/components/libc/posix/libdl/arch/riscv.c +++ b/components/libc/posix/libdl/arch/riscv.c @@ -26,6 +26,14 @@ #define R_RISCV_TLS_TPREL32 10 #define R_RISCV_TLS_TPREL64 11 +#define DBG_TAG "kernel.module" +#ifdef RT_DEBUG_MODULE +#define DBG_LVL DBG_LOG +#else +#define DBG_LVL DBG_WARNING +#endif /* defined (RT_DEBUG_MODULE) */ +#include <rtdbg.h> + int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val) { Elf64_Addr *where, tmp; @@ -41,18 +49,18 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf_Rel *rel, Elf_Addr sym_val break; case R_RISCV_64: *where = (Elf64_Addr)(sym_val + rel->r_addend); - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_RISCV_64: %x -> %x\n",where, *where)); + LOG_D("R_RISCV_64: %x -> %x",where, *where); break; case R_RISCV_RELATIVE: *where = (Elf64_Addr)((rt_uint8_t *)module->mem_space - module->vstart_addr + rel->r_addend); - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_RISCV_RELATIVE: %x -> %x\n",where, *where)); + LOG_D("R_RISCV_RELATIVE: %x -> %x",where, *where); break; case R_RISCV_JUMP_SLOT: *where = (Elf64_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_RISCV_JUMP_SLOT: %x -> %x\n",where, *where)); + LOG_D("R_RISCV_JUMP_SLOT: %x -> %x",where, *where); break; default: - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("__riscv__ELF: invalid relocate TYPE %d\n", ELF64_R_TYPE(rel->r_info))); + LOG_D("__riscv__ELF: invalid relocate TYPE %d", ELF64_R_TYPE(rel->r_info)); return -1; } return 0; diff --git a/components/libc/posix/libdl/arch/x86.c b/components/libc/posix/libdl/arch/x86.c index e7ad714a03..b309ab8c13 100644 --- a/components/libc/posix/libdl/arch/x86.c +++ b/components/libc/posix/libdl/arch/x86.c @@ -13,6 +13,14 @@ #ifdef __i386__ +#define DBG_TAG "kernel.module" +#ifdef RT_DEBUG_MODULE +#define DBG_LVL DBG_LOG +#else +#define DBG_LVL DBG_WARNING +#endif /* defined (RT_DEBUG_MODULE) */ +#include <rtdbg.h> + #define R_X86_64_GLOB_DAT 6 /* Create GOT entry */ #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry */ #define R_X86_64_RELATIVE 8 /* Adjust by program base */ @@ -32,16 +40,16 @@ int dlmodule_relocate(struct rt_dlmodule *module, Elf32_Rel *rel, Elf32_Addr sym case R_X86_64_JUMP_SLOT: *where = (Elf32_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_X86_64_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", - (uint32_t)where, *where, sym_val)); + LOG_D("R_X86_64_JUMP_SLOT: 0x%x -> 0x%x 0x%x", + (uint32_t)where, *where, sym_val); break; case R_X86_64_RELATIVE: *where = (Elf32_Addr)sym_val + *where; - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_X86_64_RELATIVE: 0x%x -> 0x%x 0x%x\n", - (uint32_t)where, *where, sym_val)); + LOG_D("R_X86_64_RELATIVE: 0x%x -> 0x%x 0x%x", + (uint32_t)where, *where, sym_val); break; default: - RT_DEBUG_LOG(RT_DEBUG_MODULE, ("X86ELF: invalid relocate TYPE %d\n", ELF32_R_TYPE(rel->r_info))); + LOG_D("X86ELF: invalid relocate TYPE %d", ELF32_R_TYPE(rel->r_info)); return -1; } |
