Index: include/llvm/BinaryFormat/Wasm.h =================================================================== --- include/llvm/BinaryFormat/Wasm.h +++ include/llvm/BinaryFormat/Wasm.h @@ -123,7 +123,6 @@ }; struct WasmLinkingData { - uint32_t DataSize; std::vector InitFunctions; }; @@ -191,7 +190,6 @@ // Linking metadata kinds. enum : unsigned { WASM_SYMBOL_INFO = 0x2, - WASM_DATA_SIZE = 0x3, WASM_SEGMENT_INFO = 0x5, WASM_INIT_FUNCS = 0x6, }; Index: include/llvm/ObjectYAML/WasmYAML.h =================================================================== --- include/llvm/ObjectYAML/WasmYAML.h +++ include/llvm/ObjectYAML/WasmYAML.h @@ -175,7 +175,6 @@ return C && C->Name == "linking"; } - uint32_t DataSize; std::vector SymbolInfos; std::vector SegmentInfos; std::vector InitFunctions; Index: lib/MC/WasmObjectWriter.cpp =================================================================== --- lib/MC/WasmObjectWriter.cpp +++ lib/MC/WasmObjectWriter.cpp @@ -283,7 +283,7 @@ void writeCodeRelocSection(); void writeDataRelocSection(); void writeLinkingMetaDataSection( - ArrayRef Segments, uint32_t DataSize, + ArrayRef Segments, const SmallVector, 4> &SymbolFlags, const SmallVector, 2> &InitFuncs); @@ -909,7 +909,7 @@ } void WasmObjectWriter::writeLinkingMetaDataSection( - ArrayRef Segments, uint32_t DataSize, + ArrayRef Segments, const SmallVector, 4> &SymbolFlags, const SmallVector, 2> &InitFuncs) { SectionBookkeeping Section; @@ -926,12 +926,6 @@ endSection(SubSection); } - if (DataSize > 0) { - startSection(SubSection, wasm::WASM_DATA_SIZE); - encodeULEB128(DataSize, getStream()); - endSection(SubSection); - } - if (Segments.size()) { startSection(SubSection, wasm::WASM_SEGMENT_INFO); encodeULEB128(Segments.size(), getStream()); @@ -1378,8 +1372,7 @@ writeNameSection(Functions, Imports, NumFuncImports); writeCodeRelocSection(); writeDataRelocSection(); - writeLinkingMetaDataSection(DataSegments, DataSize, SymbolFlags, - InitFuncs); + writeLinkingMetaDataSection(DataSegments, SymbolFlags, InitFuncs); // TODO: Translate the .comment section to the output. // TODO: Translate debug sections to the output. Index: lib/Object/WasmObjectFile.cpp =================================================================== --- lib/Object/WasmObjectFile.cpp +++ lib/Object/WasmObjectFile.cpp @@ -195,8 +195,6 @@ WasmObjectFile::WasmObjectFile(MemoryBufferRef Buffer, Error &Err) : ObjectFile(Binary::ID_Wasm, Buffer) { - LinkingData.DataSize = 0; - ErrorAsOutParameter ErrAsOutParam(&Err); Header.Magic = getData().substr(0, 4); if (Header.Magic != StringRef("\0asm", 4)) { @@ -383,9 +381,6 @@ } break; } - case wasm::WASM_DATA_SIZE: - LinkingData.DataSize = readVaruint32(Ptr); - break; case wasm::WASM_SEGMENT_INFO: { uint32_t Count = readVaruint32(Ptr); if (Count > DataSegments.size()) Index: lib/ObjectYAML/WasmYAML.cpp =================================================================== --- lib/ObjectYAML/WasmYAML.cpp +++ lib/ObjectYAML/WasmYAML.cpp @@ -57,7 +57,6 @@ static void sectionMapping(IO &IO, WasmYAML::LinkingSection &Section) { commonSectionMapping(IO, Section); IO.mapRequired("Name", Section.Name); - IO.mapRequired("DataSize", Section.DataSize); IO.mapOptional("SymbolInfo", Section.SymbolInfos); IO.mapOptional("SegmentInfo", Section.SegmentInfos); IO.mapOptional("InitFunctions", Section.InitFunctions); Index: test/MC/WebAssembly/array-fill.ll =================================================================== --- test/MC/WebAssembly/array-fill.ll +++ test/MC/WebAssembly/array-fill.ll @@ -14,7 +14,6 @@ ; CHECK: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 2 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: gBd ; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ] Index: test/MC/WebAssembly/bss.ll =================================================================== --- test/MC/WebAssembly/bss.ll +++ test/MC/WebAssembly/bss.ll @@ -71,7 +71,6 @@ ; CHECK-NEXT: Content: '00' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 10 ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .bss.g0 Index: test/MC/WebAssembly/explicit-sections.ll =================================================================== --- test/MC/WebAssembly/explicit-sections.ll +++ test/MC/WebAssembly/explicit-sections.ll @@ -66,7 +66,6 @@ ; CHECK: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 28 ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data.global0 Index: test/MC/WebAssembly/init-fini-array.ll =================================================================== --- test/MC/WebAssembly/init-fini-array.ll +++ test/MC/WebAssembly/init-fini-array.ll @@ -149,7 +149,6 @@ ; CHECK-NEXT: Name: .Lregister_call_dtors ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 4 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: __dso_handle ; CHECK-NEXT: Flags: [ BINDING_WEAK, VISIBILITY_HIDDEN ] Index: test/MC/WebAssembly/unnamed-data.ll =================================================================== --- test/MC/WebAssembly/unnamed-data.ll +++ test/MC/WebAssembly/unnamed-data.ll @@ -78,7 +78,6 @@ ; CHECK-NEXT: Content: '06000000' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 28 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: .L.str1 ; CHECK-NEXT: Flags: [ BINDING_LOCAL ] Index: test/MC/WebAssembly/visibility.ll =================================================================== --- test/MC/WebAssembly/visibility.ll +++ test/MC/WebAssembly/visibility.ll @@ -16,7 +16,6 @@ ; CHECK: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 0 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: hiddenVis ; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ] Index: test/MC/WebAssembly/weak-alias.ll =================================================================== --- test/MC/WebAssembly/weak-alias.ll +++ test/MC/WebAssembly/weak-alias.ll @@ -106,7 +106,6 @@ ; CHECK-NEXT: Name: foo ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 12 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: call_alias ; CHECK-NEXT: Flags: [ VISIBILITY_HIDDEN ] Index: test/MC/WebAssembly/weak.ll =================================================================== --- test/MC/WebAssembly/weak.ll +++ test/MC/WebAssembly/weak.ll @@ -30,7 +30,6 @@ ; CHECK-NEXT: Name: weak_function ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: DataSize: 0 ; CHECK-NEXT: SymbolInfo: ; CHECK-NEXT: - Name: weak_external_data ; CHECK-NEXT: Flags: [ BINDING_WEAK ] Index: tools/llvm-readobj/WasmDumper.cpp =================================================================== --- tools/llvm-readobj/WasmDumper.cpp +++ tools/llvm-readobj/WasmDumper.cpp @@ -155,7 +155,11 @@ W.printString("Name", WasmSec.Name); if (WasmSec.Name == "linking") { const wasm::WasmLinkingData &LinkingData = Obj->linkingData(); - W.printNumber("DataSize", LinkingData.DataSize); + if (!LinkingData.InitFunctions.empty()) { + ListScope Group(W, "InitFunctions"); + for (const wasm::WasmInitFunc &F: LinkingData.InitFunctions) + outs() << " " << F.FunctionIndex << " [" << F.Priority << "]\n"; + } } break; case wasm::WASM_SEC_DATA: { Index: tools/obj2yaml/wasm2yaml.cpp =================================================================== --- tools/obj2yaml/wasm2yaml.cpp +++ tools/obj2yaml/wasm2yaml.cpp @@ -84,7 +84,6 @@ LinkingSec->SymbolInfos.emplace_back(Info); } } - LinkingSec->DataSize = Obj.linkingData().DataSize; for (const wasm::WasmInitFunc &Func : Obj.linkingData().InitFunctions) { WasmYAML::InitFunction F{Func.Priority, Func.FunctionIndex}; LinkingSec->InitFunctions.emplace_back(F); Index: tools/yaml2obj/yaml2wasm.cpp =================================================================== --- tools/yaml2obj/yaml2wasm.cpp +++ tools/yaml2obj/yaml2wasm.cpp @@ -133,11 +133,6 @@ SubSectionWriter SubSection(OS); - // DATA_SIZE subsection - encodeULEB128(wasm::WASM_DATA_SIZE, OS); - encodeULEB128(Section.DataSize, SubSection.GetStream()); - SubSection.Done(); - // SYMBOL_INFO subsection if (Section.SymbolInfos.size()) { encodeULEB128(wasm::WASM_SYMBOL_INFO, OS);