Support PBA on aarch64
authorWoongsuk Cho <ws77.cho@samsung.com>
Fri, 28 Aug 2020 05:12:57 +0000 (14:12 +0900)
committer조웅석/Common Platform Lab(SR)/Principal Engineer/삼성전자 <ws77.cho@samsung.com>
Tue, 1 Sep 2020 21:12:18 +0000 (06:12 +0900)
Enable PBA on aarch64 architecture,
and change formmater to support both 32bit and 64bit.

NativeLauncher/tool/ni_common.cc
packaging/dotnet-launcher.spec

index 59a32d6e2d27142c1623f601e20a138fc913d57a..eb8f8256f216582dc01e5fa47a19b232824929bc 100644 (file)
 #include <algorithm>
 #include <string>
 #include <fstream>
+#include <sstream>
 
 #include <pwd.h>
 #include <grp.h>
 #include <unistd.h>
 #include <string.h>
 #include <sqlite3.h>
+#include <inttypes.h>
 
 #include "ni_common.h"
 #include "db_manager.h"
@@ -169,7 +171,7 @@ static uintptr_t getNextBaseAddrFromFile()
        uintptr_t addr = 0;
        uintptr_t size = 0;
 
-       while (fscanf(pFile, "%u %u", &addr, &size) != EOF) {
+       while (fscanf(pFile, "%" SCNxPTR " %" SCNuPTR "", &addr, &size) != EOF) {
        }
 
        fclose(pFile);
@@ -212,7 +214,7 @@ static void updateBaseAddrFile(const std::string& absNIPath, uintptr_t baseAddr)
                return;
        }
 
-       fprintf(pFile, "%u %u\n", baseAddr, niSize);
+       fprintf(pFile, "%" PRIxPTR " %" PRIuPTR "\n", baseAddr, niSize);
        fclose(pFile);
 }
 
@@ -337,11 +339,13 @@ static ni_error_e crossgen(const std::string& dllPath, const std::string& appPat
                }
 
 #ifdef UNIQUE_DEFAULT_BASE_ADDR_SUPPORT
-               char baseAddrString[11] = {0};
+               std::string baseAddrString;
                if (baseAddr != 0) {
                        argv.push_back("/BaseAddress");
-                       snprintf(baseAddrString, 11, "0x%08x", baseAddr);
-                       argv.push_back(baseAddrString);
+                       std::stringstream ss;
+                       ss << "0x" << std::hex << baseAddr;
+                       baseAddrString = ss.str();
+                       argv.push_back(baseAddrString.c_str());
                }
 #endif
 
index 54cda09c19c85373dc5af7399026f0a443e849bf..712b4de3e0719f5c6778a704f0d8319cbc622dcd 100644 (file)
@@ -125,7 +125,7 @@ cmake \
        -DDOTNET_DIR=%{_dotnet_dir} \
        -DVERSION=%{version} \
        -DNATIVE_LIB_DIR=%{_native_lib_dir} \
-%ifarch %{arm}
+%ifarch %{arm} aarch64
 %if 0%{?use_default_base_addr}
        -DUSE_DEFAULT_BASE_ADDR="" \
 %endif