diff options
author | Sam Clegg <sbc@chromium.org> | 2017-11-14 00:49:16 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2017-11-14 00:49:16 +0000 |
commit | 999660761e45f0c17693c5a756af69a4eb0b0b71 (patch) | |
tree | af450981313ff5ce61b88226b2ff1de9105f643f /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | e41151965f04bf631923343566a91c4904f100a6 (diff) | |
download | bcm5719-llvm-999660761e45f0c17693c5a756af69a4eb0b0b71.tar.gz bcm5719-llvm-999660761e45f0c17693c5a756af69a4eb0b0b71.zip |
[WebAssembly] Explicily disable comdat support for wasm output
For now at least. We clearly need some kind of comdat or
linkonce_odr support for wasm but currently COMDAT is not
supported.
Disable COMDAT support in the same way we do the Mach-O. This
also causes clang not to generated COMDATs.
Differential Revision: https://reviews.llvm.org/D39873
llvm-svn: 318123
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index e45cdee4368..f23e41b8bb4 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1233,21 +1233,21 @@ void TargetLoweringObjectFileCOFF::emitLinkerFlagsForGlobal( // Wasm //===----------------------------------------------------------------------===// -static const Comdat *getWasmComdat(const GlobalValue *GV) { +static void checkWasmComdat(const GlobalValue *GV) { const Comdat *C = GV->getComdat(); if (!C) - return nullptr; - - if (C->getSelectionKind() != Comdat::Any) - report_fatal_error("Wasm COMDATs only support SelectionKind::Any, '" + - C->getName() + "' cannot be lowered."); + return; - return C; + // TODO(sbc): At some point we may need COMDAT support but currently + // they are not supported. + report_fatal_error("WebAssembly doesn't support COMDATs, '" + C->getName() + + "' cannot be lowered."); } MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal( const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { StringRef Name = GO->getSection(); + checkWasmComdat(GO); return getContext().getWasmSection(Name, SectionKind::getData()); } @@ -1255,8 +1255,7 @@ static MCSectionWasm *selectWasmSectionForGlobal( MCContext &Ctx, const GlobalObject *GO, SectionKind Kind, Mangler &Mang, const TargetMachine &TM, bool EmitUniqueSection, unsigned *NextUniqueID) { StringRef Group = ""; - if (getWasmComdat(GO)) - llvm_unreachable("comdat not yet supported for wasm"); + checkWasmComdat(GO); bool UniqueSectionNames = TM.getUniqueSectionNames(); SmallString<128> Name = getSectionPrefixForGlobal(Kind); |