summaryrefslogtreecommitdiffhomepage
path: root/include/CompilerKit/Utilities
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-16 22:54:33 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-16 22:54:33 +0100
commit112b49ab7d2af6edea6bad97f2eea98e96ed5428 (patch)
tree80e7590c4851efafa6813f6f6adf483b1d5180de /include/CompilerKit/Utilities
parentd4d91d5ffe7b02478a5ed14adcdad931dec95fd1 (diff)
feat: implement Mach-O linker and massive improvements on Assembler and Linkers.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/CompilerKit/Utilities')
-rw-r--r--include/CompilerKit/Utilities/Assembler.h40
1 files changed, 8 insertions, 32 deletions
diff --git a/include/CompilerKit/Utilities/Assembler.h b/include/CompilerKit/Utilities/Assembler.h
index 249d69d..9f81dcf 100644
--- a/include/CompilerKit/Utilities/Assembler.h
+++ b/include/CompilerKit/Utilities/Assembler.h
@@ -28,14 +28,8 @@ inline NumberCast32 GetNumber32(STLString lineBuffer, STLString numberKey) {
switch (lineBuffer[pos + 1]) {
case 'x': {
- if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 16); !res) {
- if (errno != 0) {
- Detail::print_error("invalid hex number: " + lineBuffer, "CompilerKit");
- throw std::runtime_error("invalid_hex");
- }
- }
-
- NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 16));
+ auto res = strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 16);
+ NumberCast32 numOffset(strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 16));
if (kVerbose) {
kStdOut << "asm: found a base 16 number here: " << lineBuffer.substr(pos) << "\n";
@@ -44,14 +38,8 @@ inline NumberCast32 GetNumber32(STLString lineBuffer, STLString numberKey) {
return numOffset;
}
case 'b': {
- if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 2); !res) {
- if (errno != 0) {
- Detail::print_error("invalid binary number:" + lineBuffer, "CompilerKit");
- throw std::runtime_error("invalid_bin");
- }
- }
-
- NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 2));
+ auto res = strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 2);
+ NumberCast32 numOffset(strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 2));
if (kVerbose) {
kStdOut << "asm: found a base 2 number here:" << lineBuffer.substr(pos) << "\n";
@@ -60,14 +48,8 @@ inline NumberCast32 GetNumber32(STLString lineBuffer, STLString numberKey) {
return numOffset;
}
case 'o': {
- if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 7); !res) {
- if (errno != 0) {
- Detail::print_error("invalid octal number: " + lineBuffer, "CompilerKit");
- throw std::runtime_error("invalid_octal");
- }
- }
-
- NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 7));
+ auto res = strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 8);
+ NumberCast32 numOffset(strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 8));
if (kVerbose) {
kStdOut << "asm: found a base 8 number here:" << lineBuffer.substr(pos) << "\n";
@@ -76,14 +58,8 @@ inline NumberCast32 GetNumber32(STLString lineBuffer, STLString numberKey) {
return numOffset;
}
default: {
- if (auto res = strtol(lineBuffer.substr(pos).c_str(), nullptr, 10); !res) {
- if (errno != 0) {
- Detail::print_error("invalid hex number: " + lineBuffer, "CompilerKit");
- throw std::runtime_error("invalid_hex");
- }
- }
-
- NumberCast32 numOffset(strtol(lineBuffer.substr(pos).c_str(), nullptr, 10));
+ auto res = strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 10);
+ NumberCast32 numOffset(strtol(lineBuffer.substr(pos + 2).c_str(), nullptr, 10));
if (kVerbose) {
kStdOut << "asm: found a base 10 number here:" << lineBuffer.substr(pos) << kStdEndl;