diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-22 10:34:40 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-04-22 10:34:40 +0200 |
| commit | 209abc044af82897acce2ede571934af0d77b257 (patch) | |
| tree | 0734be5a848ab99b55b63904b25a16e84ed3d5e0 /Sources | |
| parent | 0027f3523f4b12e73f79b49bb7380eb0092d6b86 (diff) | |
MHR-4: Merging with unstable.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Sources')
| -rw-r--r-- | Sources/64asm.cc | 2 | ||||
| -rw-r--r-- | Sources/i64asm.cc | 15 | ||||
| -rw-r--r-- | Sources/ppcasm.cc | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/Sources/64asm.cc b/Sources/64asm.cc index 0c3f9a7..566dfd8 100644 --- a/Sources/64asm.cc +++ b/Sources/64asm.cc @@ -144,7 +144,7 @@ MPCC_MODULE(NewOSAssembler64000) { } } - object_output += kObjectFileExt; + object_output += kOutputAsBinary ? kBinaryFileExt : kObjectFileExt; std::ifstream file_ptr(argv[i]); std::ofstream file_ptr_out(object_output, std::ofstream::binary); diff --git a/Sources/i64asm.cc b/Sources/i64asm.cc index d19c515..634c070 100644 --- a/Sources/i64asm.cc +++ b/Sources/i64asm.cc @@ -24,6 +24,7 @@ #define __ASM_NEED_AMD64__ 1 +#define kAssemblerPragmaSymStr "#" #define kAssemblerPragmaSym '#' #include <Headers/AsmKit/CPU/amd64.hpp> @@ -192,7 +193,7 @@ MPCC_MODULE(NewOSAssemblerAMD64) { } } - object_output += kObjectFileExt; + object_output += kOutputAsBinary ? kBinaryFileExt : kObjectFileExt; std::ifstream file_ptr(argv[i]); std::ofstream file_ptr_out(object_output, std::ofstream::binary); @@ -520,8 +521,9 @@ std::string CompilerKit::EncoderAMD64::CheckLine(std::string &line, std::string err_str; if (line.empty() || ParserKit::find_word(line, "import") || - ParserKit::find_word(line, "export") || ParserKit::find_word(line, "#") || - ParserKit::find_word(line, ";")) { + ParserKit::find_word(line, "export") || ParserKit::find_word(line, kAssemblerPragmaSymStr) || + ParserKit::find_word(line, ";") || + line[0] == kAssemblerPragmaSym) { if (line.find(';') != std::string::npos) { line.erase(line.find(';')); } else { @@ -577,6 +579,13 @@ std::string CompilerKit::EncoderAMD64::CheckLine(std::string &line, } } } + for (auto &opcodeAMD64 : kOpcodesAMD64) { + if (ParserKit::find_word(line, opcodeAMD64.fName)) { + return err_str; + } + } + + err_str += "\nUnrecognized instruction -> " + line; return err_str; } diff --git a/Sources/ppcasm.cc b/Sources/ppcasm.cc index 90e0429..f95020e 100644 --- a/Sources/ppcasm.cc +++ b/Sources/ppcasm.cc @@ -150,7 +150,7 @@ MPCC_MODULE(NewOSAssemblerPowerPC) { } } - object_output += kObjectFileExt; + object_output += kOutputAsBinary ? kBinaryFileExt : kObjectFileExt; std::ifstream file_ptr(argv[i]); std::ofstream file_ptr_out(object_output, std::ofstream::binary); |
