mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 12:15:32 +08:00
[include][dbg]update: no longer use RT_DEBUG_LOG in rtdebug.h (#7750)
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user