[PATCH] D26701: [WebAssembly] Add triple support for the new wasm object format
Dan Gohman via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 15 14:29:58 PST 2016
sunfish created this revision.
sunfish added reviewers: jyknight, t.p.northover, theraven.
sunfish added subscribers: dschuff, jgravelle-google, sbc100, llvm-commits, lgerbarg.
sunfish set the repository for this revision to rL LLVM.
Herald added a subscriber: jfb.
The WebAssembly target is transitioning from ELF to a new binary object file format, for example in https://reviews.llvm.org/D26172 and so on. The patch here adds Triple support for this new format, in preparation for adding MC support.
Repository:
rL LLVM
https://reviews.llvm.org/D26701
Files:
include/llvm/ADT/Triple.h
lib/ProfileData/InstrProf.cpp
lib/Support/Triple.cpp
lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -1578,7 +1578,8 @@
GlobalValue *InstrumentedGlobal = NewGlobal;
bool CanUsePrivateAliases =
- TargetTriple.isOSBinFormatELF() || TargetTriple.isOSBinFormatMachO();
+ TargetTriple.isOSBinFormatELF() || TargetTriple.isOSBinFormatMachO() ||
+ TargetTriple.isOSBinFormatWasm();
if (CanUsePrivateAliases && ClUsePrivateAliasForGlobals) {
// Create local alias for NewGlobal to avoid crash on ODR between
// instrumented and non-instrumented libraries.
Index: lib/ProfileData/InstrProf.cpp
===================================================================
--- lib/ProfileData/InstrProf.cpp
+++ lib/ProfileData/InstrProf.cpp
@@ -791,7 +791,7 @@
return true;
Triple TT(M.getTargetTriple());
- if (!TT.isOSBinFormatELF())
+ if (!TT.isOSBinFormatELF() && !TT.isOSBinFormatWasm())
return false;
// See createPGOFuncNameVar for more details. To avoid link errors, profile
Index: lib/Support/Triple.cpp
===================================================================
--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -507,6 +507,7 @@
.EndsWith("coff", Triple::COFF)
.EndsWith("elf", Triple::ELF)
.EndsWith("macho", Triple::MachO)
+ .EndsWith("wasm", Triple::Wasm)
.Default(Triple::UnknownObjectFormat);
}
@@ -578,6 +579,7 @@
case Triple::COFF: return "coff";
case Triple::ELF: return "elf";
case Triple::MachO: return "macho";
+ case Triple::Wasm: return "wasm";
}
llvm_unreachable("unknown object format type");
}
@@ -633,11 +635,13 @@
case Triple::systemz:
case Triple::tce:
case Triple::thumbeb:
- case Triple::wasm32:
- case Triple::wasm64:
case Triple::xcore:
return Triple::ELF;
+ case Triple::wasm32:
+ case Triple::wasm64:
+ return Triple::Wasm;
+
case Triple::ppc:
case Triple::ppc64:
if (T.isOSDarwin())
Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -205,6 +205,7 @@
COFF,
ELF,
MachO,
+ Wasm,
};
private:
@@ -575,6 +576,11 @@
return getObjectFormat() == Triple::MachO;
}
+ /// Tests whether the OS uses the Wasm binary format.
+ bool isOSBinFormatWasm() const {
+ return getObjectFormat() == Triple::Wasm;
+ }
+
/// Tests whether the target is the PS4 CPU
bool isPS4CPU() const {
return getArch() == Triple::x86_64 &&
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26701.78076.patch
Type: text/x-patch
Size: 2693 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/23b012a5/attachment.bin>
More information about the llvm-commits
mailing list