diff options
author | Sam Clegg <sbc@chromium.org> | 2017-10-20 21:28:38 +0000 |
---|---|---|
committer | Sam Clegg <sbc@chromium.org> | 2017-10-20 21:28:38 +0000 |
commit | 12fd3da9d166b0fc1148f014318218e0542a75b6 (patch) | |
tree | d3cedea2e69faf3432d10457e3ea724661b91fba /llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | |
parent | c420b61b2650c935220b5cd6a7e000b198263774 (diff) | |
download | llvm-12fd3da9d166b0fc1148f014318218e0542a75b6.zip llvm-12fd3da9d166b0fc1148f014318218e0542a75b6.tar.gz llvm-12fd3da9d166b0fc1148f014318218e0542a75b6.tar.bz2 |
[WebAssembly] MC: Fix crash when -g specified.
At this point we don't output any debug sections or thier
relocations.
Differential Revision: https://reviews.llvm.org/D39076
llvm-svn: 316240
Diffstat (limited to 'llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp')
-rw-r--r-- | llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp index f1fbc7f..e45cdee4 100644 --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -168,8 +168,7 @@ const MCExpr *TargetLoweringObjectFileELF::getTTypeGlobalReference( MMI, Streamer); } -static SectionKind -getELFKindForNamedSection(StringRef Name, SectionKind K) { +static SectionKind getELFKindForNamedSection(StringRef Name, SectionKind K) { // N.B.: The defaults used in here are no the same ones used in MC. // We follow gcc, MC follows gas. For example, given ".section .eh_frame", // both gas and MC will produce a section with no flags. Given @@ -1249,7 +1248,7 @@ static const Comdat *getWasmComdat(const GlobalValue *GV) { MCSection *TargetLoweringObjectFileWasm::getExplicitSectionGlobal( const GlobalObject *GO, SectionKind Kind, const TargetMachine &TM) const { StringRef Name = GO->getSection(); - return getContext().getWasmSection(Name, wasm::WASM_SEC_DATA); + return getContext().getWasmSection(Name, SectionKind::getData()); } static MCSectionWasm *selectWasmSectionForGlobal( @@ -1262,12 +1261,10 @@ 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) { @@ -1279,7 +1276,7 @@ static MCSectionWasm *selectWasmSectionForGlobal( UniqueID = *NextUniqueID; (*NextUniqueID)++; } - return Ctx.getWasmSection(Name, Type, Group, UniqueID); + return Ctx.getWasmSection(Name, Kind, Group, UniqueID); } MCSection *TargetLoweringObjectFileWasm::SelectSectionForGlobal( @@ -1330,7 +1327,7 @@ const MCExpr *TargetLoweringObjectFileWasm::lowerRelativeReference( void TargetLoweringObjectFileWasm::InitializeWasm() { StaticCtorSection = - getContext().getWasmSection(".init_array", wasm::WASM_SEC_DATA); + getContext().getWasmSection(".init_array", SectionKind::getData()); StaticDtorSection = - getContext().getWasmSection(".fini_array", wasm::WASM_SEC_DATA); + getContext().getWasmSection(".fini_array", SectionKind::getData()); } |