diff options
author | Sam Clegg <sbc@chromium.org> | 2017-09-15 20:54:59 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2017-09-15 20:54:59 +0000 |
commit | 759631c77bb8f7a8b76e1c1a7cd78532a5d809d2 (patch) | |
tree | 3fde45dce4c989ba99c9976a82bb5d420daa1c8e /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | dee018c51f377f46b8b2fb8507f19c51e3747fcc (diff) | |
download | bcm5719-llvm-759631c77bb8f7a8b76e1c1a7cd78532a5d809d2.tar.gz bcm5719-llvm-759631c77bb8f7a8b76e1c1a7cd78532a5d809d2.zip |
[WebAssembly] MC: Create wasm data segments based on MCSections
This means that we can honor -fdata-sections rather than
always creating a segment for each symbol.
It also allows for a followup change to add .init_array and friends.
Differential Revision: https://reviews.llvm.org/D37876
llvm-svn: 313395
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index fcb20184116..0149c82a00e 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -1248,8 +1248,8 @@ static const Comdat *getWasmComdat(const GlobalValue *GV) { MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal( const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { - llvm_unreachable("getExplicitSectionGlobal not yet implemented"); - return nullptr; + StringRef Name = GO->getSection(); + return getContext().getWasmSection(Name, wasm::WASM_SEC_DATA); } static MCSectionWasm *selectWasmSectionForGlobal( @@ -1262,10 +1262,12 @@ static MCSectionWasm *selectWasmSectionForGlobal( bool UniqueSectionNames = TM.getUniqueSectionNames(); SmallString<128> Name = getSectionPrefixForGlobal(Kind); + uint32_t Type = wasm::WASM_SEC_DATA; if (const auto *F = dyn_cast<Function>(GO)) { const auto &OptionalPrefix = F->getSectionPrefix(); if (OptionalPrefix) Name += *OptionalPrefix; + Type = wasm::WASM_SEC_CODE; } if (EmitUniqueSection && UniqueSectionNames) { @@ -1277,7 +1279,7 @@ static MCSectionWasm *selectWasmSectionForGlobal( UniqueID = *NextUniqueID; (*NextUniqueID)++; } - return Ctx.getWasmSection(Name, /*Type=*/0, Group, UniqueID); + return Ctx.getWasmSection(Name, Type, Group, UniqueID); } MCSection *TargetLoweringObjectFileWasm::SelectSectionForGlobal( |