Merge branch 'master' of github.com:royqh1979/RedPanda-CPP
This commit is contained in:
commit
5cc52ea9f9
|
@ -18,6 +18,7 @@
|
|||
#include "utils.h"
|
||||
#include "../mainwindow.h"
|
||||
#include "compilermanager.h"
|
||||
#include "qsynedit/syntaxer/asm.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
|
@ -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;i<lines.count();i++) {
|
||||
QString line=lines[i];
|
||||
syntaxer.setLine(line,i+1);
|
||||
lastToken="";
|
||||
while(!syntaxer.eol()) {
|
||||
token=syntaxer.getToken();
|
||||
if (token==":" && lastToken=="_start") {
|
||||
hasStart=true;
|
||||
break;
|
||||
}
|
||||
attr = syntaxer.getTokenAttribute();
|
||||
if (attr->tokenType() != 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)
|
||||
|
|
|
@ -298,12 +298,8 @@ void ProjectCompiler::writeMakeDefines(QFile &file)
|
|||
}
|
||||
#elif defined(Q_OS_LINUX)
|
||||
asmFlags = "-f elf64";
|
||||
if (mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON)
|
||||
asmFlags += " -g ";
|
||||
#elif defined(Q_OS_MACOS)
|
||||
asmFlags = "-f macho64";
|
||||
if (mProject->getCompileOption(CC_CMD_OPT_DEBUG_INFO) == COMPILER_OPTION_ON)
|
||||
asmFlags += " -g ";
|
||||
#endif
|
||||
writeln(file,"ASMFLAGS = " + asmFlags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue