diff options
| author | Dan Gohman <dan433584@gmail.com> | 2017-12-06 20:56:40 +0000 |
|---|---|---|
| committer | Dan Gohman <dan433584@gmail.com> | 2017-12-06 20:56:40 +0000 |
| commit | ad19047d833f0e7179580c0f9f20f88edfdc9045 (patch) | |
| tree | 03402a7328d159ef8fefe02c45b521310dc73fb1 /llvm/lib/MC/WasmObjectWriter.cpp | |
| parent | 4432231b136545b8374d5a06eb90c123dbe193b8 (diff) | |
| download | bcm5719-llvm-ad19047d833f0e7179580c0f9f20f88edfdc9045.tar.gz bcm5719-llvm-ad19047d833f0e7179580c0f9f20f88edfdc9045.zip | |
[WebAssembly] Remove WASM_STACK_POINTER.
WASM_STACK_POINTER and the .stack_pointer directive are no longer needed
now that the stack pointer global is an import.
llvm-svn: 319956
Diffstat (limited to 'llvm/lib/MC/WasmObjectWriter.cpp')
| -rw-r--r-- | llvm/lib/MC/WasmObjectWriter.cpp | 39 |
1 files changed, 4 insertions, 35 deletions
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp index 0e93eb835c0..351927d628a 100644 --- a/llvm/lib/MC/WasmObjectWriter.cpp +++ b/llvm/lib/MC/WasmObjectWriter.cpp @@ -287,8 +287,7 @@ private: void writeDataRelocSection(); void writeLinkingMetaDataSection( ArrayRef<WasmDataSegment> Segments, uint32_t DataSize, - SmallVector<std::pair<StringRef, uint32_t>, 4> SymbolFlags, - Optional<uint32_t> StackPointerGlobal); + SmallVector<std::pair<StringRef, uint32_t>, 4> SymbolFlags); uint32_t getProvisionalValue(const WasmRelocationEntry &RelEntry); void applyRelocations(ArrayRef<WasmRelocationEntry> Relocations, @@ -929,18 +928,11 @@ void WasmObjectWriter::writeDataRelocSection() { void WasmObjectWriter::writeLinkingMetaDataSection( ArrayRef<WasmDataSegment> Segments, uint32_t DataSize, - SmallVector<std::pair<StringRef, uint32_t>, 4> SymbolFlags, - Optional<uint32_t> StackPointerGlobal) { + SmallVector<std::pair<StringRef, uint32_t>, 4> SymbolFlags) { SectionBookkeeping Section; startSection(Section, wasm::WASM_SEC_CUSTOM, "linking"); SectionBookkeeping SubSection; - if (StackPointerGlobal.hasValue()) { - startSection(SubSection, wasm::WASM_STACK_POINTER); - encodeULEB128(StackPointerGlobal.getValue(), getStream()); // id - endSection(SubSection); - } - if (SymbolFlags.size() != 0) { startSection(SubSection, wasm::WASM_SYMBOL_INFO); encodeULEB128(SymbolFlags.size(), getStream()); @@ -1011,8 +1003,6 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm, SmallPtrSet<const MCSymbolWasm *, 4> IsAddressTaken; unsigned NumFuncImports = 0; SmallVector<WasmDataSegment, 4> DataSegments; - Optional<StringRef> StackPointerGlobalName; - Optional<uint32_t> StackPointerGlobal; uint32_t DataSize = 0; // Populate the IsAddressTaken set. @@ -1095,23 +1085,6 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm, } } - // In the special .stack_pointer section, we've encoded the stack pointer - // index. - MCSectionWasm *StackPtr = - Ctx.getWasmSection(".stack_pointer", SectionKind::getMetadata()); - if (!StackPtr->getFragmentList().empty()) { - if (StackPtr->getFragmentList().size() != 1) - report_fatal_error("only one .stack_pointer fragment supported"); - const MCFragment &Frag = *StackPtr->begin(); - if (Frag.hasInstructions() || Frag.getKind() != MCFragment::FT_Data) - report_fatal_error("only data supported in .stack_pointer"); - const auto &DataFrag = cast<MCDataFragment>(Frag); - if (!DataFrag.getFixups().empty()) - report_fatal_error("fixups not supported in .stack_pointer"); - const SmallVectorImpl<char> &Contents = DataFrag.getContents(); - StackPointerGlobalName = StringRef(Contents.data(), Contents.size()); - } - // Populate FunctionTypeIndices and Imports. for (const MCSymbol &S : Asm.symbols()) { const auto &WS = static_cast<const MCSymbolWasm &>(S); @@ -1144,11 +1117,8 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm, // If this global is the stack pointer, make it mutable and remember it // so that we can emit metadata for it. - if (StackPointerGlobalName.hasValue() && - WS.getName() == StackPointerGlobalName.getValue()) { + if (WS.getName() == "__stack_pointer") Import.IsMutable = true; - StackPointerGlobal = NumGlobalImports; - } ++NumGlobalImports; } @@ -1338,8 +1308,7 @@ void WasmObjectWriter::writeObject(MCAssembler &Asm, writeNameSection(Functions, Imports, NumFuncImports); writeCodeRelocSection(); writeDataRelocSection(); - writeLinkingMetaDataSection(DataSegments, DataSize, SymbolFlags, - StackPointerGlobal); + writeLinkingMetaDataSection(DataSegments, DataSize, SymbolFlags); // TODO: Translate the .comment section to the output. // TODO: Translate debug sections to the output. |

