Skip to content

Commit

Permalink
ldelf: look for ta_head symbol
Browse files Browse the repository at this point in the history
Legacy TAs has their TA header as at the load address of the TA binary.
However, in commits to follow the TA header will instead be located in
the symbol ta_head located somewhere inside the ELF binary. So update
the ldelf to support the updated format while still supporting legacy
TAs.

Reviewed-by: Jerome Forissier <[email protected]>
Signed-off-by: Jens Wiklander <[email protected]>
  • Loading branch information
jenswi-linaro authored and jforissier committed Oct 13, 2023
1 parent 731185b commit 6cfa381
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ldelf/ta_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,8 @@ static void set_tls_offset(struct ta_elf *elf __unused) {}

static void load_main(struct ta_elf *elf)
{
vaddr_t va = 0;

init_elf(elf);
map_segments(elf);
populate_segments(elf);
Expand All @@ -1207,7 +1209,10 @@ static void load_main(struct ta_elf *elf)
if (elf->bti_enabled)
ta_elf_add_bti(elf);

elf->head = (struct ta_head *)elf->load_addr;
if (!ta_elf_resolve_sym("ta_head", &va, NULL, elf))
elf->head = (struct ta_head *)va;
else
elf->head = (struct ta_head *)elf->load_addr;
if (elf->head->depr_entry != UINT64_MAX) {
/*
* Legacy TAs sets their entry point in ta_head. For
Expand Down

0 comments on commit 6cfa381

Please sign in to comment.