Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stack size option for cross toolchain #565

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions RedPandaIDE/compiler/compilerinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,7 @@ void CompilerInfo::prepareCompilerOptions()

// Linker
groupName = QObject::tr("Linker");
#ifdef Q_OS_WIN
addNumberOption(LINK_CMD_OPT_STACK_SIZE, QObject::tr("Stack Size"), groupName, false, false, true, "-Wl,--stack,","MB",1024*1024,12,0,99999);
#endif
addNumberOption(LINK_CMD_OPT_STACK_SIZE, QObject::tr("PE Stack Size"), groupName, false, false, true, "-Wl,--stack,","MB",1024*1024,0,0,99999);

addOption(CC_CMD_OPT_USE_PIPE, QObject::tr("Use pipes instead of temporary files during compilation (-pipe)"), groupName, true, true, false, "-pipe");
//addOption(LINK_CMD_OPT_LINK_OBJC, QObject::tr("Link an Objective C program (-lobjc)"), groupName, false, false, true, "-lobjc");
Expand Down
32 changes: 20 additions & 12 deletions RedPandaIDE/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2314,21 +2314,25 @@ void Settings::CompilerSet::setGCCProperties(const QString& binDir, const QStrin
mVersion = QString(version).trimmed();

// Obtain compiler distro
bool outputFormatIsPe = false;
QByteArray verboseOut = getCompilerOutput(binDir, c_prog, {"-v"});
QByteArray targetStr = "clang version ";
int clangVersionPos = verboseOut.indexOf(targetStr);
if (clangVersionPos >= 0) {
mCompilerType = CompilerType::Clang;
QRegularExpression ntPosixPattern = QRegularExpression("^(.*)-pc-windows-msys$");
QRegularExpression mingwW64Pattern = QRegularExpression("^(.*)-w64-windows-gnu$");
if (mName.isEmpty()) {
if (auto m = ntPosixPattern.match(mDumpMachine); m.hasMatch()) {
if (auto m = ntPosixPattern.match(mDumpMachine); m.hasMatch()) {
outputFormatIsPe = true;
if (mName.isEmpty())
mName = "MSYS2 Clang " + mVersion;
} else if (m = mingwW64Pattern.match(mDumpMachine); m.hasMatch()) {
} else if (m = mingwW64Pattern.match(mDumpMachine); m.hasMatch()) {
outputFormatIsPe = true;
if (mName.isEmpty())
mName = "MinGW-w64 Clang " + mVersion;
} else {
} else {
if (mName.isEmpty())
mName = "Clang " + mVersion;
}
}
} else {
mCompilerType = CompilerType::GCC;
Expand All @@ -2337,24 +2341,28 @@ void Settings::CompilerSet::setGCCProperties(const QString& binDir, const QStrin
QRegularExpression mingwOrgPattern("^(.*)-(.*)-mingw32$");
if (auto m = ntPosixPattern.match(mDumpMachine); m.hasMatch()) {
mCompilerType = CompilerType::GCC_UTF8;
outputFormatIsPe = true;
if (mName.isEmpty()) {
if (m.captured(3) == "msys")
mName = "MSYS2 GCC " + mVersion;
else
mName = "Cygwin GCC " + mVersion;
}
}
// Assemble user friendly name if we don't have one yet
if (mName.isEmpty()) {
if (auto m = mingwW64Pattern.match(mDumpMachine); m.hasMatch()) {
} else if (m = mingwW64Pattern.match(mDumpMachine); m.hasMatch()) {
outputFormatIsPe = true;
if (mName.isEmpty())
mName = "MinGW-w64 GCC " + mVersion;
} else if (m = mingwOrgPattern.match(mDumpMachine); m.hasMatch()) {
} else if (m = mingwOrgPattern.match(mDumpMachine); m.hasMatch()) {
outputFormatIsPe = true;
if (mName.isEmpty())
mName = "MinGW.org GCC " + mVersion;
} else {
} else {
if (mName.isEmpty())
mName = "GCC " + mVersion;
}
}
}
if (outputFormatIsPe)
setCompileOption(LINK_CMD_OPT_STACK_SIZE, "12");

// Set compiler folder
QDir tmpDir(binDir);
Expand Down
2 changes: 1 addition & 1 deletion RedPandaIDE/translations/RedPandaIDE_pt_BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9343,7 +9343,7 @@
</message>
<message>
<location line="+33"/>
<source>Stack Size</source>
<source>PE Stack Size</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
4 changes: 2 additions & 2 deletions RedPandaIDE/translations/RedPandaIDE_ru_RU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8399,8 +8399,8 @@
</message>
<message>
<location filename="../compiler/compilerinfo.cpp" line="229"/>
<source>Stack Size</source>
<translation>Размер стека</translation>
<source>PE Stack Size</source>
<translation>Размер стека PE</translation>
</message>
<message>
<location filename="../compiler/compilerinfo.cpp" line="232"/>
Expand Down
4 changes: 2 additions & 2 deletions RedPandaIDE/translations/RedPandaIDE_zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9541,8 +9541,8 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+26"/>
<source>Stack Size</source>
<translation>栈空间大小</translation>
<source>PE Stack Size</source>
<translation>PE 栈空间大小</translation>
</message>
<message>
<location line="+225"/>
Expand Down
2 changes: 1 addition & 1 deletion RedPandaIDE/translations/RedPandaIDE_zh_TW.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8699,7 +8699,7 @@
</message>
<message>
<location line="+33"/>
<source>Stack Size</source>
<source>PE Stack Size</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
Loading