summaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-29 10:48:12 +0200
committerGitHub <noreply@github.com>2025-05-29 10:48:12 +0200
commit433bb5ef102b2bfa0049468be00d63011da8b973 (patch)
treee0893a30710477045a5bb085cb7a27aada425c14 /tools
parent1ddeab9a4426abd781a5066ba79af2ba64de11d9 (diff)
parent756ee7f8dc954e27350fe5bdfbaa83b9f69780c8 (diff)
Merge pull request #6 from nekernel-org/dev
0.0.2e3
Diffstat (limited to 'tools')
-rw-r--r--tools/asm.cc2
-rw-r--r--tools/cppdrv.cc2
-rw-r--r--tools/cxxdrv.cc35
-rw-r--r--tools/cxxdrv.json15
-rw-r--r--tools/dbg.cc6
-rw-r--r--tools/kdbg.cc6
-rw-r--r--tools/ld64.cc2
7 files changed, 51 insertions, 17 deletions
diff --git a/tools/asm.cc b/tools/asm.cc
index 8f98543..6f83c81 100644
--- a/tools/asm.cc
+++ b/tools/asm.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */
diff --git a/tools/cppdrv.cc b/tools/cppdrv.cc
index 7adfd0b..e479222 100644
--- a/tools/cppdrv.cc
+++ b/tools/cppdrv.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */
diff --git a/tools/cxxdrv.cc b/tools/cxxdrv.cc
index f0aee1b..99696aa 100644
--- a/tools/cxxdrv.cc
+++ b/tools/cxxdrv.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */
@@ -9,9 +9,36 @@
#include <LibCompiler/Defines.h>
#include <LibCompiler/ErrorID.h>
+#include <LibCompiler/Util/CompilerUtils.h>
+#include <LibCompiler/Util/DylibHelpers.h>
#include <LibCompiler/Version.h>
-#include <cstring>
-int main(int argc, char const* argv[]) {
- return EXIT_FAILURE;
+static auto kPath = "/usr/local/lib/libCompiler.dylib";
+
+Int32 main(Int32 argc, Char const* argv[]) {
+ DylibHandle handler = dlopen(kPath, RTLD_LAZY | RTLD_GLOBAL);
+
+ if (!handler) {
+ kStdOut;
+ std::printf("error: Could not load dylib in %s: %s\n", kPath, dlerror());
+
+ return EXIT_FAILURE;
+ }
+
+ LibCompilerEntrypoint entrypoint_cxx =
+ (LibCompilerEntrypoint) dlsym(handler, "CompilerCPlusPlusAMD64");
+
+ if (!entrypoint_cxx) {
+ kStdOut;
+ std::printf("error: Could not find entrypoint in %s: %s\n", kPath, dlerror());
+ dlclose(handler);
+
+ return EXIT_FAILURE;
+ }
+
+ auto ret = (entrypoint_cxx(argc, argv) == LIBCOMPILER_SUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE;
+
+ dlclose(handler);
+
+ return ret;
}
diff --git a/tools/cxxdrv.json b/tools/cxxdrv.json
index ad760c3..5b1919d 100644
--- a/tools/cxxdrv.json
+++ b/tools/cxxdrv.json
@@ -1,12 +1,19 @@
{
"compiler_path": "g++",
"compiler_std": "c++20",
- "headers_path": ["../dev/LibCompiler", "../dev/", "../dev/LibCompiler/src/Detail"],
- "sources_path": ["cxxdrv.cc"],
+ "headers_path": [
+ "../dev/LibCompiler",
+ "../dev/",
+ "../dev/LibCompiler/src/Detail"
+ ],
+ "sources_path": [
+ "cxxdrv.cc"
+ ],
"output_name": "cxxdrv",
- "compiler_flags": ["-L/usr/local/lib", "-lCompiler", "-Wl,-e,_CompilerCPlusPlusAMD64"],
+ "compiler_flags": [
+ ],
"cpp_macros": [
"__CXXDRV__=202504",
"kDistReleaseBranch=$(git rev-parse --abbrev-ref HEAD)-$(uuidgen)"
]
-}
+} \ No newline at end of file
diff --git a/tools/dbg.cc b/tools/dbg.cc
index b9be862..35b0702 100644
--- a/tools/dbg.cc
+++ b/tools/dbg.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */
@@ -9,10 +9,10 @@
/// @file dbg.cxx
/// @brief NE debugger.
-LC_IMPORT_C int DebuggerMachPOSIX(int argc, char const* argv[]);
+LC_IMPORT_C Int32 DebuggerMachPOSIX(Int32 argc, Char const* argv[]);
/// @brief Debugger entrypoint.
/// @return Status code of debugger.
-int main(int argc, char const* argv[]) {
+Int32 main(Int32 argc, Char const* argv[]) {
return DebuggerMachPOSIX(argc, argv);
}
diff --git a/tools/kdbg.cc b/tools/kdbg.cc
index 11901e3..7616abe 100644
--- a/tools/kdbg.cc
+++ b/tools/kdbg.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */
@@ -9,10 +9,10 @@
/// @file kdbg.cxx
/// @brief NeKernel debugger.
-LC_IMPORT_C int DebuggerNeKernel(int argc, char const* argv[]);
+LC_IMPORT_C Int32 DebuggerNeKernel(Int32 argc, Char const* argv[]);
/// @brief Debugger entrypoint.
/// @return Status code of debugger.
-int main(int argc, char const* argv[]) {
+Int32 main(Int32 argc, Char const* argv[]) {
return DebuggerNeKernel(argc, argv);
}
diff --git a/tools/ld64.cc b/tools/ld64.cc
index ebb7376..ebdcb47 100644
--- a/tools/ld64.cc
+++ b/tools/ld64.cc
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
+ Copyright (C) 2024-2025 Amlal EL Mahrouss, all rights reserved
------------------------------------------- */