From 2b770125c35f061e0da813dab91f42c96b1ac749 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 28 Feb 2026 07:27:27 +0100 Subject: chore: wip: including TProc and Boost for Nectar compiler frontend. Signed-off-by: Amlal El Mahrouss --- README.md | 3 +- include/CompilerKit/AE.h | 14 +++---- include/CompilerKit/CodeGenerator.h | 10 ++--- include/CompilerKit/Detail/Config.h | 6 ++- include/CompilerKit/Detail/PreConfig.h | 2 - include/CompilerKit/Macros.h | 4 +- include/CompilerKit/PEF.h | 4 +- include/CompilerKit/UUID.h | 34 +++++++-------- include/CompilerKit/Utilities/Compiler.h | 2 +- include/CompilerKit/Utilities/DLL.h | 2 +- include/ThirdParty/README.md | 9 ++++ src/CommandLine/dbg.cpp | 4 +- src/CommandLine/kdbg.cpp | 4 +- src/CommandLine/ld64.cpp | 4 +- src/CommandLine/mld64.cpp | 4 +- src/CommandLine/pef-amd64-asm.cpp | 2 +- src/CommandLine/pef-amd64-drv.cpp | 2 +- src/CompilerKit/src/Assemblers/Assembler+ARM64.cpp | 2 +- .../src/Assemblers/Assembler+PowerPC.cpp | 2 +- .../src/Linkers/DynamicLinker64+MachO.cpp | 48 +++++++++++----------- .../src/Linkers/DynamicLinker64+PEF.cpp | 8 ++-- .../test/Linkers/DynamicLinker64+MachO.test.cc | 6 +-- .../test/Linkers/DynamicLinker64+PEF.test.cc | 6 +-- 23 files changed, 96 insertions(+), 86 deletions(-) create mode 100644 include/ThirdParty/README.md diff --git a/README.md b/README.md index d6f6abc..bf17e8f 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,9 @@ Join us in our [Discord](https://discord.gg/uD76Qweght), we're quite active and - [Boost](https://boost.org/) - [NeBuild](https://github.com/nekernel-org/nebuild) - [Doxygen](https://www.doxygen.nl/) -- CoreUtils +- GNU CoreUtils - [Git](https://git-scm.com/) +- [OCL.TProc](https://github.com/ocl-org/tproc) ### Notice for Contributors: diff --git a/include/CompilerKit/AE.h b/include/CompilerKit/AE.h index c69262c..38e4dcc 100644 --- a/include/CompilerKit/AE.h +++ b/include/CompilerKit/AE.h @@ -33,15 +33,15 @@ namespace CompilerKit { // One thing to keep in mind. // This object format, is reloctable. typedef struct AEHeader final { - Char fMagic[kAEMagLen] = {}; + char fMagic[kAEMagLen] = {}; UInt16 fVersion{kAEIdentVersion}; - Char fArch{}; - Char fSubArch{}; + char fArch{}; + char fSubArch{}; SizeType fCount{}; - Char fSize{}; + char fSize{}; SizeType fStartCode{}; SizeType fCodeSize{}; - Char fPad[kAEPad] = {}; + char fPad[kAEPad] = {}; } PACKED AEHeader, *AEHeaderPtr; // @brief Advanced Executable Record. @@ -49,12 +49,12 @@ typedef struct AEHeader final { // fKind must be filled with PEF fields. typedef struct AERecordHeader final { - Char fName[kAESymbolLen]; + char fName[kAESymbolLen]; SizeType fKind; SizeType fSize; SizeType fFlags; UIntPtr fOffset; - Char fPad[kAEPad]; + char fPad[kAEPad]; } PACKED AERecordHeader, *AERecordHeaderPtr; enum { diff --git a/include/CompilerKit/CodeGenerator.h b/include/CompilerKit/CodeGenerator.h index f82441c..c19e978 100644 --- a/include/CompilerKit/CodeGenerator.h +++ b/include/CompilerKit/CodeGenerator.h @@ -81,7 +81,7 @@ union NumberCastBase { static constexpr auto kLimit = 1; - Char number[kLimit]; + char number[kLimit]; UInt64 raw; }; @@ -93,7 +93,7 @@ union NumberCast64 final { static constexpr auto kLimit = 8; - Char number[kLimit]; + char number[kLimit]; UInt64 raw; }; @@ -105,7 +105,7 @@ union NumberCast32 final { static constexpr auto kLimit = 4; - Char number[kLimit]; + char number[kLimit]; UInt32 raw; }; @@ -117,7 +117,7 @@ union NumberCast16 final { static constexpr auto kLimit = 2; - Char number[kLimit]; + char number[kLimit]; UInt16 raw; }; @@ -127,7 +127,7 @@ union NumberCast8 final { ~NumberCast8() { raw = 0; } - Char number; + char number; UInt8 raw; }; diff --git a/include/CompilerKit/Detail/Config.h b/include/CompilerKit/Detail/Config.h index 40a453d..3ab2c04 100644 --- a/include/CompilerKit/Detail/Config.h +++ b/include/CompilerKit/Detail/Config.h @@ -13,10 +13,12 @@ /// =========================================================== /// #include +#include namespace CompilerKit { inline static constexpr int kBaseYear = 1900; -using STLString = std::string; + using STLString = std::string; + using RopeString = ocl::tproc::crope; inline STLString current_date() noexcept { auto time_data = time(nullptr); @@ -32,7 +34,7 @@ inline STLString current_date() noexcept { return fmt; } -inline bool to_str(Char* str, Int32 limit, Int32 base) noexcept { +inline bool to_str(char* str, Int32 limit, Int32 base) noexcept { if (limit == 0) return false; Int32 copy_limit = limit; diff --git a/include/CompilerKit/Detail/PreConfig.h b/include/CompilerKit/Detail/PreConfig.h index 28f1016..d7ea4c6 100644 --- a/include/CompilerKit/Detail/PreConfig.h +++ b/include/CompilerKit/Detail/PreConfig.h @@ -41,8 +41,6 @@ #define Int8 int8_t #define UInt8 uint8_t -#define Char char - #include #include #include diff --git a/include/CompilerKit/Macros.h b/include/CompilerKit/Macros.h index 9030dc4..bf85c60 100644 --- a/include/CompilerKit/Macros.h +++ b/include/CompilerKit/Macros.h @@ -1,9 +1,9 @@ -// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org) +// Copyright 2024-2026, Amlal El Mahrouss (amlal@nekernel.org) // Licensed under the Apache License, Version 2.0 (See accompanying // file LICENSE or copy at http://www.apache.org/licenses/LICENSE-2.0) // Official repository: https://github.com/nekernel-org/nectar -/// @brief provide support for Macros.h header. +/// @brief provide support for the CK headers. #ifndef _NECTAR_MACROS_H_ #define _NECTAR_MACROS_H_ diff --git a/include/CompilerKit/PEF.h b/include/CompilerKit/PEF.h index 0c3fd78..f7b88b9 100644 --- a/include/CompilerKit/PEF.h +++ b/include/CompilerKit/PEF.h @@ -83,7 +83,7 @@ enum { /* PEF container information */ typedef struct PEFContainer final { - Char Magic[kPefMagicLen]; + char Magic[kPefMagicLen]; UInt32 Linker; /* Linker used to link executable */ UInt32 Version; UInt32 Kind; @@ -103,7 +103,7 @@ typedef struct PEFContainer final { /* @brief Command Header, a la Mach-O, designed with FAT binaries and virtual memory in mind. */ typedef struct PEFCommandHeader final { - Char Name[kPefNameLen]; /* container name */ + char Name[kPefNameLen]; /* container name */ UInt32 Cpu; /* container cpu */ UInt32 SubCpu; /* container sub-cpu */ UInt32 Flags; /* container flags */ diff --git a/include/CompilerKit/UUID.h b/include/CompilerKit/UUID.h index 2993b8b..02f95dc 100644 --- a/include/CompilerKit/UUID.h +++ b/include/CompilerKit/UUID.h @@ -261,14 +261,14 @@ namespace Detail { size_t m_byteCount; }; - template - inline constexpr CharT empty_guid[37] = "00000000-0000-0000-0000-000000000000"; + template + inline constexpr Char empty_guid[37] = "00000000-0000-0000-0000-000000000000"; template <> inline constexpr wchar_t empty_guid[37] = L"00000000-0000-0000-0000-000000000000"; - template - inline constexpr CharT guid_encoder[17] = "0123456789abcdef"; + template + inline constexpr Char guid_encoder[17] = "0123456789abcdef"; template <> inline constexpr wchar_t guid_encoder[17] = L"0123456789abcdef"; @@ -349,9 +349,9 @@ enum class uuid_version { // Forward declare uuid & to_string so that we can declare to_string as a friend // later. class uuid; -template , - class Allocator = std::allocator> -std::basic_string to_string(uuid const& id); +template , + class Allocator = std::allocator> +std::basic_string to_string(uuid const& id); // -------------------------------------------------------------------------------------------------------------------------- // uuid class @@ -498,8 +498,8 @@ class uuid { friend std::basic_ostream& operator<<(std::basic_ostream& s, uuid const& id); - template - friend std::basic_string to_string(uuid const& id); + template + friend std::basic_string to_string(uuid const& id); friend std::hash; }; @@ -520,16 +520,16 @@ class uuid { return lhs.data < rhs.data; } -template -[[nodiscard]] inline std::basic_string to_string(uuid const& id) { - std::basic_string uustr{Detail::empty_guid}; +template +[[nodiscard]] inline std::basic_string to_string(uuid const& id) { + std::basic_string uustr{Detail::empty_guid}; for (size_t i = 0, index = 0; i < 36; ++i) { if (i == 8 || i == 13 || i == 18 || i == 23) { continue; } - uustr[i] = Detail::guid_encoder[id.data[index] >> 4 & 0x0f]; - uustr[++i] = Detail::guid_encoder[id.data[index] & 0x0f]; + uustr[i] = Detail::guid_encoder[id.data[index] >> 4 & 0x0f]; + uustr[++i] = Detail::guid_encoder[id.data[index] & 0x0f]; index++; } @@ -679,11 +679,11 @@ class uuid_name_generator { hasher.process_bytes(bytes, 16); } - template - void process_characters(std::basic_string_view const str) { + template + void process_characters(std::basic_string_view const str) { for (uint32_t c : str) { hasher.process_byte(static_cast(c & 0xFF)); - if constexpr (!std::is_same_v) { + if constexpr (!std::is_same_v) { hasher.process_byte(static_cast((c >> 8) & 0xFF)); hasher.process_byte(static_cast((c >> 16) & 0xFF)); hasher.process_byte(static_cast((c >> 24) & 0xFF)); diff --git a/include/CompilerKit/Utilities/Compiler.h b/include/CompilerKit/Utilities/Compiler.h index ca577db..42fc977 100644 --- a/include/CompilerKit/Utilities/Compiler.h +++ b/include/CompilerKit/Utilities/Compiler.h @@ -41,7 +41,7 @@ inline static bool kNasmOutput = false; namespace CompilerKit::Detail { /// @brief Blob structure struct Blob final { - std::vector mBlob{}; // PEF code/bss/data blob. + std::vector mBlob{}; // PEF code/bss/data blob. UIntPtr mOffset{0UL}; // the offset of the PEF container header... explicit operator bool() { return mBlob.empty() && mOffset > 0UL; } diff --git a/include/CompilerKit/Utilities/DLL.h b/include/CompilerKit/Utilities/DLL.h index 26eacea..36c511a 100644 --- a/include/CompilerKit/Utilities/DLL.h +++ b/include/CompilerKit/Utilities/DLL.h @@ -16,7 +16,7 @@ namespace CompilerKit { #ifdef CK_POSIX class ModuleLoader final { public: - using EntryT = Int32 (*)(Int32 argc, Char const* argv[]); + using EntryT = Int32 (*)(Int32 argc, char const* argv[]); using HandleT = VoidPtr; using MutexT = std::mutex; diff --git a/include/ThirdParty/README.md b/include/ThirdParty/README.md new file mode 100644 index 0000000..91bdf73 --- /dev/null +++ b/include/ThirdParty/README.md @@ -0,0 +1,9 @@ +# Third Party: + +You will need: + +- Open C++ Libraries's TProc module. +- Boost 1.90.0+ +- A Modern C++ Compiler. + +In order to compile CompilerKit. diff --git a/src/CommandLine/dbg.cpp b/src/CommandLine/dbg.cpp index 5b08a69..c5e5797 100644 --- a/src/CommandLine/dbg.cpp +++ b/src/CommandLine/dbg.cpp @@ -8,10 +8,10 @@ /// @file dbg.cc /// @brief Nectar debugger. -CK_IMPORT_C Int32 DebuggerMachPOSIX(Int32 argc, Char const* argv[]); +CK_IMPORT_C Int32 DebuggerMachPOSIX(Int32 argc, char const* argv[]); /// @brief Debugger entrypoint. /// @return Status code of debugger. -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { return DebuggerMachPOSIX(argc, argv); } diff --git a/src/CommandLine/kdbg.cpp b/src/CommandLine/kdbg.cpp index 148efb3..2456947 100644 --- a/src/CommandLine/kdbg.cpp +++ b/src/CommandLine/kdbg.cpp @@ -8,10 +8,10 @@ /// @file kdbg.cc /// @brief NeKernel debugger. -CK_IMPORT_C Int32 DebuggerNeKernel(Int32 argc, Char const* argv[]); +CK_IMPORT_C Int32 DebuggerNeKernel(Int32 argc, char const* argv[]); /// @brief Debugger entrypoint. /// @return Status code of debugger. -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { return DebuggerNeKernel(argc, argv); } diff --git a/src/CommandLine/ld64.cpp b/src/CommandLine/ld64.cpp index 6d8a247..b438315 100644 --- a/src/CommandLine/ld64.cpp +++ b/src/CommandLine/ld64.cpp @@ -8,8 +8,8 @@ /// @file ld64.cc /// @brief Nectar linker for AE objects. -CK_IMPORT_C Int32 DynamicLinker64PEF(Int32 argc, Char const* argv[]); +CK_IMPORT_C Int32 DynamicLinker64PEF(Int32 argc, char const* argv[]); -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { return DynamicLinker64PEF(argc, argv); } diff --git a/src/CommandLine/mld64.cpp b/src/CommandLine/mld64.cpp index f19712b..32fc0ba 100644 --- a/src/CommandLine/mld64.cpp +++ b/src/CommandLine/mld64.cpp @@ -8,8 +8,8 @@ /// @file ld64.cc /// @brief Nectar linker for AE objects. -CK_IMPORT_C Int32 DynamicLinker64MachO(Int32 argc, Char const* argv[]); +CK_IMPORT_C Int32 DynamicLinker64MachO(Int32 argc, char const* argv[]); -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { return DynamicLinker64MachO(argc, argv); } diff --git a/src/CommandLine/pef-amd64-asm.cpp b/src/CommandLine/pef-amd64-asm.cpp index 3ca4639..77ca000 100644 --- a/src/CommandLine/pef-amd64-asm.cpp +++ b/src/CommandLine/pef-amd64-asm.cpp @@ -19,7 +19,7 @@ static auto kPath = "/usr/lib/libCompilerKit.so"; static auto kSymbol = "AssemblerMainAMD64"; -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { CompilerKit::ModuleLoader dylib; dylib(kPath, kSymbol); diff --git a/src/CommandLine/pef-amd64-drv.cpp b/src/CommandLine/pef-amd64-drv.cpp index c8d8dbe..0f919b4 100644 --- a/src/CommandLine/pef-amd64-drv.cpp +++ b/src/CommandLine/pef-amd64-drv.cpp @@ -19,7 +19,7 @@ static auto kPath = "/usr/lib/libCompilerKit.so"; static auto kSymbol = "CompilerNectarAMD64"; -Int32 main(Int32 argc, Char const* argv[]) { +Int32 main(Int32 argc, char const* argv[]) { CompilerKit::ModuleLoader dylib; dylib(kPath, kSymbol); diff --git a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cpp b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cpp index 4cc0464..d4b2904 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+ARM64.cpp +++ b/src/CompilerKit/src/Assemblers/Assembler+ARM64.cpp @@ -39,7 +39,7 @@ constexpr auto kArm64Alignment = 0x1U; -static Char kOutputArch = CompilerKit::kPefArchARM64; +static char kOutputArch = CompilerKit::kPefArchARM64; static std::size_t kCounter = 1UL; diff --git a/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cpp b/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cpp index 05ca0d7..bf16842 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cpp +++ b/src/CompilerKit/src/Assemblers/Assembler+PowerPC.cpp @@ -39,7 +39,7 @@ constexpr auto kPowerIPAlignment = 0x1U; -static Char kOutputArch = CompilerKit::kPefArchPowerPC; +static char kOutputArch = CompilerKit::kPefArchPowerPC; static std::size_t kCounter = 1UL; diff --git a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp index bb2ce3a..0187924 100644 --- a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp +++ b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp @@ -51,14 +51,14 @@ static std::vector kDataBytes; /* @brief symbol tables */ static std::vector kSymbolTable; -static std::vector kStringTable; +static std::vector kStringTable; static std::map kSymbolOffsets; /// @brief Structure to hold section information from AE records struct SectionInfo { CompilerKit::STLString name; UInt32 kind; - std::vector bytes; + std::vector bytes; UInt64 address; UInt64 size; }; @@ -71,7 +71,7 @@ static CompilerKit::STLString macho_extract_symbol_name(const CompilerKit::STLSt CompilerKit::STLString name = aeName; // Remove section prefixes/suffixes - const Char* sections[] = {".code64", ".data64", ".zero64", "$"}; + const char* sections[] = {".code64", ".data64", ".zero64", "$"}; for (const auto& sec : sections) { size_t pos; @@ -102,7 +102,7 @@ static UInt32 macho_add_symbol(const CompilerKit::STLString& name, uint8_t type, UInt32 strOffset = static_cast(kStringTable.size()); - for (const Char& c : name) { + for (const char& c : name) { kStringTable.push_back(c); } @@ -239,7 +239,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { hdr.fSize == sizeof(CompilerKit::AEHeader) && hdr.fMagic[2] == kAEMag2) { std::size_t cnt = hdr.fCount; - Char* raw_ae_records = new Char[cnt * sizeof(CompilerKit::AERecordHeader)]; + char* raw_ae_records = new char[cnt * sizeof(CompilerKit::AERecordHeader)]; if (!raw_ae_records) { return NECTAR_EXEC_ERROR; @@ -290,7 +290,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { raw_ae_records = nullptr; // Read the actual code bytes - std::vector bytes; + std::vector bytes; bytes.resize(hdr.fCodeSize); reader_protocol.fFilePtr.seekg(std::streamsize(hdr.fStartCode)); @@ -402,7 +402,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { header.flags = MH_NOUNDEFS | MH_DYLDLINK | MH_TWOLEVEL | MH_PIE; header.reserved = 0; - output_fc.write(reinterpret_cast(&header), sizeof(header)); + output_fc.write(reinterpret_cast(&header), sizeof(header)); segment_command_64 pageZeroSegment{}; pageZeroSegment.cmd = LC_SEGMENT_64; @@ -417,7 +417,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { pageZeroSegment.nsects = 0; pageZeroSegment.flags = 0; - output_fc.write(reinterpret_cast(&pageZeroSegment), sizeof(pageZeroSegment)); + output_fc.write(reinterpret_cast(&pageZeroSegment), sizeof(pageZeroSegment)); build_version_command build = {.cmd = LC_BUILD_VERSION, .cmdsize = sizeof(build_version_command), @@ -426,7 +426,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { .sdk = (kLatestOSX << 16), // macOS 11.0 .ntools = 0}; - output_fc.write(reinterpret_cast(&build), sizeof(build)); + output_fc.write(reinterpret_cast(&build), sizeof(build)); // Write __TEXT segment command segment_command_64 textSegment{}; @@ -443,7 +443,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { textSegment.nsects = 1; textSegment.flags = 0; - output_fc.write(reinterpret_cast(&textSegment), sizeof(textSegment)); + output_fc.write(reinterpret_cast(&textSegment), sizeof(textSegment)); // Write __text section header section_64 textSection{}; @@ -460,7 +460,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { textSection.reserved2 = 0; textSection.reserved3 = 0; - output_fc.write(reinterpret_cast(&textSection), sizeof(textSection)); + output_fc.write(reinterpret_cast(&textSection), sizeof(textSection)); // Write __DATA segment command segment_command_64 dataSegment{}; @@ -477,7 +477,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { dataSegment.flags = 0; if (dataSegCmdSize > 0) - output_fc.write(reinterpret_cast(&dataSegment), sizeof(dataSegment)); + output_fc.write(reinterpret_cast(&dataSegment), sizeof(dataSegment)); // Write __data section header section_64 dataSection{}; @@ -495,7 +495,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { dataSection.reserved3 = 0; if (dataSegCmdSize > 0) - output_fc.write(reinterpret_cast(&dataSection), sizeof(dataSection)); + output_fc.write(reinterpret_cast(&dataSection), sizeof(dataSection)); // Write __LINKEDIT segment command (contains symbol/string tables) segment_command_64 linkeditSegment{}; @@ -511,11 +511,11 @@ NECTAR_MODULE(DynamicLinker64MachO) { linkeditSegment.nsects = 0; linkeditSegment.flags = 0; - output_fc.write(reinterpret_cast(&linkeditSegment), sizeof(linkeditSegment)); + output_fc.write(reinterpret_cast(&linkeditSegment), sizeof(linkeditSegment)); // Write LC_LOAD_DYLINKER command - constexpr Char* dyldPath = "/usr/lib/dyld"; - std::vector dylinkerCmd(dylinkerCmdSize, 0); + constexpr char* dyldPath = "/usr/lib/dyld"; + std::vector dylinkerCmd(dylinkerCmdSize, 0); dylinker_command* dylinker = reinterpret_cast(dylinkerCmd.data()); dylinker->cmd = LC_LOAD_DYLINKER; dylinker->cmdsize = dylinkerCmdSize; @@ -531,7 +531,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { // entryoff is relative to __TEXT segment file offset entryCommand.entryoff = textFileOffset + entryCommand.entryoff; - output_fc.write(reinterpret_cast(&entryCommand), sizeof(entryCommand)); + output_fc.write(reinterpret_cast(&entryCommand), sizeof(entryCommand)); } // Write LC_UUID command @@ -547,7 +547,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { auto uuidBytes = generatedUuid.as_bytes(); std::memcpy(uuidCmd.uuid, uuidBytes.data(), 16); - output_fc.write(reinterpret_cast(&uuidCmd), sizeof(uuidCmd)); + output_fc.write(reinterpret_cast(&uuidCmd), sizeof(uuidCmd)); // Write LC_SYMTAB command symtab_command symtabCmd{}; @@ -558,7 +558,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { symtabCmd.stroff = static_cast(strtabFileOffset); symtabCmd.strsize = static_cast(kStringTable.size()); - output_fc.write(reinterpret_cast(&symtabCmd), sizeof(symtabCmd)); + output_fc.write(reinterpret_cast(&symtabCmd), sizeof(symtabCmd)); // Write LC_DYSYMTAB command dysymtab_command dysymtabCmd{}; @@ -578,14 +578,14 @@ NECTAR_MODULE(DynamicLinker64MachO) { dysymtabCmd.iundefsym = static_cast(kSymbolTable.size()); dysymtabCmd.nundefsym = 0; - output_fc.write(reinterpret_cast(&dysymtabCmd), sizeof(dysymtabCmd)); + output_fc.write(reinterpret_cast(&dysymtabCmd), sizeof(dysymtabCmd)); // Pad to text section offset UInt64 currentPos = output_fc.tellp(); UInt64 padding = textFileOffset - currentPos; if (padding > 0) { - std::vector zeros(padding, 0); + std::vector zeros(padding, 0); output_fc.write(zeros.data(), zeros.size()); } @@ -599,7 +599,7 @@ NECTAR_MODULE(DynamicLinker64MachO) { padding = dataFileOffset - currentPos; if (padding > 0) { - std::vector zeros(padding, 0); + std::vector zeros(padding, 0); output_fc.write(zeros.data(), zeros.size()); } @@ -613,13 +613,13 @@ NECTAR_MODULE(DynamicLinker64MachO) { padding = symtabFileOffset - currentPos; if (padding > 0) { - std::vector zeros(padding, 0); + std::vector zeros(padding, 0); output_fc.write(zeros.data(), zeros.size()); } // Write symbol table (nlist_64 entries) for (auto& sym : kSymbolTable) { - output_fc.write(reinterpret_cast(&sym), sizeof(nlist_64)); + output_fc.write(reinterpret_cast(&sym), sizeof(nlist_64)); } diff --git a/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cpp b/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cpp index 6be6c58..19ffc97 100644 --- a/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cpp +++ b/src/CompilerKit/src/Linkers/DynamicLinker64+PEF.cpp @@ -58,8 +58,8 @@ static bool kStartFound = false; static bool kDuplicateSymbols = false; /* ld64 is to be found, mld is to be found at runtime. */ -static const Char* kLinkerDefineSymbol = ":UndefinedSymbol:"; -static const Char* kLinkerDynamicSym = ":RuntimeSymbol:"; +static const char* kLinkerDefineSymbol = ":UndefinedSymbol:"; +static const char* kLinkerDynamicSym = ":RuntimeSymbol:"; static CompilerKit::STLString kLinkerStart = kPefStart; @@ -268,7 +268,7 @@ NECTAR_MODULE(DynamicLinker64PEF) { pef_container.Count = cnt; - Char* raw_ae_records = new Char[cnt * sizeof(CompilerKit::AERecordHeader)]; + char* raw_ae_records = new char[cnt * sizeof(CompilerKit::AERecordHeader)]; if (!raw_ae_records) { if (kVerbose) kConsoleOut << "allocation failed for records of count: " << cnt << "\n"; @@ -329,7 +329,7 @@ NECTAR_MODULE(DynamicLinker64PEF) { delete[] raw_ae_records; raw_ae_records = nullptr; - std::vector bytes; + std::vector bytes; bytes.resize(hdr.fCodeSize); reader_protocol.fFilePtr.seekg(std::streamsize(hdr.fStartCode)); diff --git a/src/CompilerKit/test/Linkers/DynamicLinker64+MachO.test.cc b/src/CompilerKit/test/Linkers/DynamicLinker64+MachO.test.cc index c6592dd..9626873 100644 --- a/src/CompilerKit/test/Linkers/DynamicLinker64+MachO.test.cc +++ b/src/CompilerKit/test/Linkers/DynamicLinker64+MachO.test.cc @@ -8,12 +8,12 @@ #include #include -CK_IMPORT_C Int32 DynamicLinker64MachO(Int32 argc, Char** argv); +CK_IMPORT_C Int32 DynamicLinker64MachO(Int32 argc, char** argv); static Int32 kArgc{}; -static Char** kArgv{}; +static char** kArgv{}; -Int32 main(Int32 argc, Char** argv) { +Int32 main(Int32 argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); kArgc = argc; diff --git a/src/CompilerKit/test/Linkers/DynamicLinker64+PEF.test.cc b/src/CompilerKit/test/Linkers/DynamicLinker64+PEF.test.cc index a32bae2..3198988 100644 --- a/src/CompilerKit/test/Linkers/DynamicLinker64+PEF.test.cc +++ b/src/CompilerKit/test/Linkers/DynamicLinker64+PEF.test.cc @@ -8,12 +8,12 @@ #include #include -CK_IMPORT_C Int32 DynamicLinker64PEF(Int32 argc, Char** argv); +CK_IMPORT_C Int32 DynamicLinker64PEF(Int32 argc, char** argv); static Int32 kArgc{}; -static Char** kArgv{}; +static char** kArgv{}; -Int32 main(Int32 argc, Char** argv) { +Int32 main(Int32 argc, char** argv) { ::testing::InitGoogleTest(&argc, argv); kArgc = argc; -- cgit v1.2.3