summaryrefslogtreecommitdiffhomepage
path: root/src/CompilerKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-03-13 15:11:34 +0100
committerGitHub <noreply@github.com>2026-03-13 15:11:34 +0100
commit927d2cf3e85188514df885efb7782e5570ff36cf (patch)
tree248b956a9fc08c67c0cfeb01f3a0f95c0fd4825f /src/CompilerKit
parentfe55f67bf7a5aeba365d7af1d681cef1d9ed7a3c (diff)
parenta4bb44e2a004d04cbee3ceb2d90aa7461dabecf4 (diff)
Merge pull request #73 from ne-foss-org/compiler_kit-osx-tweaks-fixes
[FEAT] Update and add Nectar compliant snippet with CL paradigm in mind.
Diffstat (limited to 'src/CompilerKit')
-rw-r--r--src/CompilerKit/ck-osx-san.json5
-rw-r--r--src/CompilerKit/ck-osx.json3
-rw-r--r--src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp10
-rw-r--r--src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp6
4 files changed, 17 insertions, 7 deletions
diff --git a/src/CompilerKit/ck-osx-san.json b/src/CompilerKit/ck-osx-san.json
index 7ded2a0..8e09356 100644
--- a/src/CompilerKit/ck-osx-san.json
+++ b/src/CompilerKit/ck-osx-san.json
@@ -1,9 +1,10 @@
-i{
- "compiler_path": "clang++",
+{
+ "compiler_path": "g++",
"compiler_std": "c++20",
"headers_path": [
"../../include/CompilerKit",
"../../include/",
+ "/usr/local/include",
"../../include/CompilerKit/src/",
"../../include/CompilerKit/src/impl",
"/opt/homebrew/Cellar/boost/1.90.0/include"
diff --git a/src/CompilerKit/ck-osx.json b/src/CompilerKit/ck-osx.json
index 53bdba2..2dd9bbd 100644
--- a/src/CompilerKit/ck-osx.json
+++ b/src/CompilerKit/ck-osx.json
@@ -1,11 +1,12 @@
{
- "compiler_path": "clang++",
+ "compiler_path": "g++",
"compiler_std": "c++20",
"headers_path": [
"../../include/CompilerKit",
"../../include/",
"../../include/CompilerKit/src/",
"../../include/CompilerKit/src/impl",
+ "/usr/local/include/",
"/opt/homebrew/Cellar/boost/1.90.0/include"
],
"sources_path": [
diff --git a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp
index 5d8c255..7e9e1af 100644
--- a/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp
+++ b/src/CompilerKit/src/CodeGenerator+AssemblyFactory.cpp
@@ -23,7 +23,15 @@ Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) {
if (!this->fMounted) return NECTAR_UNIMPLEMENTED;
if (arch != this->fMounted->Arch()) return NECTAR_INVALID_ARCH;
- return this->fMounted->CompileToFormat(sourceFile, arch);
+ if (!std::filesystem::is_regular_file(sourceFile)) return NECTAR_UNIMPLEMENTED;
+
+ auto compiledUnit = sourceFile + ".ignore";
+
+ std::filesystem::copy(sourceFile, compiledUnit);
+ auto ret = this->fMounted->CompileToFormat(compiledUnit, arch);
+ std::filesystem::remove(compiledUnit);
+
+ return ret;
}
///! @brief mount assembly backend.
diff --git a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp
index 3c19522..f016c6e 100644
--- a/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp
+++ b/src/CompilerKit/src/Linkers/DynamicLinker64+MachO.cpp
@@ -364,10 +364,10 @@ NECTAR_MODULE(DynamicLinker64MachO) {
UInt32 dysymtabCmdSize = sizeof(dysymtab_command);
UInt32 linkeditCmdSize = sizeof(segment_command_64); // No sections
UInt32 dylinkerCmdSize =
- (strlen(dylinker_command) + 13 + 1 + 7) & ~7; // "/usr/lib/dyld" + padding to 8-byte align
+ (13 + 1 + 7) & ~7; // "/usr/lib/dyld" + padding to 8-byte align
sizeOfCmds = pageZeroSize + textSegCmdSize + dataSegCmdSize + buildCmdSize + uuidCmdSize +
- symtabCmdSize + dysymtabCmdSize + linkeditCmdSize + dylinkerCmdSize;
+ symtabCmdSize + dysymtabCmdSize + linkeditCmdSize;
if (!kIsDylib) sizeOfCmds += mainCmdSize;
@@ -515,7 +515,7 @@ NECTAR_MODULE(DynamicLinker64MachO) {
output_fc.write(reinterpret_cast<const char*>(&linkeditSegment), sizeof(linkeditSegment));
// Write LC_LOAD_DYLINKER command
- constexpr char* dyldPath = "/usr/lib/dyld";
+ constexpr const char* dyldPath = "/usr/lib/dyld";
std::vector<char> dylinkerCmd(dylinkerCmdSize, 0);
dylinker_command* dylinker = reinterpret_cast<dylinker_command*>(dylinkerCmd.data());
dylinker->cmd = LC_LOAD_DYLINKER;