Skip to content

Commit 0272532

Browse files
authored
Workaround parsing GNU system headers with GCC 11.0 version. (mono#1737)
Closes mono#1703. Upstream bugs: llvm/llvm-project#51607 llvm/llvm-project#53152
1 parent dc743a2 commit 0272532

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Parser/ParserOptions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,11 @@ public void SetupLinux(string headersPath = "")
240240
GetUnixCompilerInfo(headersPath, out var compiler, out var longVersion, out var shortVersion);
241241

242242
AddSystemIncludeDirs(BuiltinsDir);
243-
AddArguments($"-fgnuc-version={longVersion}");
244243

245244
var majorVersion = shortVersion.Split('.')[0];
245+
// Workaround https://github.com/llvm/llvm-project/issues/53152, remove once bug is fixed.
246+
AddArguments(int.Parse(majorVersion) >= 11 ? $"-fgnuc-version=10.1" : $"-fgnuc-version={longVersion}");
247+
246248
string[] versions = { longVersion, shortVersion, majorVersion };
247249
string[] triples = { "x86_64-linux-gnu", "x86_64-pc-linux-gnu" };
248250
if (compiler == "gcc")

0 commit comments

Comments
 (0)