diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-08 14:49:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-08 14:49:09 +0100 |
| commit | 741a874e823e9a2ac55aba0efe85d3b581009826 (patch) | |
| tree | 4319da905a1cb8ad700e1550a86becc6d99b2b85 | |
| parent | 1dce8ad72f9cc534e300c94cb5a63619d19ad12b (diff) | |
| parent | 5fbec948d16f63c5847e8e27b4fafc9c081c76fd (diff) | |
Merge pull request #66 from ne-foss-org/edge-case-asm64-patches
Edge case asm64 patches
| l--------- | AUTHORS | 1 | ||||
| -rw-r--r-- | MailMap | 3 | ||||
| -rw-r--r-- | conanfile.txt | 7 | ||||
| -rw-r--r-- | src/CompilerKit/src/Assemblers/Assembler+AMD64.cpp | 18 |
4 files changed, 21 insertions, 8 deletions
@@ -0,0 +1 @@ +MailMap
\ No newline at end of file @@ -1 +1,4 @@ @amlel-el-mahrouss - amlal@nekernel.org +@2Los +@0xf00sec + diff --git a/conanfile.txt b/conanfile.txt new file mode 100644 index 0000000..e0de5ca --- /dev/null +++ b/conanfile.txt @@ -0,0 +1,7 @@ +[requires] +boost/1.90.0 +[generators] +CMakeDeps +CMakeToolchain +[layout] +cmake_layout diff --git a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cpp b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cpp index 536ac27..6ee1313 100644 --- a/src/CompilerKit/src/Assemblers/Assembler+AMD64.cpp +++ b/src/CompilerKit/src/Assemblers/Assembler+AMD64.cpp @@ -306,14 +306,14 @@ NECTAR_MODULE(AssemblerMainAMD64) { file_ptr_out.flush(); file_ptr_out.close(); - if (kVerbose) kStdOut << "AssemblerAMD64: Exit succeeded.\n"; + if (kVerbose) kStdOut << "AssemblerAMD64: Exiting: Succeeded.\n"; return 0; } asm_fail_exit: - if (kVerbose) kStdOut << "AssemblerAMD64: Exit failed.\n"; + if (kVerbose) kStdOut << "AssemblerAMD64: Exiting: Failed.\n"; return 1; } @@ -325,7 +325,7 @@ asm_fail_exit: ///////////////////////////////////////////////////////////////////////////////////////// -static bool asm_read_attributes(std::string line) { +static bool asm_read_attributes(CompilerKit::STLString line) { // extern_segment is the opposite of public_segment, it signals to the ld // that we need this symbol. if (CompilerKit::ast_find_needle(line, "extern_segment")) { @@ -624,8 +624,8 @@ bool CompilerKit::EncoderAMD64::WriteNumber(const std::size_t& pos, std::string& CompilerKit::NumberCast64 num = CompilerKit::NumberCast64(res); - for (char& i : num.number) { - kAppBytes.push_back(i); + for (auto& nidx : num.number) { + kAppBytes.push_back(nidx); } if (kVerbose) { @@ -952,9 +952,9 @@ bool CompilerKit::EncoderAMD64::WriteLine(CompilerKit::STLString line, CompilerK std::string memOperand = substr.substr(bracketStart + 1, bracketEnd - bracketStart - 1); // Register lookup table - struct RegInfo { - const char* name; - i64_byte_t code; + struct RegInfo final { + const char* name{}; + i64_byte_t code{}; }; RegInfo regs64[] = {{"rax", 0}, {"rcx", 1}, {"rdx", 2}, {"rbx", 3}, @@ -1003,6 +1003,7 @@ bool CompilerKit::EncoderAMD64::WriteLine(CompilerKit::STLString line, CompilerK // Find register in the other operand std::string otherOperand; + if (destIsMemory) { otherOperand = substr.substr(commaPos + 1); } else { @@ -1031,6 +1032,7 @@ bool CompilerKit::EncoderAMD64::WriteLine(CompilerKit::STLString line, CompilerK if (!foundReg) { // Check if it's an immediate value std::string immStr = otherOperand; + while (!immStr.empty() && (immStr[0] == ' ' || immStr[0] == '\t')) { immStr.erase(0, 1); } |
