Skip to content

Commit 3a78dfe

Browse files
committed
Support --sysroot= for ${arch}-windows-msvc targets
I think it is possible to use the same rule for msvc targets with --target= and --sysroot= See Repository: https://github.com/trcrsired/windows-msvc-sysroot Add sysroot support for msvc MSVC.cpp needs getDriver before using D add stl in parser for -stdlib= Add Vcruntime to runtime list and unwind list MSVC add default runtime lib type and default unwind lib type add a msvc sysroot test use %S instead of /foo Fix test for msvc-sysroot Also add a pesudo implementation for WebAssembly and maybe Microsoft STL could be ported to more targets in the future Fix the toggle of wasm that prevents -stdlib=stl passed into
1 parent 038bc1c commit 3a78dfe

File tree

8 files changed

+345
-69
lines changed

8 files changed

+345
-69
lines changed

clang/include/clang/Driver/ToolChain.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,18 +95,21 @@ class ToolChain {
9595

9696
enum CXXStdlibType {
9797
CST_Libcxx,
98-
CST_Libstdcxx
98+
CST_Libstdcxx,
99+
CST_Stl,
99100
};
100101

101102
enum RuntimeLibType {
102103
RLT_CompilerRT,
103-
RLT_Libgcc
104+
RLT_Libgcc,
105+
RLT_Vcruntime
104106
};
105107

106108
enum UnwindLibType {
107109
UNW_None,
108110
UNW_CompilerRT,
109-
UNW_Libgcc
111+
UNW_Libgcc,
112+
UNW_Vcruntime
110113
};
111114

112115
enum class UnwindTableLevel {

clang/lib/Driver/ToolChain.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,8 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
10911091
runtimeLibType = ToolChain::RLT_CompilerRT;
10921092
else if (LibName == "libgcc")
10931093
runtimeLibType = ToolChain::RLT_Libgcc;
1094+
else if (LibName == "vcruntime")
1095+
runtimeLibType = ToolChain::RLT_Vcruntime;
10941096
else if (LibName == "platform")
10951097
runtimeLibType = GetDefaultRuntimeLibType();
10961098
else {
@@ -1129,6 +1131,8 @@ ToolChain::UnwindLibType ToolChain::GetUnwindLibType(
11291131
unwindLibType = ToolChain::UNW_CompilerRT;
11301132
} else if (LibName == "libgcc")
11311133
unwindLibType = ToolChain::UNW_Libgcc;
1134+
else if (LibName == "vcruntime")
1135+
unwindLibType = ToolChain::UNW_Vcruntime;
11321136
else {
11331137
if (A)
11341138
getDriver().Diag(diag::err_drv_invalid_unwindlib_name)
@@ -1152,6 +1156,8 @@ ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
11521156
cxxStdlibType = ToolChain::CST_Libcxx;
11531157
else if (LibName == "libstdc++")
11541158
cxxStdlibType = ToolChain::CST_Libstdcxx;
1159+
else if (LibName == "stl")
1160+
cxxStdlibType = ToolChain::CST_Stl;
11551161
else if (LibName == "platform")
11561162
cxxStdlibType = GetDefaultCXXStdlibType();
11571163
else {
@@ -1290,6 +1296,9 @@ void ToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
12901296
case ToolChain::CST_Libstdcxx:
12911297
CmdArgs.push_back("-lstdc++");
12921298
break;
1299+
1300+
default:
1301+
break;
12931302
}
12941303
}
12951304

0 commit comments

Comments
 (0)