-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #413 from no92/llvm-riscv-fix
llvm: enable managarm target for RISC-V
- Loading branch information
Showing
6 changed files
with
55 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -365,7 +365,7 @@ packages: | |
pkgs_required: | ||
- mlibc | ||
- zlib | ||
revision: 2 | ||
revision: 3 | ||
configure: | ||
- args: | ||
- 'cmake' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
From 4abf6abfcd5711de7fc24af4f08f259798996440 Mon Sep 17 00:00:00 2001 | ||
From 9d681fdec1f5f86244dd0ba429f35805e1ddde61 Mon Sep 17 00:00:00 2001 | ||
From: no92 <[email protected]> | ||
Date: Fri, 6 Sep 2024 21:17:53 +0200 | ||
Subject: [PATCH 1/5] [llvm] Add managarm OS target | ||
Subject: [PATCH 1/4] [llvm] Add managarm OS target | ||
|
||
--- | ||
llvm/include/llvm/ADT/bit.h | 2 +- | ||
llvm/include/llvm/TargetParser/Triple.h | 2 ++ | ||
llvm/include/llvm/TargetParser/Triple.h | 6 ++++++ | ||
llvm/lib/Support/Unix/Path.inc | 13 ++++++++----- | ||
llvm/lib/TargetParser/Triple.cpp | 4 ++++ | ||
llvm/unittests/TargetParser/TripleTest.cpp | 18 ++++++++++++++++++ | ||
5 files changed, 33 insertions(+), 6 deletions(-) | ||
5 files changed, 37 insertions(+), 6 deletions(-) | ||
|
||
diff --git a/llvm/include/llvm/ADT/bit.h b/llvm/include/llvm/ADT/bit.h | ||
index c42b5e686b..7a36ef2eb5 100644 | ||
|
@@ -25,7 +25,7 @@ index c42b5e686b..7a36ef2eb5 100644 | |
#elif defined(_AIX) | ||
#include <sys/machine.h> | ||
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h | ||
index 779bd9017d..818c3a9b5b 100644 | ||
index 779bd9017d..3ff75723b3 100644 | ||
--- a/llvm/include/llvm/TargetParser/Triple.h | ||
+++ b/llvm/include/llvm/TargetParser/Triple.h | ||
@@ -207,6 +207,7 @@ public: | ||
|
@@ -44,6 +44,17 @@ index 779bd9017d..818c3a9b5b 100644 | |
|
||
PAuthTest, | ||
|
||
@@ -821,6 +823,10 @@ public: | ||
|
||
bool isVulkanOS() const { return getOS() == Triple::Vulkan; } | ||
|
||
+ bool isOSManagarm() const { | ||
+ return getOS() == Triple::Managarm; | ||
+ } | ||
+ | ||
bool isShaderStageEnvironment() const { | ||
EnvironmentType Env = getEnvironment(); | ||
return Env == Triple::Pixel || Env == Triple::Vertex || | ||
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc | ||
index 44097bad7b..f7e5d8748b 100644 | ||
--- a/llvm/lib/Support/Unix/Path.inc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,22 @@ | ||
From d501a9af0261875c1f702aaf2e1f04356076f2a3 Mon Sep 17 00:00:00 2001 | ||
From 80bd6cc08d6ff8806e293d97f6c723081ec481fc Mon Sep 17 00:00:00 2001 | ||
From: no92 <[email protected]> | ||
Date: Fri, 6 Sep 2024 21:18:39 +0200 | ||
Subject: [PATCH 2/5] [clang] Add managarm OS target | ||
Subject: [PATCH 2/4] [clang] Add managarm OS target | ||
|
||
--- | ||
clang/lib/Basic/Targets.cpp | 6 + | ||
clang/lib/Basic/Targets.cpp | 9 + | ||
clang/lib/Basic/Targets/OSTargets.h | 30 +++ | ||
clang/lib/Driver/CMakeLists.txt | 1 + | ||
clang/lib/Driver/Driver.cpp | 4 + | ||
clang/lib/Driver/ToolChains/Gnu.cpp | 2 + | ||
clang/lib/Driver/ToolChains/Managarm.cpp | 227 +++++++++++++++++++++++ | ||
clang/lib/Driver/ToolChains/Managarm.h | 55 ++++++ | ||
6 files changed, 323 insertions(+) | ||
7 files changed, 328 insertions(+) | ||
create mode 100644 clang/lib/Driver/ToolChains/Managarm.cpp | ||
create mode 100644 clang/lib/Driver/ToolChains/Managarm.h | ||
|
||
diff --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp | ||
index 0021d33c45..18b06085dd 100644 | ||
index 0021d33c45..b2be3803b2 100644 | ||
--- a/clang/lib/Basic/Targets.cpp | ||
+++ b/clang/lib/Basic/Targets.cpp | ||
@@ -159,6 +159,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, | ||
|
@@ -28,7 +29,17 @@ index 0021d33c45..18b06085dd 100644 | |
case llvm::Triple::NetBSD: | ||
return std::make_unique<NetBSDTargetInfo<AArch64leTargetInfo>>(Triple, | ||
Opts); | ||
@@ -637,6 +640,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, | ||
@@ -451,6 +454,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, | ||
return std::make_unique<OHOSTargetInfo<RISCV64TargetInfo>>(Triple, | ||
Opts); | ||
} | ||
+ case llvm::Triple::Managarm: | ||
+ return std::make_unique<ManagarmTargetInfo<RISCV64TargetInfo>>(Triple, | ||
+ Opts); | ||
default: | ||
return std::make_unique<RISCV64TargetInfo>(Triple, Opts); | ||
} | ||
@@ -637,6 +643,9 @@ std::unique_ptr<TargetInfo> AllocateTarget(const llvm::Triple &Triple, | ||
return std::make_unique<PS5OSTargetInfo<X86_64TargetInfo>>(Triple, Opts); | ||
case llvm::Triple::Hurd: | ||
return std::make_unique<HurdTargetInfo<X86_64TargetInfo>>(Triple, Opts); | ||
|
@@ -92,7 +103,7 @@ index 4fd10bf671..67e9d90ae6 100644 | |
ToolChains/MinGW.cpp | ||
ToolChains/MSP430.cpp | ||
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp | ||
index df802450ad..d41f2d8491 100644 | ||
index 93e85f7dff..f9261b412e 100644 | ||
--- a/clang/lib/Driver/Driver.cpp | ||
+++ b/clang/lib/Driver/Driver.cpp | ||
@@ -32,6 +32,7 @@ | ||
|
@@ -103,7 +114,7 @@ index df802450ad..d41f2d8491 100644 | |
#include "ToolChains/MinGW.h" | ||
#include "ToolChains/MipsLinux.h" | ||
#include "ToolChains/NaCl.h" | ||
@@ -6438,6 +6439,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, | ||
@@ -6437,6 +6438,9 @@ const ToolChain &Driver::getToolChain(const ArgList &Args, | ||
case llvm::Triple::Fuchsia: | ||
TC = std::make_unique<toolchains::Fuchsia>(*this, Target, Args); | ||
break; | ||
|
@@ -113,6 +124,19 @@ index df802450ad..d41f2d8491 100644 | |
case llvm::Triple::Solaris: | ||
TC = std::make_unique<toolchains::Solaris>(*this, Target, Args); | ||
break; | ||
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp | ||
index 8397f1121e..53b326f6e7 100644 | ||
--- a/clang/lib/Driver/ToolChains/Gnu.cpp | ||
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp | ||
@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) { | ||
return "elf_iamcu"; | ||
return "elf_i386"; | ||
case llvm::Triple::aarch64: | ||
+ if (T.isOSManagarm()) | ||
+ return "aarch64managarm"; | ||
return "aarch64linux"; | ||
case llvm::Triple::aarch64_be: | ||
return "aarch64linuxb"; | ||
diff --git a/clang/lib/Driver/ToolChains/Managarm.cpp b/clang/lib/Driver/ToolChains/Managarm.cpp | ||
new file mode 100644 | ||
index 0000000000..51abd8459f | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
From 58495a0e8e4d9fa54a1650578b1293eeae54c1b7 Mon Sep 17 00:00:00 2001 | ||
From 3faf84c1dfb842b6005bb276ede5e2cc6a96883b Mon Sep 17 00:00:00 2001 | ||
From: no92 <[email protected]> | ||
Date: Tue, 5 Nov 2024 01:43:57 +0100 | ||
Subject: [PATCH 3/5] [clang] Add managarm tests | ||
Subject: [PATCH 3/4] [clang] Add managarm tests | ||
|
||
--- | ||
.../lib/aarch64-managarm-mlibc/.keep | 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
From 5f2b6a823fc5cc8c9e6323ec234925adc1abd749 Mon Sep 17 00:00:00 2001 | ||
From 5045e500406b216f3a77d4b410c0d31117f63e0c Mon Sep 17 00:00:00 2001 | ||
From: no92 <[email protected]> | ||
Date: Tue, 5 Nov 2024 01:44:16 +0100 | ||
Subject: [PATCH 4/5] WIP: kernel environment | ||
Subject: [PATCH 4/4] WIP: kernel environment | ||
|
||
--- | ||
llvm/include/llvm/TargetParser/Triple.h | 1 + | ||
llvm/lib/TargetParser/Triple.cpp | 2 ++ | ||
2 files changed, 3 insertions(+) | ||
|
||
diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h | ||
index 818c3a9b5b..aba538520a 100644 | ||
index 3ff75723b3..82824b9eee 100644 | ||
--- a/llvm/include/llvm/TargetParser/Triple.h | ||
+++ b/llvm/include/llvm/TargetParser/Triple.h | ||
@@ -299,6 +299,7 @@ public: | ||
|