Skip to content

report compile issue #298

Description

@Larva1994

builtin-plugin/SymbolResolver/elf/dobby_symbol_resolver.cc | 8 ++++----
external/logging/logging.cc | 1 +
scripts/platform_builder.py | 6 +++---
source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc | 2 +-
source/Backend/UserMode/PlatformUtil/Linux/ProcessRuntime.cc | 10 +++++-----
5 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/builtin-plugin/SymbolResolver/elf/dobby_symbol_resolver.cc b/builtin-plugin/SymbolResolver/elf/dobby_symbol_resolver.cc
index 2378433..51b120c 100644
--- a/builtin-plugin/SymbolResolver/elf/dobby_symbol_resolver.cc
+++ b/builtin-plugin/SymbolResolver/elf/dobby_symbol_resolver.cc
@@ -170,7 +170,7 @@ void *resolve_elf_internal_symbol(const char *library_name, const char *symbol_n
if (library_name) {
RuntimeModule module = ProcessRuntime::getModule(library_name);

  • if (module.load_address) {
  • if (module.base) {
    auto mmapFileMng = MmapFileManager(module.path);
    auto file_mem = mmapFileMng.map();

@@ -182,7 +182,7 @@ void *resolve_elf_internal_symbol(const char *library_name, const char *symbol_n
}

   if (result)
  •    result = (void *)((addr_t)result + (addr_t)module.load_address - ((addr_t)file_mem - (addr_t)ctx.load_bias));
    
  •    result = (void *)((addr_t)result + (addr_t)module.base - ((addr_t)file_mem - (addr_t)ctx.load_bias));
    
    }
    }

@@ -190,7 +190,7 @@ void *resolve_elf_internal_symbol(const char *library_name, const char *symbol_n
auto ProcessModuleMap = ProcessRuntime::getModuleMap();
for (auto module : ProcessModuleMap) {

  •  if (module.load_address) {
    
  •  if (module.base) {
       auto mmapFileMng = MmapFileManager(module.path);
       auto file_mem = mmapFileMng.map();
    

@@ -202,7 +202,7 @@ void *resolve_elf_internal_symbol(const char *library_name, const char *symbol_n
}

     if (result)
  •      result = (void *)((addr_t)result + (addr_t)module.load_address - ((addr_t)file_mem - (addr_t)ctx.load_bias));
    
  •      result = (void *)((addr_t)result + (addr_t)module.base - ((addr_t)file_mem - (addr_t)ctx.load_bias));
     }
    
     if (result)
    

diff --git a/external/logging/logging.cc b/external/logging/logging.cc
index 86ead3d..b8ab2e3 100644
--- a/external/logging/logging.cc
+++ b/external/logging/logging.cc
@@ -13,6 +13,7 @@
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
+#include <sys/time.h>
#endif

#if defined(APPLE)
diff --git a/scripts/platform_builder.py b/scripts/platform_builder.py
index 9082c60..b1129f6 100644
--- a/scripts/platform_builder.py
+++ b/scripts/platform_builder.py
@@ -11,7 +11,7 @@ import argparse
platforms = {
"macos": ["x86_64", "arm64", "arm64e"],
"iphoneos": ["arm64", "arm64e"],

  • "linux": ["x86", "x86_64", "arm", "arm64"],
  • "linux": ["x86", "x86_64", "arm", "aarch64"],
    "android": ["x86", "x86_64", "armeabi-v7a", "arm64-v8a"]
    }

@@ -185,8 +185,8 @@ if name == "main":
parser.add_argument("--arch", type=str, required=True)
parser.add_argument("--library_build_type", type=str, default="static")
parser.add_argument("--android_ndk_dir", type=str)

  • parser.add_argument("--cmake_dir", type=str)
  • parser.add_argument("--llvm_dir", type=str)
  • parser.add_argument("--cmake_dir", type=str, default="/usr")

  • parser.add_argument("--llvm_dir", type=str, default="/usr")
    args = parser.parse_args()

    logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s")
    diff --git a/source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc b/source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc
    index bfe7361..35f9d65 100644
    --- a/source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc
    +++ b/source/Backend/UserMode/ExecMemory/code-patch-tool-posix.cc
    @@ -1,6 +1,6 @@

#include "dobby/dobby_internal.h"
-#include "core/arch/Cpu.h"
+#include "core/arch/CpuRegister.h"

#include <unistd.h>
#include <sys/mman.h>
diff --git a/source/Backend/UserMode/PlatformUtil/Linux/ProcessRuntime.cc b/source/Backend/UserMode/PlatformUtil/Linux/ProcessRuntime.cc
index 776d25e..1e90d26 100644
--- a/source/Backend/UserMode/PlatformUtil/Linux/ProcessRuntime.cc
+++ b/source/Backend/UserMode/PlatformUtil/Linux/ProcessRuntime.cc
@@ -13,8 +13,8 @@

#define LINE_MAX 2048

-static bool memory_region_comparator(MemRange a, MemRange b) {

  • return (a.start < b.start);
    +static bool memory_region_comparator(const MemRange& a, const MemRange& b) {
  • return (a.start() < b.start());
    }

stl::vector regions;
@@ -163,7 +163,7 @@ static stl::vector &get_process_map_with_proc_maps() {
path_buffer[strlen(path_buffer) - 1] = 0;
}
strncpy(module.path, path_buffer, sizeof(module.path) - 1);

  • module.load_address = (void *)region_start;
  • module.base = (void *)region_start;
    modules->push_back(module);

#if 0
@@ -191,11 +191,11 @@ static stl::vector get_process_map_with_linker_iterator() {
if (info->dlpi_name && info->dlpi_name[0] == '/')
strcpy(module.path, info->dlpi_name);

  •    module.load_address = (void *)info->dlpi_addr;
    
  •    module.base = (void *)info->dlpi_addr;
       for (size_t i = 0; i < info->dlpi_phnum; ++i) {
         if (info->dlpi_phdr[i].p_type == PT_LOAD) {
           uintptr_t load_bias = (info->dlpi_phdr[i].p_vaddr - info->dlpi_phdr[i].p_offset);
    
  •        module.load_address = (void *)((addr_t)module.load_address + load_bias);
    
  •        module.base = (void *)((addr_t)module.base + load_bias);
           break;
         }
       }
    

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions