From befde76cfa46c766e81f74eb5ac65d3dae2dde87 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 19 Apr 2025 17:33:26 +0200 Subject: dev, LibCompiler, tooling: refactor and separate components into modules (cppdrv, cxxdrv) Signed-off-by: Amlal El Mahrouss --- dev/LibCompiler/src/Assembler32x0.cc | 6 +-- dev/LibCompiler/src/Assembler64x0.cc | 6 +-- dev/LibCompiler/src/AssemblerAMD64.cc | 6 +-- dev/LibCompiler/src/AssemblerARM64.cc | 8 +-- dev/LibCompiler/src/AssemblerPower.cc | 8 +-- dev/LibCompiler/src/AssemblyFactory.cc | 4 +- dev/LibCompiler/src/CCompiler64x0.cc | 2 +- dev/LibCompiler/src/CCompilerARM64.cc | 2 +- dev/LibCompiler/src/CCompilerPower64.cc | 4 +- dev/LibCompiler/src/CPlusPlusCompilerAMD64.cc | 12 ++--- .../src/CPlusPlusCompilerPreProcessor.cc | 4 +- dev/LibCompiler/src/Detail/AsmUtils.h | 2 +- dev/LibCompiler/src/Detail/ClUtils.h | 2 +- dev/LibCompiler/src/DynamicLinkerPEF.cc | 60 +++++++++++----------- dev/LibCompiler/src/StringView.cc | 2 +- 15 files changed, 64 insertions(+), 64 deletions(-) (limited to 'dev/LibCompiler/src') 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 +#include #include -#include -#include +#include +#include ///////////////////// 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 +#include #include -#include -#include +#include +#include #include #include #include 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 +#include #include -#include -#include +#include +#include #include #include #include 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 -#include -#include +#include +#include +#include #include -#include +#include #include #include #include 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 -#include -#include +#include +#include +#include #include -#include +#include #include #include #include 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 -#include +#include +#include /** * @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 +#include #include #include #include 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 +#include #include #include #include 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 +#include #include #include #include @@ -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 +#include #include #include @@ -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 -#include +#include #include #include #include @@ -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 +#include #include 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 +#include #include #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 -#include +#include //! Assembler Kit -#include +#include //! Preferred Executable Format -#include +#include #include //! Release macros. #include //! Advanced Executable Object Format. -#include +#include #include #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 +#include namespace LibCompiler { -- cgit v1.2.3