This commit is contained in:
Bigjango13 2024-02-07 01:45:52 -05:00
commit c433efaa61
2 changed files with 6 additions and 12 deletions

View File

@ -11,14 +11,6 @@ if(MCPI_IS_FLATPAK_BUILD)
set(QEMU_PATCH "sed" "-i" "s/libdrm/libdrm-dis/g" "<SOURCE_DIR>/meson.build")
endif()
# Inherit Make Jobserver ()If Present)
include(ProcessorCount)
ProcessorCount(NPROC)
set(MAKE "make" "-j${NPROC}")
if(CMAKE_GENERATOR STREQUAL "Unix Makefiles")
set(MAKE "$(MAKE)")
endif()
# Build
include(ExternalProject)
set(PKGCONFIG_ENV "")
@ -41,7 +33,7 @@ ExternalProject_Add(qemu
"--target-list=arm-linux-user"
"--without-default-features"
USES_TERMINAL_CONFIGURE TRUE
BUILD_COMMAND ${MAKE} "qemu-arm"
BUILD_COMMAND ninja "qemu-arm"
USES_TERMINAL_BUILD TRUE
INSTALL_COMMAND ""
TEST_COMMAND ""

View File

@ -13,10 +13,12 @@
// Load Symbol From ELF File
static void load_symbol(const char *source, const char *name, std::function<void(const unsigned char *, uint32_t)> callback) {
static std::unique_ptr<LIEF::ELF::Binary> binary = NULL;
if (binary == NULL) {
binary = LIEF::ELF::Parser::parse(source);
static std::unordered_map<std::string, std::unique_ptr<LIEF::ELF::Binary>> sources = {};
std::string cpp_source = source;
if (sources.count(cpp_source) == 0) {
sources[cpp_source] = LIEF::ELF::Parser::parse(source);
}
std::unique_ptr<LIEF::ELF::Binary> &binary = sources[cpp_source];
const LIEF::ELF::Symbol *symbol = binary->get_dynamic_symbol(name);
if (symbol != NULL) {
LIEF::span<const uint8_t> data = binary->get_content_from_virtual_address(symbol->value(), symbol->size(), LIEF::Binary::VA_TYPES::VA);