summaryrefslogtreecommitdiffhomepage
path: root/CompilerKit/AsmKit/AsmKit.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-04 21:36:54 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-04 21:48:09 +0100
commit6cda526bd4efcee31b1ea7405dc46d7985ba64e6 (patch)
treef7d138fd5652cdc0e7a2c4918b36d754969d6cf5 /CompilerKit/AsmKit/AsmKit.cc
parent60271b79a91a06772241aed737426f5d097ca533 (diff)
masm: fix assembler bug where addr1, 0x0 (add r1, 0x0) doesn't error
out. cc/ccplus: minor compiler changes, will get to them very soon... refactor: rename C++Kit to CompilerKit. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerKit/AsmKit/AsmKit.cc')
-rw-r--r--CompilerKit/AsmKit/AsmKit.cc47
1 files changed, 47 insertions, 0 deletions
diff --git a/CompilerKit/AsmKit/AsmKit.cc b/CompilerKit/AsmKit/AsmKit.cc
new file mode 100644
index 0000000..4ee031f
--- /dev/null
+++ b/CompilerKit/AsmKit/AsmKit.cc
@@ -0,0 +1,47 @@
+/*
+ * ========================================================
+ *
+ * C++Kit
+ * Copyright Western Company, all rights reserved.
+ *
+ * ========================================================
+ */
+
+#include <AsmKit/AsmKit.hpp>
+#include <StdKit/ErrorID.hpp>
+
+#include <iostream>
+
+//! @file AsmKit.cpp
+//! @brief AssemblyKit
+
+namespace CompilerKit
+{
+ //! @brief Compile for specific format (ELF, PEF, ZBIN)
+ Int32 AssemblyFactory::Compile(StringView& sourceFile,
+ const Int32& arch) noexcept
+ {
+ if (sourceFile.Length() < 1 ||
+ !fMounted)
+ return CXXKIT_UNIMPLEMENTED;
+
+ return fMounted->CompileToFormat(sourceFile, arch);
+ }
+
+ //! @brief mount assembly backend.
+ void AssemblyFactory::Mount(AssemblyMountpoint* mountPtr) noexcept
+ {
+ if (mountPtr)
+ fMounted = mountPtr;
+ }
+
+ AssemblyMountpoint* AssemblyFactory::Unmount() noexcept
+ {
+ auto mount_prev = fMounted;
+
+ if (mount_prev)
+ fMounted = nullptr;
+
+ return mount_prev;
+ }
+}