summaryrefslogtreecommitdiffhomepage
path: root/dev
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-07-17 08:03:10 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2025-07-17 08:03:57 +0100
commit8dbb92e920c662fa2fe22693677d90498f2d85d9 (patch)
tree4bdee5a6c7a090f7b0695856f90f694d8923aec2 /dev
parent8287471571b29416ec70bc363806cd24a287b885 (diff)
fix: LibCompiler frontend has been reworked to work on clang. Renamed 'Linkers' irectory to 'Linker'
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev')
-rw-r--r--dev/LibCompiler/Frontend.h16
-rw-r--r--dev/LibCompiler/Util/CompilerUtils.h7
-rw-r--r--dev/LibCompiler/src/CodeGen.cc2
-rw-r--r--dev/LibCompiler/src/Linker/DynamicLinker64PEF.cc (renamed from dev/LibCompiler/src/Linkers/DynamicLinker64PEF.cc)28
4 files changed, 18 insertions, 35 deletions
diff --git a/dev/LibCompiler/Frontend.h b/dev/LibCompiler/Frontend.h
index 5628f9a..d5d9733 100644
--- a/dev/LibCompiler/Frontend.h
+++ b/dev/LibCompiler/Frontend.h
@@ -58,21 +58,21 @@ enum KeywordKind {
/// \brief Compiler keyword information struct.
struct CompilerKeyword {
+ CompilerKeyword(STLString name, KeywordKind kind) : keyword_name(name), keyword_kind(kind) {}
+
STLString keyword_name{""};
KeywordKind keyword_kind{kKeywordKindInvalid};
};
struct SyntaxLeafList final {
struct SyntaxLeaf final {
- Int32 fUserType;
+ Int32 fUserType{0U};
+ CompilerKeyword fUserData{
+ "",
+ kKeywordKindInvalid
+ };
-#ifdef LC_USE_STRUCTS
- CompilerKeyword fUserData;
-#else
- std::string fUserData;
-#endif
-
- std::string fUserValue{""};
+ STLString fUserValue{""};
struct SyntaxLeaf* fNext{nullptr};
};
diff --git a/dev/LibCompiler/Util/CompilerUtils.h b/dev/LibCompiler/Util/CompilerUtils.h
index 19e247d..172907a 100644
--- a/dev/LibCompiler/Util/CompilerUtils.h
+++ b/dev/LibCompiler/Util/CompilerUtils.h
@@ -11,6 +11,7 @@
#include <LibCompiler/Frontend.h>
#include <LibCompiler/Version.h>
#include <Vendor/Dialogs.h>
+#include <iostream>
#define kZero64Section ".zero64"
#define kCode64Section ".code64"
@@ -34,6 +35,12 @@ inline static bool kVerbose = false;
inline static bool kOutputAsBinary = false;
namespace Detail {
+/// @brief Linker specific blob metadata structure
+struct DynamicLinkerBlob final {
+ std::vector<Char> mBlob{}; // PEF code/bss/data blob.
+ UIntPtr mOffset{0UL}; // the offset of the PEF container header...
+};
+
inline void print_error(std::string reason, std::string file) noexcept {
if (reason[0] == '\n') reason.erase(0, 1);
diff --git a/dev/LibCompiler/src/CodeGen.cc b/dev/LibCompiler/src/CodeGen.cc
index 92a1d0f..a6fff71 100644
--- a/dev/LibCompiler/src/CodeGen.cc
+++ b/dev/LibCompiler/src/CodeGen.cc
@@ -10,7 +10,7 @@
/**
* @file CodeGen.cc
* @author amlal (amlal@nekernel.org)
- * @brief Assembler Kit
+ * @brief Assembler Kit (Code generation kit)
* @version 0.1
* @date 2024-01-27
*
diff --git a/dev/LibCompiler/src/Linkers/DynamicLinker64PEF.cc b/dev/LibCompiler/src/Linker/DynamicLinker64PEF.cc
index 7cb93a9..47ff9e5 100644
--- a/dev/LibCompiler/src/Linkers/DynamicLinker64PEF.cc
+++ b/dev/LibCompiler/src/Linker/DynamicLinker64PEF.cc
@@ -3,7 +3,7 @@
Copyright (C) 2024-2025 Amlal El Mahrouss, all rights reserved
@file DynamicLinker64PEF.cc
- @brief: C++ 64-Bit PEF Linker.
+ @brief: C++ 64-Bit PEF Linker for NeKernel.org
------------------------------------------- */
@@ -13,33 +13,16 @@
/// @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>
-//! Error ID
+#include <LibCompiler/Defines.h>
#include <LibCompiler/ErrorID.h>
-
-//! Assembler Kit
#include <LibCompiler/CodeGen.h>
-
-//! Preferred Executable Format
#include <LibCompiler/PEF.h>
-
-//! UUID header.
#include <LibCompiler/UUID.h>
-
-//! Release macros.
#include <LibCompiler/Version.h>
-
-//! Advanced Executable Object Format.
#include <LibCompiler/AE.h>
-
-//! LibCompiler utils.
#include <LibCompiler/Util/CompilerUtils.h>
-//! I/O stream from std c++
-#include <iostream>
-
#define kLinkerVersionStr \
"NeKernel.org 64-Bit Linker (Preferred Executable Format) %s, (c) Amlal El Mahrouss " \
"2024-2025 " \
@@ -66,13 +49,6 @@
<< "ld64: " \
<< "\e[0;97m")
-namespace Detail {
-struct DynamicLinkerBlob final {
- std::vector<Char> mBlob{}; // PEF code/bss/data blob.
- UIntPtr mOffset{0UL}; // the offset of the PEF container header...
-};
-} // namespace Detail
-
enum {
kABITypeNull = 0,
kABITypeStart = 0x1010, /* The start of ABI list. */