llvm.org GIT mirror llvm / 43abb77
[WebAssembly] Support multilibs for wasm32 and add a wasm OS that uses it This adds support for multilib paths for wasm32 targets, following [Debian's Multiarch conventions], and also adds an experimental OS name in order to test it. [Debian's Multiarch conventions]: https://wiki.debian.org/Multiarch/ Differential Revision: https://reviews.llvm.org/D56553 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351163 91177308-0d34-0410-b5e6-96231b3b80d8 Dan Gohman 1 year, 9 months ago
3 changed file(s) with 27 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
186186 AMDPAL, // AMD PAL Runtime
187187 HermitCore, // HermitCore Unikernel/Multikernel
188188 Hurd, // GNU/Hurd
189 LastOSType = Hurd
189 COWS, // Capability-Oriented WebAssembly Syscalls
190 LastOSType = COWS
190191 };
191192 enum EnvironmentType {
192193 UnknownEnvironment,
587588 return getOS() == Triple::Hurd;
588589 }
589590
591 /// Tests whether the OS is COWS.
592 bool isOSCOWS() const {
593 return getOS() == Triple::COWS;
594 }
595
590596 /// Tests whether the OS uses glibc.
591597 bool isOSGlibc() const {
592598 return (getOS() == Triple::Linux || getOS() == Triple::KFreeBSD ||
210210 case AMDPAL: return "amdpal";
211211 case HermitCore: return "hermit";
212212 case Hurd: return "hurd";
213 case COWS: return "cows";
213214 }
214215
215216 llvm_unreachable("Invalid OSType");
509510 .StartsWith("amdpal", Triple::AMDPAL)
510511 .StartsWith("hermit", Triple::HermitCore)
511512 .StartsWith("hurd", Triple::Hurd)
513 .StartsWith("cows", Triple::COWS)
512514 .Default(Triple::UnknownOS);
513515 }
514516
252252 EXPECT_EQ(Triple::UnknownOS, T.getOS());
253253 EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
254254
255 T = Triple("wasm32-unknown-cows-musl");
256 EXPECT_EQ(Triple::wasm32, T.getArch());
257 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
258 EXPECT_EQ(Triple::COWS, T.getOS());
259 EXPECT_EQ(Triple::Musl, T.getEnvironment());
260
255261 T = Triple("wasm64-unknown-unknown");
256262 EXPECT_EQ(Triple::wasm64, T.getArch());
257263 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
258264 EXPECT_EQ(Triple::UnknownOS, T.getOS());
259265 EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
266
267 T = Triple("wasm64-unknown-cows-musl");
268 EXPECT_EQ(Triple::wasm64, T.getArch());
269 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
270 EXPECT_EQ(Triple::COWS, T.getOS());
271 EXPECT_EQ(Triple::Musl, T.getEnvironment());
260272
261273 T = Triple("avr-unknown-unknown");
262274 EXPECT_EQ(Triple::avr, T.getArch());
12341246
12351247 EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-unknown").getObjectFormat());
12361248 EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-unknown").getObjectFormat());
1249 EXPECT_EQ(Triple::Wasm, Triple("wasm32-unknown-cows-musl").getObjectFormat());
1250 EXPECT_EQ(Triple::Wasm, Triple("wasm64-unknown-cows-musl").getObjectFormat());
12371251
12381252 EXPECT_EQ(Triple::Wasm,
12391253 Triple("wasm32-unknown-unknown-wasm").getObjectFormat());
12401254 EXPECT_EQ(Triple::Wasm,
12411255 Triple("wasm64-unknown-unknown-wasm").getObjectFormat());
1256 EXPECT_EQ(Triple::Wasm,
1257 Triple("wasm32-unknown-cows-musl-wasm").getObjectFormat());
1258 EXPECT_EQ(Triple::Wasm,
1259 Triple("wasm64-unknown-cows-musl-wasm").getObjectFormat());
12421260
12431261 Triple MSVCNormalized(Triple::normalize("i686-pc-windows-msvc-elf"));
12441262 EXPECT_EQ(Triple::ELF, MSVCNormalized.getObjectFormat());