diff --git a/RedPandaIDE/compiler/filecompiler.cpp b/RedPandaIDE/compiler/filecompiler.cpp index 5c3a9618..6a208731 100644 --- a/RedPandaIDE/compiler/filecompiler.cpp +++ b/RedPandaIDE/compiler/filecompiler.cpp @@ -18,6 +18,7 @@ #include "utils.h" #include "../mainwindow.h" #include "compilermanager.h" +#include "qsynedit/syntaxer/asm.h" #include #include @@ -126,6 +127,39 @@ bool FileCompiler::prepareForCompile() if (!mOnlyCheckSyntax) mArguments += getLibraryArguments(fileType); + if (fileType==FileType::GAS) { + bool hasStart=false; + QStringList lines=readFileToLines(mFilename); + QSynedit::ASMSyntaxer syntaxer; + syntaxer.resetState(); + QString lastToken; + QString token; + QSynedit::PTokenAttribute attr; + for (int i=0;itokenType() != QSynedit::TokenType::Space + && attr->tokenType()!=QSynedit::TokenType::String + && attr->tokenType()!=QSynedit::TokenType::Character) + lastToken=token; + syntaxer.next(); + } + if (hasStart) + break; + } + if (hasStart) { + mArguments+=" -nostdlib"; + } + } + if (!fileExists(mCompiler)) { throw CompileError( tr("The Compiler '%1' doesn't exists!").arg(mCompiler)