summaryrefslogtreecommitdiffhomepage
path: root/dev/LibCompiler/src/CodeGen.cc
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2025-05-27 23:02:19 +0200
committerAmlal El Mahrouss <amlal@nekernel.org>2025-05-27 23:02:19 +0200
commit7878653e8dbd65d94ea8ea8bae6e0afd3c3d0af3 (patch)
tree5f77d7f9d500efcafdcb4efb787ce71a5d5ec1ab /dev/LibCompiler/src/CodeGen.cc
parentd12204e7302b8f3bd521c782094338733abfded1 (diff)
fix: fix SEGFAULT on CxxDrv (AMD64), caused by a stack corruption.
refactor: Refactor LibCompiler's codebase, deperecate older C compilers, and fully focusing on C++ now. Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'dev/LibCompiler/src/CodeGen.cc')
-rw-r--r--dev/LibCompiler/src/CodeGen.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/dev/LibCompiler/src/CodeGen.cc b/dev/LibCompiler/src/CodeGen.cc
index 31a809b..3f215c5 100644
--- a/dev/LibCompiler/src/CodeGen.cc
+++ b/dev/LibCompiler/src/CodeGen.cc
@@ -24,10 +24,9 @@
namespace LibCompiler {
///! @brief Compile for specific format (ELF, PEF, ZBIN)
Int32 AssemblyFactory::Compile(STLString sourceFile, const Int32& arch) noexcept {
- if (sourceFile.length() < 1 || !fMounted) return LIBCOMPILER_UNIMPLEMENTED;
+ if (sourceFile.length() < 1) return LIBCOMPILER_UNIMPLEMENTED;
if (!fMounted) return LIBCOMPILER_UNIMPLEMENTED;
-
if (arch != fMounted->Arch()) return LIBCOMPILER_INVALID_ARCH;
try {
@@ -48,7 +47,7 @@ void AssemblyFactory::Mount(AssemblyInterface* mountPtr) noexcept {
AssemblyInterface* AssemblyFactory::Unmount() noexcept {
auto mount_prev = fMounted;
- if (mount_prev) {
+ if (fMounted) {
fMounted = nullptr;
}