lib: launch: implement passing args and environment variables to new tasks
This commit is contained in:
@@ -300,8 +300,14 @@ static enum launch_status map_executable(struct elf_image *image)
|
||||
|
||||
static elf_sym_t *get_dynsym(struct elf_image *image, size_t index)
|
||||
{
|
||||
return (elf_sym_t *)(image->e_local_base + image->e_dynsym
|
||||
+ (index * image->e_dynsym_entsize));
|
||||
elf_sym_t *sym = (elf_sym_t *)(image->e_local_base + image->e_dynsym
|
||||
+ (index * image->e_dynsym_entsize));
|
||||
|
||||
if (!sym->st_value) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return sym;
|
||||
}
|
||||
|
||||
static enum launch_status do_rela(struct elf_image *image, elf_rela_t *rela)
|
||||
@@ -312,6 +318,10 @@ static enum launch_status do_rela(struct elf_image *image, elf_rela_t *rela)
|
||||
switch (type) {
|
||||
case R_X86_64_JUMP_SLOT:
|
||||
sym = get_dynsym(image, ELF64_R_SYM(rela->r_info));
|
||||
if (!sym) {
|
||||
return LAUNCH_ERR_MISSING_SYMBOL;
|
||||
}
|
||||
|
||||
*(uint64_t *)(image->e_local_base + rela->r_offset)
|
||||
= image->e_remote_base + sym->st_value + rela->r_addend;
|
||||
kern_tracef(
|
||||
@@ -354,7 +364,7 @@ static enum launch_status do_rela_list(
|
||||
rela = (elf_rela_t *)((char *)rela + entsize);
|
||||
}
|
||||
|
||||
return LAUNCH_OK;
|
||||
return status;
|
||||
}
|
||||
|
||||
static enum launch_status do_rel(
|
||||
|
||||
Reference in New Issue
Block a user