summaryrefslogtreecommitdiff
path: root/ldso/ldso/ldso.c
diff options
context:
space:
mode:
authorMark Salter <msalter@redhat.com>2012-05-22 10:53:29 -0400
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2012-06-06 09:06:10 +0200
commit8554fb21bb34329201b38c2ae4387fb6f00645cc (patch)
tree462975e36aee3b3ff726e3300ead039e4da1fb3c /ldso/ldso/ldso.c
parent80c9bfc4668e2370b3434a801dc266f336265832 (diff)
Clean up DSBT support
The existing DSBT support relies on the kernel to provide DSBT info as part of the load maps passed to user space. The problem with this approach is that the DSBT info is in the dynamic section, so the kernel must access a userspace mapping of the dynamic section (or separately read a copy for the kernel) in order to retrieve the information needed by userspace. This patch reworks the DSBT support to remove the reliance on DSBT info coming from the kernel. Instead, ldso reads the info itself from the dynamic section. One other benefit of this is that it allows the existing kernel FDPIC loader to also load DSBT binaries. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'ldso/ldso/ldso.c')
-rw-r--r--ldso/ldso/ldso.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 8cfb03f9a..f2ba628b3 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -77,6 +77,10 @@ char *_dl_debug_bindings = NULL;
int _dl_debug_file = 2;
#endif
+#ifdef __DSBT__
+void **_dl_ldso_dsbt = NULL;
+#endif
+
unsigned long attribute_hidden _dl_skip_args = 0;
const char *_dl_progname = UCLIBC_LDSO; /* The name of the executable being run */
@@ -454,6 +458,11 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr,
_dl_progname = argv[0];
}
+#ifdef __DSBT__
+ _dl_ldso_dsbt = (void *)tpnt->dynamic_info[DT_DSBT_BASE_IDX];
+ _dl_ldso_dsbt[tpnt->dynamic_info[DT_DSBT_INDEX_IDX]] = _dl_ldso_dsbt;
+#endif
+
#ifndef __LDSO_STANDALONE_SUPPORT__
if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) {
_dl_dprintf(_dl_debug_file, "Standalone execution is not enabled\n");
@@ -688,6 +697,11 @@ of this helper program; chances are you did not intend to run this program.\n\
app_tpnt->mapaddr = app_mapaddr;
app_tpnt->rtld_flags = unlazy | RTLD_GLOBAL;
app_tpnt->usage_count++;
+#ifdef __DSBT__
+ _dl_ldso_dsbt[0] = app_tpnt->dsbt_table;
+ _dl_memcpy(app_tpnt->dsbt_table, _dl_ldso_dsbt,
+ app_tpnt->dsbt_size * sizeof(tpnt->dsbt_table[0]));
+#endif
lpnt = (unsigned long *) (app_tpnt->dynamic_info[DT_PLTGOT]);
#ifdef ALLOW_ZERO_PLTGOT
if (lpnt)