[ORC][AArch64] Add initial support for aarch64 in ELFNixPlatform.
authorSunho Kim <ksunhokim123@naver.com>
Fri, 10 Jun 2022 04:34:24 +0000 (13:34 +0900)
committerSunho Kim <ksunhokim123@naver.com>
Fri, 10 Jun 2022 04:37:36 +0000 (13:37 +0900)
Adds the aarch64 support in ELFNixPlatform. These are few simple changes, but it allows us to use the orc runtime in ELF/AARCH64 backend. It succesfully run the static initializers of stdlibc++ iostream so that "cout << Hello world" testcase starts to work.

Reviewed By: lhames

Differential Revision: https://reviews.llvm.org/D127060

llvm/lib/ExecutionEngine/Orc/ELFNixPlatform.cpp

index c2577a91430875ba26bbad58505a33854a5fe87f..0185a9d15de2071d1a3492ca45c913b7ac169914 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "llvm/BinaryFormat/ELF.h"
 #include "llvm/ExecutionEngine/JITLink/ELF_x86_64.h"
+#include "llvm/ExecutionEngine/JITLink/aarch64.h"
 #include "llvm/ExecutionEngine/JITLink/x86_64.h"
 #include "llvm/ExecutionEngine/Orc/DebugUtils.h"
 #include "llvm/ExecutionEngine/Orc/ExecutionUtils.h"
@@ -47,6 +48,11 @@ public:
       Endianness = support::endianness::little;
       EdgeKind = jitlink::x86_64::Pointer64;
       break;
+    case Triple::aarch64:
+      PointerSize = 8;
+      Endianness = support::endianness::little;
+      EdgeKind = jitlink::aarch64::Pointer64;
+      break;
     default:
       llvm_unreachable("Unrecognized architecture");
     }
@@ -274,6 +280,7 @@ bool ELFNixPlatform::isInitializerSection(StringRef SecName) {
 bool ELFNixPlatform::supportedTarget(const Triple &TT) {
   switch (TT.getArch()) {
   case Triple::x86_64:
+  case Triple::aarch64:
     return true;
   default:
     return false;