diff options
| -rw-r--r-- | CITATION.cff | 3 | ||||
| -rw-r--r-- | docs/md/SPECIFICATION_COMPILERKIT.md | 23 | ||||
| -rw-r--r-- | docs/specs/GENERAL_SPECIFICATION.md | 47 | ||||
| -rw-r--r-- | docs/svg/.keep | 0 | ||||
| -rw-r--r-- | examples/.keep (renamed from docs/mermaid/.keep) | 0 | ||||
| -rw-r--r-- | examples/asm/exit_nekernel_abi.asm (renamed from samples/asm/exit_nekernel_abi.asm) | 0 | ||||
| -rw-r--r-- | examples/asm/return_5_rax.asm (renamed from samples/asm/return_5_rax.asm) | 0 | ||||
| -rw-r--r-- | examples/cxx/example.cc (renamed from samples/cxx/example.cc) | 0 | ||||
| -rw-r--r-- | man/cxxdrv.1 | 34 | ||||
| -rw-r--r-- | man/ld64.1 | 34 | ||||
| -rw-r--r-- | public/.keep | 0 | ||||
| -rw-r--r-- | samples/.keep | 0 | ||||
| -rw-r--r-- | src/LibC++/.gitignore | 2 | ||||
| -rwxr-xr-x | src/LibC++/make-stdcpp-hdrs.sh (renamed from src/LibC++/make_hdrs.sh) | 2 | ||||
| -rw-r--r-- | src/Tools/asm.cc (renamed from tools/asm.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/asm.json (renamed from tools/asm.json) | 2 | ||||
| -rw-r--r-- | src/Tools/cppdrv.cc (renamed from tools/cppdrv.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/cppdrv.json (renamed from tools/cppdrv.json) | 2 | ||||
| -rw-r--r-- | src/Tools/dbg.cc (renamed from tools/dbg.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/dbg.json (renamed from tools/dbg.json) | 2 | ||||
| -rw-r--r-- | src/Tools/kdbg.cc (renamed from tools/kdbg.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/kdbg.json (renamed from tools/kdbg.json) | 2 | ||||
| -rwxr-xr-x | src/Tools/ld64 | bin | 0 -> 16152 bytes | |||
| -rw-r--r-- | src/Tools/ld64.cc (renamed from tools/ld64.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/ld64.json (renamed from tools/ld64.json) | 2 | ||||
| -rwxr-xr-x | src/Tools/pef-amd64-cxxdrv | bin | 0 -> 17768 bytes | |||
| -rw-r--r-- | src/Tools/pef-amd64-cxxdrv.cc (renamed from tools/pef-amd64-cxxdrv.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/pef-amd64-cxxdrv.json (renamed from tools/pef-amd64-cxxdrv.json) | 6 | ||||
| -rw-r--r-- | src/Tools/pef-arm64-cdrv.cc (renamed from tools/pef-arm64-cdrv.cc) | 0 | ||||
| -rw-r--r-- | src/Tools/pef-arm64-cdrv.json (renamed from tools/pef-arm64-cdrv.json) | 6 | ||||
| -rw-r--r-- | tests/samples/sample.asm | 4 | ||||
| -rw-r--r-- | tests/test_01_codegen/codegen_test.cc | 6 | ||||
| -rw-r--r-- | tests/test_02_linker/linker_test.cc | 12 | ||||
| -rw-r--r-- | vendor/.keep | 0 |
34 files changed, 78 insertions, 111 deletions
diff --git a/CITATION.cff b/CITATION.cff index 65aa5fd..7424d3e 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,6 +1,3 @@ -# This CITATION.cff file was generated with cffinit. -# Visit https://bit.ly/cffinit to generate yours today! - cff-version: 1.2.0 title: NeKernel.org Compiler Toolchain Infrastructure message: The toolchain of NeKernel.org diff --git a/docs/md/SPECIFICATION_COMPILERKIT.md b/docs/md/SPECIFICATION_COMPILERKIT.md deleted file mode 100644 index 681cfde..0000000 --- a/docs/md/SPECIFICATION_COMPILERKIT.md +++ /dev/null @@ -1,23 +0,0 @@ -# Specification of CompilerKit - -=================================== - -# 0: General Information - -=================================== -- Output format: PEF, XCOFF -- Object format: AE, COFF -- SDK Language: C++ - -=================================== - -# 1: CompilerKit - -=================================== - -- Shall support compilation, assembling and linking. -- Shall be written in C++ -- Shall support the assembler too. -- Shall provide primitives for compilers, assemblers and linkers. -- Shall support multiple architectures. -- Shall have a debugger.
\ No newline at end of file diff --git a/docs/specs/GENERAL_SPECIFICATION.md b/docs/specs/GENERAL_SPECIFICATION.md new file mode 100644 index 0000000..19f787f --- /dev/null +++ b/docs/specs/GENERAL_SPECIFICATION.md @@ -0,0 +1,47 @@ +# Specification of CompilerKit + +=================================== + +# 0: General Information + +=================================== + +- Output format: PEF +- Object format: AE +- Used Languages: Assembly, and C++ + +=================================== + +# 1: CompilerKit + +=================================== + +- Shall support compilation, assembling and linking. +- Shall be written in C++ +- Shall support the assembler too. +- Shall provide primitives for compilers, assemblers and linkers. +- Shall support multiple architectures. +- Shall be easy to expand and maintain. + +=================================== + +# 2: LibC++ + +=================================== + +- Shall support C++ runtime and ABI for NeKernel. +- Shall support a basic subset of the C++ library. +- Shall be written in C++ + + +=================================== + +# 3: DebuggerKit + +=================================== + +- Shall be written in C++ +- Shall have a debugger. +- Shall support multiple architectures. +- Shall have a kernel deubgger. +- Shall be easy to expand and maintain.
\ No newline at end of file diff --git a/docs/svg/.keep b/docs/svg/.keep deleted file mode 100644 index e69de29..0000000 --- a/docs/svg/.keep +++ /dev/null diff --git a/docs/mermaid/.keep b/examples/.keep index e69de29..e69de29 100644 --- a/docs/mermaid/.keep +++ b/examples/.keep diff --git a/samples/asm/exit_nekernel_abi.asm b/examples/asm/exit_nekernel_abi.asm index 6f69a00..6f69a00 100644 --- a/samples/asm/exit_nekernel_abi.asm +++ b/examples/asm/exit_nekernel_abi.asm diff --git a/samples/asm/return_5_rax.asm b/examples/asm/return_5_rax.asm index 82c0320..82c0320 100644 --- a/samples/asm/return_5_rax.asm +++ b/examples/asm/return_5_rax.asm diff --git a/samples/cxx/example.cc b/examples/cxx/example.cc index e74acbb..e74acbb 100644 --- a/samples/cxx/example.cc +++ b/examples/cxx/example.cc diff --git a/man/cxxdrv.1 b/man/cxxdrv.1 deleted file mode 100644 index c261492..0000000 --- a/man/cxxdrv.1 +++ /dev/null @@ -1,34 +0,0 @@ -.TH CXXDRV 1 "CompilerKit" "November 2025" "NeKernel Manual" -.SH NAME -.B cxxdrv -\- AE 64-bit C++ compiler for NeKernel - -.SH SYNOPSIS -.B cxxdrv %OPTIONS% %INPUT_FILES% - -.SH DESCRIPTION -.B cxxdrv -is the dedicated compiler used by NeKernel, it compiles to the AE object format. - -.SH OPTIONS -.TP -.B -output <file> -Specify the output file. - -.SH USAGE EXAMPLES -.TP -.B Generate object file from the main.cpp unit. -.B cxxdrv main.cpp - -.SH EXIT STATUS -.TP -0 Successful compilation. -.TP -1 Error encountered during compilation of the C++ unit(s). - -.SH SEE ALSO -.BR cxxdrv (7), asm (7) - -.SH AUTHOR -Amlal El Mahrouss - diff --git a/man/ld64.1 b/man/ld64.1 deleted file mode 100644 index 1e972d7..0000000 --- a/man/ld64.1 +++ /dev/null @@ -1,34 +0,0 @@ -.TH LD64 1 "CompilerKit" "November 2025" "NeKernel Manual" -.SH NAME -.B ld64 -\- PEF 64-bit NeKernel Linker - -.SH SYNOPSIS -.B ld64 %OPTIONS% %INPUT_FILES% -output %OUTPUT_FILE% - -.SH DESCRIPTION -.B ld64 -is the dedicated linker for the Preferred Executable Format (PEF) used by NeKernel. - -.SH OPTIONS -.TP -.B -output <file> -Specify the output file. - -.SH USAGE EXAMPLES -.TP -.B Generate an executable file from an AE object. -.B ld64 main.obj -output main.exec - -.SH EXIT STATUS -.TP -0 Successful linking. -.TP -1 Error encountered during linking. - -.SH SEE ALSO -.BR cxxdrv (7), asm (1) - -.SH AUTHOR -Amlal El Mahrouss - diff --git a/public/.keep b/public/.keep deleted file mode 100644 index e69de29..0000000 --- a/public/.keep +++ /dev/null diff --git a/samples/.keep b/samples/.keep deleted file mode 100644 index e69de29..0000000 --- a/samples/.keep +++ /dev/null diff --git a/src/LibC++/.gitignore b/src/LibC++/.gitignore index 5fa1170..e3f10ea 100644 --- a/src/LibC++/.gitignore +++ b/src/LibC++/.gitignore @@ -1 +1 @@ -stdcxx/ +libc++/ diff --git a/src/LibC++/make_hdrs.sh b/src/LibC++/make-stdcpp-hdrs.sh index 5e8907e..a3730de 100755 --- a/src/LibC++/make_hdrs.sh +++ b/src/LibC++/make-stdcpp-hdrs.sh @@ -1,6 +1,6 @@ #! /bin/sh -outputDir=libCxx/ +outputDir=libc++/ mkdir -p $outputDir diff --git a/tools/asm.cc b/src/Tools/asm.cc index 025b158..025b158 100644 --- a/tools/asm.cc +++ b/src/Tools/asm.cc diff --git a/tools/asm.json b/src/Tools/asm.json index e322800..bfb8ac7 100644 --- a/tools/asm.json +++ b/src/Tools/asm.json @@ -1,7 +1,7 @@ { "compiler_path": "clang++", "compiler_std": "c++20", - "headers_path": ["../src/CompilerKit", "../src/", "../src/CompilerKit/src/Detail"], + "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"], "sources_path": ["asm.cc"], "output_name": "asm", "compiler_flags": ["-L/usr/lib", "-lCompilerKit"], diff --git a/tools/cppdrv.cc b/src/Tools/cppdrv.cc index 2cccf2b..2cccf2b 100644 --- a/tools/cppdrv.cc +++ b/src/Tools/cppdrv.cc diff --git a/tools/cppdrv.json b/src/Tools/cppdrv.json index 6bef999..9eb5e54 100644 --- a/tools/cppdrv.json +++ b/src/Tools/cppdrv.json @@ -1,7 +1,7 @@ { "compiler_path": "clang++", "compiler_std": "c++20", - "headers_path": ["../src/CompilerKit", "../src/", "../src/CompilerKit/src/Detail"], + "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"], "sources_path": ["cppdrv.cc"], "output_name": "cppdrv", "compiler_flags": ["-L/usr/local/lib", "-lCompilerKit"], diff --git a/tools/dbg.cc b/src/Tools/dbg.cc index a54c59e..a54c59e 100644 --- a/tools/dbg.cc +++ b/src/Tools/dbg.cc diff --git a/tools/dbg.json b/src/Tools/dbg.json index 50feaf3..8e786a7 100644 --- a/tools/dbg.json +++ b/src/Tools/dbg.json @@ -1,7 +1,7 @@ { "compiler_path": "clang++", "compiler_std": "c++20", - "headers_path": ["../src/CompilerKit", "../src/", "../src/CompilerKit/src/Detail"], + "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"], "sources_path": ["dbg.cc"], "output_name": "dbg", "compiler_flags": ["-L/usr/lib", "-lDebuggerKit"], diff --git a/tools/kdbg.cc b/src/Tools/kdbg.cc index 4ee508d..4ee508d 100644 --- a/tools/kdbg.cc +++ b/src/Tools/kdbg.cc diff --git a/tools/kdbg.json b/src/Tools/kdbg.json index 6828cef..f661fc5 100644 --- a/tools/kdbg.json +++ b/src/Tools/kdbg.json @@ -1,7 +1,7 @@ { "compiler_path": "clang++", "compiler_std": "c++20", - "headers_path": ["../src/CompilerKit", "../src/", "../src/CompilerKit/src/Detail"], + "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"], "sources_path": ["kdbg.cc"], "output_name": "kdbg", "compiler_flags": ["-L/usr/lib", "-lDebuggerKit"], diff --git a/src/Tools/ld64 b/src/Tools/ld64 Binary files differnew file mode 100755 index 0000000..cd81455 --- /dev/null +++ b/src/Tools/ld64 diff --git a/tools/ld64.cc b/src/Tools/ld64.cc index 1f0392d..1f0392d 100644 --- a/tools/ld64.cc +++ b/src/Tools/ld64.cc diff --git a/tools/ld64.json b/src/Tools/ld64.json index b509926..2045550 100644 --- a/tools/ld64.json +++ b/src/Tools/ld64.json @@ -1,7 +1,7 @@ { "compiler_path": "clang++", "compiler_std": "c++20", - "headers_path": ["../src/CompilerKit", "../src/", "../src/CompilerKit/src/Detail"], + "headers_path": ["../CompilerKit", "../", "../CompilerKit/src/Detail"], "sources_path": ["ld64.cc"], "output_name": "ld64", "compiler_flags": ["-L/usr/lib", "-lCompilerKit"], diff --git a/src/Tools/pef-amd64-cxxdrv b/src/Tools/pef-amd64-cxxdrv Binary files differnew file mode 100755 index 0000000..16189ea --- /dev/null +++ b/src/Tools/pef-amd64-cxxdrv diff --git a/tools/pef-amd64-cxxdrv.cc b/src/Tools/pef-amd64-cxxdrv.cc index 3fc41fe..3fc41fe 100644 --- a/tools/pef-amd64-cxxdrv.cc +++ b/src/Tools/pef-amd64-cxxdrv.cc diff --git a/tools/pef-amd64-cxxdrv.json b/src/Tools/pef-amd64-cxxdrv.json index 9d1f360..62b5b4d 100644 --- a/tools/pef-amd64-cxxdrv.json +++ b/src/Tools/pef-amd64-cxxdrv.json @@ -2,9 +2,9 @@ "compiler_path": "clang++", "compiler_std": "c++20", "headers_path": [ - "../src/CompilerKit", - "../src/", - "../src/CompilerKit/src/Detail" + "../CompilerKit", + "../", + "../CompilerKit/src/Detail" ], "sources_path": [ "pef-amd64-cxxdrv.cc" diff --git a/tools/pef-arm64-cdrv.cc b/src/Tools/pef-arm64-cdrv.cc index 0a4a9af..0a4a9af 100644 --- a/tools/pef-arm64-cdrv.cc +++ b/src/Tools/pef-arm64-cdrv.cc diff --git a/tools/pef-arm64-cdrv.json b/src/Tools/pef-arm64-cdrv.json index f7186e3..be6a1be 100644 --- a/tools/pef-arm64-cdrv.json +++ b/src/Tools/pef-arm64-cdrv.json @@ -2,9 +2,9 @@ "compiler_path": "clang++", "compiler_std": "c++20", "headers_path": [ - "../src/CompilerKit", - "../src/", - "../src/CompilerKit/src/Detail" + "../CompilerKit", + "../", + "../CompilerKit/src/Detail" ], "sources_path": [ "pef-arm64-cdrv.cc" diff --git a/tests/samples/sample.asm b/tests/samples/sample.asm new file mode 100644 index 0000000..82c0320 --- /dev/null +++ b/tests/samples/sample.asm @@ -0,0 +1,4 @@ +public_segment .code64 __ImageStart + ;; rax is the return value register. + mov rax, 5 + ret
\ No newline at end of file diff --git a/tests/test_01_codegen/codegen_test.cc b/tests/test_01_codegen/codegen_test.cc index 89afd8d..6cbea22 100644 --- a/tests/test_01_codegen/codegen_test.cc +++ b/tests/test_01_codegen/codegen_test.cc @@ -10,5 +10,9 @@ #include <gtest/gtest.h> TEST(CodegenTest, BasicCodegenTest) { - + /// compile asm + { + auto expr = std::system("asm sample/sample.asm"); + EXPECT_TRUE(expr == 0) << "ASM Driver did not compile the easy ASM unit."; + } } diff --git a/tests/test_02_linker/linker_test.cc b/tests/test_02_linker/linker_test.cc index cc580a3..a6b0387 100644 --- a/tests/test_02_linker/linker_test.cc +++ b/tests/test_02_linker/linker_test.cc @@ -9,14 +9,20 @@ #include <gtest/gtest.h> +/// c++ TEST(LinkerTest, BasicLinkTest) { - /// @note this is the driver, it will look for a .cc.pp (.pp stands for pre-processed) auto expr = std::system("pef-amd64-cxxdrv sample/sample.cc"); EXPECT_TRUE(expr == 0) << "C++ Driver did not compile the easy C++ unit."; +} - expr = std::system("asm -asm:x64 sample/sample.cc.pp.masm"); +/// assemble +TEST(LinkerTest, BasicLinkTest2) { + auto expr = std::system("asm -asm:x64 sample/sample.cc.pp.masm"); EXPECT_TRUE(expr == 0) << "Assembler did not assemble the easy asm unit."; +} - expr = std::system("ld64 -amd64 sample/sample.cc.pp.obj -start __NECTI_main -output main.exec"); +/// link +TEST(LinkerTest, BasicLinkTest3) { + auto expr = std::system("ld64 -amd64 sample/sample.cc.pp.obj -start __NECTI_main -output main.exec"); EXPECT_TRUE(expr == 0) << "Linker did not link the easy object."; } diff --git a/vendor/.keep b/vendor/.keep deleted file mode 100644 index e69de29..0000000 --- a/vendor/.keep +++ /dev/null |
