From: Max Filippov <jcmvbkbc@gmail.com>
To: musl@lists.openwall.com
Cc: Rich Felker <dalias@libc.org>, Max Filippov <jcmvbkbc@gmail.com>
Subject: [musl] [RFC v2 2/2] WIP xtensa bits
Date: Thu, 28 Mar 2024 13:03:19 -0700 [thread overview]
Message-ID: <20240328200319.4016902-3-jcmvbkbc@gmail.com> (raw)
In-Reply-To: <20240328200319.4016902-1-jcmvbkbc@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.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
next prev parent reply other threads:[~2024-03-28 20:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 20:03 [musl] [RFC v2 0/2] xtensa FDPIC port Max Filippov
2024-03-28 20:03 ` [musl] [RFC v2 1/2] xtensa: add port Max Filippov
2024-03-28 20:03 ` Max Filippov [this message]
2024-03-28 23:01 ` [musl] [RFC v2 0/2] xtensa FDPIC port Rich Felker
2024-03-29 0:48 ` Max Filippov
2024-03-29 1:48 ` Rich Felker
2024-04-03 2:30 ` Max Filippov
2024-04-03 20:55 ` Rich Felker
2024-04-03 21:45 ` Rich Felker
2024-04-04 8:44 ` Max Filippov
2024-04-04 14:01 ` Rich Felker
2024-04-04 15:00 ` Rich Felker
2024-04-08 14:41 ` Rich Felker
2024-04-08 15:32 ` Rich Felker
2024-05-06 14:48 ` Rich Felker
2024-05-06 17:35 ` Max Filippov
2024-04-04 8:56 ` Max Filippov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328200319.4016902-3-jcmvbkbc@gmail.com \
--to=jcmvbkbc@gmail.com \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).