diff options
author | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-04-07 18:40:25 +0100 |
---|---|---|
committer | Szabolcs Nagy <szabolcs.nagy@arm.com> | 2022-11-22 14:31:25 +0000 |
commit | a5750ba400ec9a2561ac58700fc4ee76491b3984 (patch) | |
tree | e85371d10ce37d82506893b51c1f30c1f0546170 /csu/libc-start.c | |
parent | 90c5142f771b318dc905faf02162a01b8f546460 (diff) | |
download | glibc-a5750ba400ec9a2561ac58700fc4ee76491b3984.tar.gz glibc-a5750ba400ec9a2561ac58700fc4ee76491b3984.tar.xz glibc-a5750ba400ec9a2561ac58700fc4ee76491b3984.zip |
cheri: elf: elfptr_t fixes for preinit/init/fini array
According to the ELF spec: "Each element of this array is a pointer to a function to be executed by the dynamic linker." "Note that the address of a function need not be the same as a pointer to a function as defined by the processor supplement." so these should be accessed via uintptr_t type instead of ElfW(Addr) and the pointers are derived from the RX pointer of the elf module.
Diffstat (limited to 'csu/libc-start.c')
-rw-r--r-- | csu/libc-start.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/csu/libc-start.c b/csu/libc-start.c index 09235865bd..d71fbec3fe 100644 --- a/csu/libc-start.c +++ b/csu/libc-start.c @@ -132,15 +132,15 @@ call_init (int argc, char **argv, char **env) the same file. */ if (ELF_INITFINI && l->l_info[DT_INIT] != NULL) - DL_CALL_DT_INIT(l, l->l_addr + l->l_info[DT_INIT]->d_un.d_ptr, + DL_CALL_DT_INIT(l, dl_rx_ptr (l, l->l_info[DT_INIT]->d_un.d_ptr), argc, argv, env); ElfW(Dyn) *init_array = l->l_info[DT_INIT_ARRAY]; if (init_array != NULL) { unsigned int jm - = l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (ElfW(Addr)); - ElfW(Addr) *addrs = (void *) (init_array->d_un.d_ptr + l->l_addr); + = l->l_info[DT_INIT_ARRAYSZ]->d_un.d_val / sizeof (elfptr_t); + elfptr_t *addrs = (void *) dl_rx_ptr (l, init_array->d_un.d_ptr); for (unsigned int j = 0; j < jm; ++j) ((dl_init_t) addrs[j]) (argc, argv, env); } |