From 2a0140593f652f446464be1f0e01e5c1f9069a4b Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Mon, 25 Nov 2019 14:03:46 +0000 Subject: base, python: Allow dirname selection for the interpreter This is the second step towards being able to run dynamically linked applications when the guest ISA != than host ISA. Once the guest interpreter is loaded to memory, we are able to redirect shared object loads through the redirectPath interface. How do we load the guest interpreter? The elf file is for example asking for the /lib/ld-linux-aarch64.so interpreter. That would point to a valid dynamic linker/loader if guest ISA == host ISA, but if we are running on X86 we should point to the guest (aarch64 in the example) toolchain wherever it is installed. This patch is adding the --interp-dir option to point to the parent folder of the guest /lib in the host fs. Change-Id: Id27b97c060008d2e847776a49323d45c8809a27f Signed-off-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23066 Reviewed-by: Jason Lowe-Power Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/python/pybind11/core.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/python/pybind11') diff --git a/src/python/pybind11/core.cc b/src/python/pybind11/core.cc index 3523c0639..2cfaecd45 100644 --- a/src/python/pybind11/core.cc +++ b/src/python/pybind11/core.cc @@ -53,6 +53,7 @@ #include "base/addr_range.hh" #include "base/inet.hh" +#include "base/loader/elf_object.hh" #include "base/logging.hh" #include "base/random.hh" #include "base/socket.hh" @@ -202,6 +203,14 @@ init_net(py::module &m_native) ; } +static void +init_loader(py::module &m_native) +{ + py::module m = m_native.def_submodule("loader"); + + m.def("setInterpDir", &setInterpDir); +} + void pybind_init_core(py::module &m_native) { @@ -281,5 +290,6 @@ pybind_init_core(py::module &m_native) init_serialize(m_native); init_range(m_native); init_net(m_native); + init_loader(m_native); } -- cgit v1.2.3