mirror of
https://github.com/apache/nuttx.git
synced 2026-05-31 14:27:37 +08:00
Add support for the loading of ET_DYN objects
* libs/libc/machine/arm/armv7-m/arch_elf.c
- Fix cast of error message parameters
* build-globals.sh
- Build the modlib_globals.S file used to resolve symbols when dynamically loading
* libs/libc/modlib/Make.defs
- Build modlib_globals.S for all targets
* libs/libc/modlib/modlib_load.c
- Calculate sizes and text/data addresses based on program headers rather than section headers
- Handle objects with no program headers
* libs/libc/modlib/modlib_bind.c
- Call modlib_readsym with pointer to symbol table
- Add modlib_relocatedyn to manage relocation of symbols with shared object (ET_DYN)
- Differentiate between ET_REL and ET_DYN objects
- Use arch independent symbol ELF_R_SYM
- Cast sizes to avoid warnings
* libs/libc/modlib/modlib_load.c
- Cast sizes to avoid warnings
* include/elf.h
- Add definitions that may be found in shared objects
* include/nuttx/lib/modlib.h
- Add parameter to modlib_readsym prototype
- Add prototypes for:
- modlib_insertsymtab
- modlib_findglobal
- Define Elf_Dyn and Elf_Off according to the elf architecture
- Add fields to mod_loadifno_s:
- Program headers
- Exported symbols
- Data section address
- Padding requirement
- Section index for dynamic symbol table
- Number of symbols exported
- Add prottotype for modlib_freesymtab
* libs/libc/dlfcn/lib_dlclose.c
- Free the symbol table when the dll is closed
* libs/libc/dlfcn/lib_dlopen.c
- Add dump of program headers to debug routine
- Differentiate between ET_REL and ET_DYN objects
* libs/libc/machine/arm/armv7-m/arch_elf.c
- Add handling of R_ARM_RELATIVE and R_ARM_JUMP slot relocation types
* libs/libc/modlib/modlib_loadshdrs.c
- Rename modlib_loadshdrs.c to modlib_loadhdrs.c
- Rename modlib_loadshdrs to modlib_loadhdrs
- Add code to load program headers
* libs/libc/modlib/modlib_symbols.c
- Define entry point structure
- Add offset parameter to modlib_symname() and use to find symbol names
- Add symtab section header parameter to modlib_readsym()
- Add offset parameter to modlib_symvalue() to locate symbol names
- Add modlib_insertsyntab() to create a symbol table for exporting and resolution
- Add findEP() to resolve a symbol in the modlib_global table
- Add modlib_findglobal() to find symbol in the modlib_global table
- Add modlib_freesymtab() to free the symbol table
* libs/libc/modlib/modlib_uninit.c
- Free header and sections from a module_loadinfo_s control block
* libs/libc/modlib/modlib_verify.c
- Handle ET_DYN shared objects
* libs/libc/modlib/modlib_globals.S
- Multi-target global table
- Define library APIs that may be resolved when loading a shared object
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
f0107683d5
commit
fec789047a
@@ -122,7 +122,8 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr)
|
||||
*/
|
||||
|
||||
relotype = ELF32_R_TYPE(rel->r_info);
|
||||
if (sym == NULL && relotype != R_ARM_NONE && relotype != R_ARM_V4BX)
|
||||
if (sym == NULL && relotype != R_ARM_NONE && relotype != R_ARM_V4BX &&
|
||||
relotype != R_ARM_RELATIVE && relotype != R_ARM_JUMP_SLOT)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -492,6 +493,15 @@ int up_relocate(const Elf32_Rel *rel, const Elf32_Sym *sym, uintptr_t addr)
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_RELATIVE :
|
||||
case R_ARM_JUMP_SLOT :
|
||||
{
|
||||
binfo("Relocating: RELATIVE/JUMP_SLOT at %p value: %08lx with %08lx\n",
|
||||
(void *)addr,*(unsigned log *) addr, (unsigned long) sym->st_value);
|
||||
*(uint32_t *) addr = (uint32_t) sym->st_value;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
berr("ERROR: Unsupported relocation: %" PRId32 "\n",
|
||||
ELF32_R_TYPE(rel->r_info));
|
||||
|
||||
Reference in New Issue
Block a user