summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-04-19 17:33:26 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-04-19 17:33:26 +0200
commitbefde76cfa46c766e81f74eb5ac65d3dae2dde87 (patch)
tree45b2f9fd6b3f9605c2747485bd24483192f99e73 /dev
parent3afc481dc64a07fe7fcaff9ce7a12a492c3ec8e7 (diff)
dev, LibCompiler, tooling: refactor and separate components into modules
(cppdrv, cxxdrv) Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev')
-rw-r--r--dev/LibCompiler/AE.h (renamed from dev/LibCompiler/NFC/AE.h)0
-rw-r--r--dev/LibCompiler/AssemblyInterface.h (renamed from dev/LibCompiler/AAL/AssemblyInterface.h)2
-rw-r--r--dev/LibCompiler/Backend/32x0.h (renamed from dev/LibCompiler/AAL/CPU/32x0.h)2
-rw-r--r--dev/LibCompiler/Backend/64x0.h (renamed from dev/LibCompiler/AAL/CPU/64x0.h)2
-rw-r--r--dev/LibCompiler/Backend/amd64.h (renamed from dev/LibCompiler/AAL/CPU/amd64.h)2
-rw-r--r--dev/LibCompiler/Backend/arm64.h (renamed from dev/LibCompiler/AAL/CPU/arm64.h)2
-rw-r--r--dev/LibCompiler/Backend/power64.h (renamed from dev/LibCompiler/AAL/CPU/power64.h)0
-rw-r--r--dev/LibCompiler/Defines.h4
-rw-r--r--dev/LibCompiler/ErrorID.h (renamed from dev/LibCompiler/NFC/ErrorID.h)4
-rw-r--r--dev/LibCompiler/ErrorOr.h (renamed from dev/LibCompiler/NFC/ErrorOr.h)2
-rw-r--r--dev/LibCompiler/PEF.h (renamed from dev/LibCompiler/NFC/PEF.h)0
-rw-r--r--dev/LibCompiler/Parser.h2
-rw-r--r--dev/LibCompiler/Ref.h (renamed from dev/LibCompiler/NFC/Ref.h)0
-rw-r--r--dev/LibCompiler/StringView.h (renamed from dev/LibCompiler/NFC/StringView.h)2
-rw-r--r--dev/LibCompiler/XCOFF.h (renamed from dev/LibCompiler/NFC/XCOFF.h)0
-rw-r--r--dev/LibCompiler/src/Assembler32x0.cc6
-rw-r--r--dev/LibCompiler/src/Assembler64x0.cc6
-rw-r--r--dev/LibCompiler/src/AssemblerAMD64.cc6
-rw-r--r--dev/LibCompiler/src/AssemblerARM64.cc8
-rw-r--r--dev/LibCompiler/src/AssemblerPower.cc8
-rw-r--r--dev/LibCompiler/src/AssemblyFactory.cc4
-rw-r--r--dev/LibCompiler/src/CCompiler64x0.cc2
-rw-r--r--dev/LibCompiler/src/CCompilerARM64.cc2
-rw-r--r--dev/LibCompiler/src/CCompilerPower64.cc4
-rw-r--r--dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc12
-rw-r--r--dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc4
-rw-r--r--dev/LibCompiler/src/Detail/AsmUtils.h2
-rw-r--r--dev/LibCompiler/src/Detail/ClUtils.h2
-rw-r--r--dev/LibCompiler/src/DynamicLinkerPEF.cc60
-rw-r--r--dev/LibCompiler/src/StringView.cc2
-rw-r--r--dev/LibDebugger/DebuggerContract.h14
-rw-r--r--dev/LibDebugger/POSIXMachContract.h11
-rw-r--r--dev/LibDebugger/src/POSIXMachContract.cc6
33 files changed, 94 insertions, 89 deletions
diff --git a/dev/LibCompiler/NFC/AE.h b/dev/LibCompiler/AE.h
index fdf42a5..fdf42a5 100644
--- a/dev/LibCompiler/NFC/AE.h
+++ b/dev/LibCompiler/AE.h
diff --git a/dev/LibCompiler/AAL/AssemblyInterface.h b/dev/LibCompiler/AssemblyInterface.h
index a9ca95b..622e2ff 100644
--- a/dev/LibCompiler/AAL/AssemblyInterface.h
+++ b/dev/LibCompiler/AssemblyInterface.h
@@ -8,7 +8,7 @@
#include <LibCompiler/Macros.h>
#include <LibCompiler/Defines.h>
-#include <LibCompiler/NFC/StringView.h>
+#include <LibCompiler/StringView.h>
#define ASSEMBLY_INTERFACE : public LibCompiler::AssemblyInterface
diff --git a/dev/LibCompiler/AAL/CPU/32x0.h b/dev/LibCompiler/Backend/32x0.h
index 007beab..32f31ff 100644
--- a/dev/LibCompiler/AAL/CPU/32x0.h
+++ b/dev/LibCompiler/Backend/32x0.h
@@ -9,7 +9,7 @@
#include <LibCompiler/Defines.h>
// @brief 32x0 support.
-// @file CPU/32x0.hpp
+// @file Backend/32x0.hpp
#define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \
{.fName = __NAME, \
diff --git a/dev/LibCompiler/AAL/CPU/64x0.h b/dev/LibCompiler/Backend/64x0.h
index 4944e3b..a0084b1 100644
--- a/dev/LibCompiler/AAL/CPU/64x0.h
+++ b/dev/LibCompiler/Backend/64x0.h
@@ -10,7 +10,7 @@
#include <vector>
// @brief 64x0 support.
-// @file CPU/64x0.hpp
+// @file Backend/64x0.hpp
#define kAsmOpcodeDecl(__NAME, __OPCODE, __FUNCT3, __FUNCT7) \
{.fName = __NAME, \
diff --git a/dev/LibCompiler/AAL/CPU/amd64.h b/dev/LibCompiler/Backend/amd64.h
index 0717dc1..8486b01 100644
--- a/dev/LibCompiler/AAL/CPU/amd64.h
+++ b/dev/LibCompiler/Backend/amd64.h
@@ -9,7 +9,7 @@
#include <LibCompiler/Defines.h>
// @brief AMD64 support.
-// @file CPU/amd64.hpp
+// @file Backend/amd64.hpp
#define kAsmOpcodeDecl(__NAME, __OPCODE) {.fName = __NAME, .fOpcode = __OPCODE},
diff --git a/dev/LibCompiler/AAL/CPU/arm64.h b/dev/LibCompiler/Backend/arm64.h
index 02a2bf2..08096ee 100644
--- a/dev/LibCompiler/AAL/CPU/arm64.h
+++ b/dev/LibCompiler/Backend/arm64.h
@@ -10,7 +10,7 @@ Copyright (C) 2024-2025 Amlal EL Mahrous, all rights reserved
#include <LibCompiler/Defines.h>
/// @brief ARM64 encoding support.
-/// @file CPU/arm64.hpp
+/// @file Backend/arm64.hpp
struct CpuOpcodeArm64;
diff --git a/dev/LibCompiler/AAL/CPU/power64.h b/dev/LibCompiler/Backend/power64.h
index 0f797a5..0f797a5 100644
--- a/dev/LibCompiler/AAL/CPU/power64.h
+++ b/dev/LibCompiler/Backend/power64.h
diff --git a/dev/LibCompiler/Defines.h b/dev/LibCompiler/Defines.h
index b13cd86..07f3b33 100644
--- a/dev/LibCompiler/Defines.h
+++ b/dev/LibCompiler/Defines.h
@@ -23,6 +23,10 @@
#define NO false
#endif // ifndef NO
+#ifndef BOOL
+#define BOOL bool
+#endif // ifndef BOOL
+
#define SizeType size_t
#define VoidPtr void*
diff --git a/dev/LibCompiler/NFC/ErrorID.h b/dev/LibCompiler/ErrorID.h
index e7f06e1..b105f9b 100644
--- a/dev/LibCompiler/NFC/ErrorID.h
+++ b/dev/LibCompiler/ErrorID.h
@@ -10,9 +10,9 @@
#pragma once
#include <LibCompiler/Defines.h>
-#include <LibCompiler/NFC/ErrorOr.h>
+#include <LibCompiler/ErrorOr.h>
-#define LIBCOMPILER_SUCCESSS 0
+#define LIBCOMPILER_SUCCESSS 0
#define LIBCOMPILER_EXEC_ERROR -30
#define LIBCOMPILER_FILE_NOT_FOUND -31
#define LIBCOMPILER_DIR_NOT_FOUND -32
diff --git a/dev/LibCompiler/NFC/ErrorOr.h b/dev/LibCompiler/ErrorOr.h
index 9dc607e..2a6d590 100644
--- a/dev/LibCompiler/NFC/ErrorOr.h
+++ b/dev/LibCompiler/ErrorOr.h
@@ -10,7 +10,7 @@
#pragma once
#include <LibCompiler/Defines.h>
-#include <LibCompiler/NFC/Ref.h>
+#include <LibCompiler/Ref.h>
namespace LibCompiler
{
diff --git a/dev/LibCompiler/NFC/PEF.h b/dev/LibCompiler/PEF.h
index 1148dea..1148dea 100644
--- a/dev/LibCompiler/NFC/PEF.h
+++ b/dev/LibCompiler/PEF.h
diff --git a/dev/LibCompiler/Parser.h b/dev/LibCompiler/Parser.h
index 74eb204..cb0e470 100644
--- a/dev/LibCompiler/Parser.h
+++ b/dev/LibCompiler/Parser.h
@@ -6,7 +6,7 @@
#pragma once
-#include <LibCompiler/AAL/AssemblyInterface.h>
+#include <LibCompiler/AssemblyInterface.h>
namespace LibCompiler
{
diff --git a/dev/LibCompiler/NFC/Ref.h b/dev/LibCompiler/Ref.h
index 117083c..117083c 100644
--- a/dev/LibCompiler/NFC/Ref.h
+++ b/dev/LibCompiler/Ref.h
diff --git a/dev/LibCompiler/NFC/StringView.h b/dev/LibCompiler/StringView.h
index 16578e0..b65121e 100644
--- a/dev/LibCompiler/NFC/StringView.h
+++ b/dev/LibCompiler/StringView.h
@@ -10,7 +10,7 @@
#pragma once
#include <LibCompiler/Defines.h>
-#include <LibCompiler/NFC/ErrorOr.h>
+#include <LibCompiler/ErrorOr.h>
namespace LibCompiler
{
diff --git a/dev/LibCompiler/NFC/XCOFF.h b/dev/LibCompiler/XCOFF.h
index 862c363..862c363 100644
--- a/dev/LibCompiler/NFC/XCOFF.h
+++ b/dev/LibCompiler/XCOFF.h
diff --git a/dev/LibCompiler/src/Assembler32x0.cc b/dev/LibCompiler/src/Assembler32x0.cc
index 0eaf78a..1790b8b 100644
--- a/dev/LibCompiler/src/Assembler32x0.cc
+++ b/dev/LibCompiler/src/Assembler32x0.cc
@@ -19,10 +19,10 @@
#define __ASM_NEED_32x0__ 1
-#include <LibCompiler/AAL/CPU/32x0.h>
+#include <LibCompiler/Backend/32x0.h>
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/AE.h>
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/AE.h>
+#include <LibCompiler/PEF.h>
/////////////////////
diff --git a/dev/LibCompiler/src/Assembler64x0.cc b/dev/LibCompiler/src/Assembler64x0.cc
index b074e9f..7630adf 100644
--- a/dev/LibCompiler/src/Assembler64x0.cc
+++ b/dev/LibCompiler/src/Assembler64x0.cc
@@ -19,10 +19,10 @@
#define __ASM_NEED_64x0__ 1
-#include <LibCompiler/AAL/CPU/64x0.h>
+#include <LibCompiler/Backend/64x0.h>
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/AE.h>
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/AE.h>
+#include <LibCompiler/PEF.h>
#include <algorithm>
#include <filesystem>
#include <fstream>
diff --git a/dev/LibCompiler/src/AssemblerAMD64.cc b/dev/LibCompiler/src/AssemblerAMD64.cc
index d71caf2..be77ce9 100644
--- a/dev/LibCompiler/src/AssemblerAMD64.cc
+++ b/dev/LibCompiler/src/AssemblerAMD64.cc
@@ -26,10 +26,10 @@
#define kAssemblerPragmaSymStr "#"
#define kAssemblerPragmaSym '#'
-#include <LibCompiler/AAL/CPU/amd64.h>
+#include <LibCompiler/Backend/amd64.h>
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/AE.h>
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/AE.h>
+#include <LibCompiler/PEF.h>
#include <algorithm>
#include <cstdlib>
#include <filesystem>
diff --git a/dev/LibCompiler/src/AssemblerARM64.cc b/dev/LibCompiler/src/AssemblerARM64.cc
index e402b7f..52b78d6 100644
--- a/dev/LibCompiler/src/AssemblerARM64.cc
+++ b/dev/LibCompiler/src/AssemblerARM64.cc
@@ -17,11 +17,11 @@
#define __ASM_NEED_ARM64__ 1
-#include <LibCompiler/NFC/ErrorID.h>
-#include <LibCompiler/AAL/CPU/arm64.h>
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/ErrorID.h>
+#include <LibCompiler/Backend/arm64.h>
+#include <LibCompiler/PEF.h>
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/AE.h>
+#include <LibCompiler/AE.h>
#include <LibCompiler/Version.h>
#include <filesystem>
#include <algorithm>
diff --git a/dev/LibCompiler/src/AssemblerPower.cc b/dev/LibCompiler/src/AssemblerPower.cc
index 7cb4ca0..59f7ed6 100644
--- a/dev/LibCompiler/src/AssemblerPower.cc
+++ b/dev/LibCompiler/src/AssemblerPower.cc
@@ -17,11 +17,11 @@
#define __ASM_NEED_PPC__ 1
-#include <LibCompiler/NFC/ErrorID.h>
-#include <LibCompiler/AAL/CPU/power64.h>
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/ErrorID.h>
+#include <LibCompiler/Backend/power64.h>
+#include <LibCompiler/PEF.h>
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/AE.h>
+#include <LibCompiler/AE.h>
#include <LibCompiler/Version.h>
#include <filesystem>
#include <algorithm>
diff --git a/dev/LibCompiler/src/AssemblyFactory.cc b/dev/LibCompiler/src/AssemblyFactory.cc
index 46ebed3..e70f279 100644
--- a/dev/LibCompiler/src/AssemblyFactory.cc
+++ b/dev/LibCompiler/src/AssemblyFactory.cc
@@ -4,8 +4,8 @@
------------------------------------------- */
-#include <LibCompiler/AAL/AssemblyInterface.h>
-#include <LibCompiler/NFC/ErrorID.h>
+#include <LibCompiler/AssemblyInterface.h>
+#include <LibCompiler/ErrorID.h>
/**
* @file AssemblyFactory.cxx
diff --git a/dev/LibCompiler/src/CCompiler64x0.cc b/dev/LibCompiler/src/CCompiler64x0.cc
index 19446af..89fc682 100644
--- a/dev/LibCompiler/src/CCompiler64x0.cc
+++ b/dev/LibCompiler/src/CCompiler64x0.cc
@@ -10,7 +10,7 @@
/// BUGS: 0
/// TODO: none
-#include <LibCompiler/AAL/CPU/64x0.h>
+#include <LibCompiler/Backend/64x0.h>
#include <LibCompiler/Parser.h>
#include <LibCompiler/UUID.h>
#include <cstdio>
diff --git a/dev/LibCompiler/src/CCompilerARM64.cc b/dev/LibCompiler/src/CCompilerARM64.cc
index ac09cbd..5d3e892 100644
--- a/dev/LibCompiler/src/CCompilerARM64.cc
+++ b/dev/LibCompiler/src/CCompilerARM64.cc
@@ -10,7 +10,7 @@
/// BUGS: 0
/// TODO: none
-#include <LibCompiler/AAL/CPU/arm64.h>
+#include <LibCompiler/Backend/arm64.h>
#include <LibCompiler/Parser.h>
#include <LibCompiler/UUID.h>
#include <cstdio>
diff --git a/dev/LibCompiler/src/CCompilerPower64.cc b/dev/LibCompiler/src/CCompilerPower64.cc
index 63b2794..ac35c4a 100644
--- a/dev/LibCompiler/src/CCompilerPower64.cc
+++ b/dev/LibCompiler/src/CCompilerPower64.cc
@@ -7,7 +7,7 @@
* ========================================================
*/
-#include <LibCompiler/AAL/CPU/power64.h>
+#include <LibCompiler/Backend/power64.h>
#include <LibCompiler/Parser.h>
#include <LibCompiler/UUID.h>
#include <fstream>
@@ -21,7 +21,7 @@
#define kExitOK 0
-/// @author EL Mahrouss Amlal (amlel)
+/// @author EL Mahrouss Amlal (amlal@nekernel.org)
/// @file cc.cxx
/// @brief POWER64 C Compiler.
diff --git a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
index 96a2873..c053920 100644
--- a/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
+++ b/dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc
@@ -19,7 +19,7 @@
// extern_segment, @autodelete { ... }, fn foo() -> auto { ... }
-#include <LibCompiler/AAL/CPU/amd64.h>
+#include <LibCompiler/Backend/amd64.h>
#include <LibCompiler/Parser.h>
#include <LibCompiler/UUID.h>
@@ -1078,27 +1078,27 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64)
continue;
}
- if (strcmp(argv[index], "--cl:version") == 0)
+ if (strcmp(argv[index], "-version") == 0)
{
kSplashCxx();
return kExitOK;
}
- if (strcmp(argv[index], "--cl:verbose") == 0)
+ if (strcmp(argv[index], "-cxx-verbose") == 0)
{
kState.fVerbose = true;
continue;
}
- if (strcmp(argv[index], "--cl:h") == 0)
+ if (strcmp(argv[index], "-h") == 0)
{
cxx_print_help();
return kExitOK;
}
- if (strcmp(argv[index], "--cl:c++-dialect") == 0)
+ if (strcmp(argv[index], "-cxx-dialect") == 0)
{
if (kCompilerFrontend)
std::cout << kCompilerFrontend->Language() << "\n";
@@ -1106,7 +1106,7 @@ LIBCOMPILER_MODULE(CompilerCPlusPlusAMD64)
return kExitOK;
}
- if (strcmp(argv[index], "--cl:max-err") == 0)
+ if (strcmp(argv[index], "-max-err") == 0)
{
try
{
diff --git a/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc b/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc
index 6a4e9cd..336ca5a 100644
--- a/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc
+++ b/dev/LibCompiler/src/CPlusPlusCompilerPreProcessor.cc
@@ -10,7 +10,7 @@
/// BUGS: 0
#include <LibCompiler/Parser.h>
-#include <LibCompiler/NFC/ErrorID.h>
+#include <LibCompiler/ErrorID.h>
#include <algorithm>
#include <filesystem>
#include <fstream>
@@ -419,7 +419,7 @@ void bpp_parse_file(std::ifstream& hdr_file, std::ofstream& pp_out)
}
else
{
- throw std::runtime_error("internal: Internal C++ error. (Please report that bug.)");
+ throw std::runtime_error("bpp: Internal error.");
}
}
diff --git a/dev/LibCompiler/src/Detail/AsmUtils.h b/dev/LibCompiler/src/Detail/AsmUtils.h
index 29dbcbe..997564c 100644
--- a/dev/LibCompiler/src/Detail/AsmUtils.h
+++ b/dev/LibCompiler/src/Detail/AsmUtils.h
@@ -6,7 +6,7 @@
#pragma once
-#include <LibCompiler/AAL/AssemblyInterface.h>
+#include <LibCompiler/AssemblyInterface.h>
#include <LibCompiler/Parser.h>
using namespace LibCompiler;
diff --git a/dev/LibCompiler/src/Detail/ClUtils.h b/dev/LibCompiler/src/Detail/ClUtils.h
index aa1e0f6..fe788a2 100644
--- a/dev/LibCompiler/src/Detail/ClUtils.h
+++ b/dev/LibCompiler/src/Detail/ClUtils.h
@@ -6,7 +6,7 @@
#pragma once
-#include <LibCompiler/AAL/AssemblyInterface.h>
+#include <LibCompiler/AssemblyInterface.h>
#include <LibCompiler/Parser.h>
#define kZero64Section ".zero64"
diff --git a/dev/LibCompiler/src/DynamicLinkerPEF.cc b/dev/LibCompiler/src/DynamicLinkerPEF.cc
index 22f268c..6410885 100644
--- a/dev/LibCompiler/src/DynamicLinkerPEF.cc
+++ b/dev/LibCompiler/src/DynamicLinkerPEF.cc
@@ -7,28 +7,28 @@
------------------------------------------- */
-/// @author EL Mahrouss Amlal (amlel)
+/// @author EL Mahrouss Amlal (amlal@nekernel.org)
/// @brief NeKernel 64-bit PEF Linker.
-/// Last Rev: Sat Feb 24 CET 2024
+/// Last Rev: Sat Apr 19 CET 2025
/// @note Do not look up for anything with .code64/.data64/.zero64!
/// It will be loaded when the program loader will start the image.
//! Toolchain Kit.
#include <LibCompiler/Defines.h>
-#include <LibCompiler/NFC/ErrorID.h>
+#include <LibCompiler/ErrorID.h>
//! Assembler Kit
-#include <LibCompiler/AAL/AssemblyInterface.h>
+#include <LibCompiler/AssemblyInterface.h>
//! Preferred Executable Format
-#include <LibCompiler/NFC/PEF.h>
+#include <LibCompiler/PEF.h>
#include <LibCompiler/UUID.h>
//! Release macros.
#include <LibCompiler/Version.h>
//! Advanced Executable Object Format.
-#include <LibCompiler/NFC/AE.h>
+#include <LibCompiler/AE.h>
#include <cstdint>
#define kLinkerVersionStr "\e[0;97m NeKernel 64-Bit Linker (Preferred Executable) %s, (c) Amlal El Mahrouss 2024-2025, all rights reserved.\n"
@@ -100,79 +100,79 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
*/
for (size_t linker_arg = 1; linker_arg < argc; ++linker_arg)
{
- if (StringCompare(argv[linker_arg], "--ld64:help") == 0)
+ if (StringCompare(argv[linker_arg], "-help") == 0)
{
kLinkerSplash();
- kStdOut << "--ld64:version: Show linker version.\n";
- kStdOut << "--ld64:help: Show linker help.\n";
- kStdOut << "--ld64:verbose: Enable linker trace.\n";
- kStdOut << "--ld64:dylib: Output as a Dyanmic PEF.\n";
- kStdOut << "--ld64:fat: Output as a FAT PEF.\n";
- kStdOut << "--ld64:32k: Output as a 32x0 PEF.\n";
- kStdOut << "--ld64:64k: Output as a 64x0 PEF.\n";
- kStdOut << "--ld64:amd64: Output as a AMD64 PEF.\n";
- kStdOut << "--ld64:rv64: Output as a RISC-V PEF.\n";
- kStdOut << "--ld64:power64: Output as a POWER PEF.\n";
- kStdOut << "--ld64:arm64: Output as a ARM64 PEF.\n";
- kStdOut << "--ld64:output: Select the output file name.\n";
+ kStdOut << "-version: Show linker version.\n";
+ kStdOut << "-help: Show linker help.\n";
+ kStdOut << "-ld-verbose: Enable linker trace.\n";
+ kStdOut << "-dylib: Output as a Dyanmic PEF.\n";
+ kStdOut << "-fat: Output as a FAT PEF.\n";
+ kStdOut << "-32k: Output as a 32x0 PEF.\n";
+ kStdOut << "-64k: Output as a 64x0 PEF.\n";
+ kStdOut << "-amd64: Output as a AMD64 PEF.\n";
+ kStdOut << "-rv64: Output as a RISC-V PEF.\n";
+ kStdOut << "-power64: Output as a POWER PEF.\n";
+ kStdOut << "-arm64: Output as a ARM64 PEF.\n";
+ kStdOut << "-output: Select the output file name.\n";
return EXIT_SUCCESS;
}
- else if (StringCompare(argv[linker_arg], "--ld64:version") == 0)
+ else if (StringCompare(argv[linker_arg], "-version") == 0)
{
kLinkerSplash();
return EXIT_SUCCESS;
}
- else if (StringCompare(argv[linker_arg], "--ld64:fat-binary") == 0)
+ else if (StringCompare(argv[linker_arg], "-fat-binary") == 0)
{
kFatBinaryEnable = true;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:64k") == 0)
+ else if (StringCompare(argv[linker_arg], "-64k") == 0)
{
kArch = LibCompiler::kPefArch64000;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:amd64") == 0)
+ else if (StringCompare(argv[linker_arg], "-amd64") == 0)
{
kArch = LibCompiler::kPefArchAMD64;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:32k") == 0)
+ else if (StringCompare(argv[linker_arg], "-32k") == 0)
{
kArch = LibCompiler::kPefArch32000;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:power64") == 0)
+ else if (StringCompare(argv[linker_arg], "-power64") == 0)
{
kArch = LibCompiler::kPefArchPowerPC;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:riscv64") == 0)
+ else if (StringCompare(argv[linker_arg], "-riscv64") == 0)
{
kArch = LibCompiler::kPefArchRISCV;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:arm64") == 0)
+ else if (StringCompare(argv[linker_arg], "-arm64") == 0)
{
kArch = LibCompiler::kPefArchARM64;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:verbose") == 0)
+ else if (StringCompare(argv[linker_arg], "-ld-verbose") == 0)
{
kVerbose = true;
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:dylib") == 0)
+ else if (StringCompare(argv[linker_arg], "-dylib") == 0)
{
if (kOutput.empty())
{
@@ -188,7 +188,7 @@ LIBCOMPILER_MODULE(DynamicLinker64PEF)
continue;
}
- else if (StringCompare(argv[linker_arg], "--ld64:output") == 0)
+ else if (StringCompare(argv[linker_arg], "-output") == 0)
{
if ((linker_arg + 1) > argc)
continue;
diff --git a/dev/LibCompiler/src/StringView.cc b/dev/LibCompiler/src/StringView.cc
index 30f1b5f..a3bbb4c 100644
--- a/dev/LibCompiler/src/StringView.cc
+++ b/dev/LibCompiler/src/StringView.cc
@@ -18,7 +18,7 @@
*
*/
-#include <LibCompiler/NFC/StringView.h>
+#include <LibCompiler/StringView.h>
namespace LibCompiler
{
diff --git a/dev/LibDebugger/DebuggerContract.h b/dev/LibDebugger/DebuggerContract.h
index 5d4f728..540ad08 100644
--- a/dev/LibDebugger/DebuggerContract.h
+++ b/dev/LibDebugger/DebuggerContract.h
@@ -9,8 +9,8 @@
namespace LibDebugger
{
- typedef uint64_t ProcessID;
- typedef char* CAddress;
+ typedef uint64_t ProcessID;
+ typedef char* CAddress;
/// \brief Debugger contract class in C++, as per the design states.
/// \author Amlal El Mahrouss
@@ -18,7 +18,7 @@ namespace LibDebugger
{
public:
explicit DebuggerContract() = default;
- virtual ~DebuggerContract() = default;
+ virtual ~DebuggerContract() = default;
public:
DebuggerContract& operator=(const DebuggerContract&) = default;
@@ -26,9 +26,9 @@ namespace LibDebugger
public:
virtual bool Attach(ProcessID pid) noexcept = 0;
- virtual bool Break(CAddress addr) noexcept = 0;
- virtual bool Continue() noexcept = 0;
- virtual bool Detach() noexcept = 0;
+ virtual bool Break(CAddress addr) noexcept = 0;
+ virtual bool Continue() noexcept = 0;
+ virtual bool Detach() noexcept = 0;
virtual std::unordered_map<uintptr_t, uintptr_t>& Get()
{
@@ -39,4 +39,4 @@ namespace LibDebugger
pid_t m_pid;
std::unordered_map<uintptr_t, uintptr_t> m_breakpoints;
};
-} // namespace LibDebugger::POSIX
+} // namespace LibDebugger
diff --git a/dev/LibDebugger/POSIXMachContract.h b/dev/LibDebugger/POSIXMachContract.h
index 6ff083f..1962202 100644
--- a/dev/LibDebugger/POSIXMachContract.h
+++ b/dev/LibDebugger/POSIXMachContract.h
@@ -12,6 +12,7 @@
/// @brief POSIX/Mach debugger.
#include <LibDebugger/DebuggerContract.h>
+#include <LibCompiler/Defines.h>
#include <sys/ptrace.h>
#include <sys/types.h>
@@ -35,7 +36,7 @@ namespace LibDebugger::POSIX
{
/// \brief POSIXMachContract engine interface class in C++
/// \author Amlal El Mahrouss
- class POSIXMachContract final : public DebuggerContract
+ class POSIXMachContract : public DebuggerContract
{
public:
explicit POSIXMachContract() = default;
@@ -46,7 +47,7 @@ namespace LibDebugger::POSIX
POSIXMachContract(const POSIXMachContract&) = default;
public:
- bool Attach(ProcessID pid) noexcept override
+ BOOL Attach(ProcessID pid) noexcept override
{
#ifdef __APPLE__
if (pid == 0)
@@ -69,7 +70,7 @@ namespace LibDebugger::POSIX
#endif
}
- bool Break(CAddress addr) noexcept override
+ BOOL Break(CAddress addr) noexcept override
{
#ifdef __APPLE__
task_read_t task;
@@ -100,7 +101,7 @@ namespace LibDebugger::POSIX
#endif
}
- bool Continue() noexcept override
+ BOOL Continue() noexcept override
{
#ifdef __APPLE__
task_read_t task;
@@ -122,7 +123,7 @@ namespace LibDebugger::POSIX
#endif
}
- bool Detach() noexcept override
+ BOOL Detach() noexcept override
{
#ifdef __APPLE__
this->Continue();
diff --git a/dev/LibDebugger/src/POSIXMachContract.cc b/dev/LibDebugger/src/POSIXMachContract.cc
index 4e7212c..cfce841 100644
--- a/dev/LibDebugger/src/POSIXMachContract.cc
+++ b/dev/LibDebugger/src/POSIXMachContract.cc
@@ -10,9 +10,9 @@
#ifndef _WIN32
-static bool kKeepRunning = false;
+static BOOL kKeepRunning = false;
static LibDebugger::POSIX::POSIXMachContract kDebugger;
-static pid_t kPID = 0L;
+static LibDebugger::ProcessID kPID = 0L;
static LibDebugger::CAddress kActiveAddress = nullptr;
/// @internal
@@ -33,7 +33,7 @@ static void dbgi_ctrlc_handler(std::int32_t _)
kKeepRunning = false;
}
-LIBCOMPILER_MODULE(DebuggerPOSIX)
+LIBCOMPILER_MODULE(DebuggerMachPOSIX)
{
pfd::notify("Debugger Event", "NeKernel Debugger\n(C) 2025 Amlal El Mahrouss, all rights reserved.");