|
Message-Id: <20240328200319.4016902-3-jcmvbkbc@gmail.com> Date: Thu, 28 Mar 2024 13:03:19 -0700 From: Max Filippov <jcmvbkbc@...il.com> To: musl@...ts.openwall.com Cc: Rich Felker <dalias@...c.org>, Max Filippov <jcmvbkbc@...il.com> Subject: [RFC v2 2/2] WIP xtensa bits Signed-off-by: Max Filippov <jcmvbkbc@...il.com> --- ldso/dlstart.c | 3 +++ ldso/dynlink.c | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ldso/dlstart.c b/ldso/dlstart.c index 259f5e18eecf..a1c257860e96 100644 --- a/ldso/dlstart.c +++ b/ldso/dlstart.c @@ -96,6 +96,9 @@ hidden void _dlstart_c(size_t *sp, size_t *dynv) *rel_addr = rel[2] + segs[j].addr - segs[j].p_vaddr + val; } } +#ifdef __xtensa__ + ((unsigned long *)dyn[DT_PLTGOT])[3] = segs[0].addr - segs[0].p_vaddr; +#endif #else /* If the dynamic linker is invoked as a command, its load * address is not available in the aux vector. Instead, compute diff --git a/ldso/dynlink.c b/ldso/dynlink.c index 324aa85919f0..9be79c8f8227 100644 --- a/ldso/dynlink.c +++ b/ldso/dynlink.c @@ -402,7 +402,11 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri reuse_addends = 1; skip_relative = 1; } - +#ifdef __xtensa__ + else { + dso->got[3] = dso->loadmap->segs[0].addr - dso->loadmap->segs[0].p_vaddr; + } +#endif for (; rel_size; rel+=stride, rel_size-=stride*sizeof(size_t)) { if (skip_relative && IS_RELATIVE(rel[1], dso->syms)) continue; type = R_TYPE(rel[1]); @@ -1422,6 +1426,7 @@ static void reloc_all(struct dso *p) if (!DL_FDPIC) do_relr_relocs(p, laddr(p, dyn[DT_RELR]), dyn[DT_RELRSZ]); +#if 0 if (head != &ldso && p->relro_start != p->relro_end) { long ret = __syscall(SYS_mprotect, laddr(p, p->relro_start), p->relro_end-p->relro_start, PROT_READ); @@ -1431,6 +1436,7 @@ static void reloc_all(struct dso *p) if (runtime) longjmp(*rtld_fail, 1); } } +#endif p->relocated = 1; } -- 2.39.2
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.