Index: llvm/trunk/include/llvm/BinaryFormat/Wasm.h =================================================================== --- llvm/trunk/include/llvm/BinaryFormat/Wasm.h +++ llvm/trunk/include/llvm/BinaryFormat/Wasm.h @@ -26,7 +26,7 @@ // Wasm binary format version const uint32_t WasmVersion = 0x1; // Wasm linking metadata version -const uint32_t WasmMetadataVersion = 0x1; +const uint32_t WasmMetadataVersion = 0x2; // Wasm uses a 64k page size const uint32_t WasmPageSize = 65536; Index: llvm/trunk/lib/MC/WasmObjectWriter.cpp =================================================================== --- llvm/trunk/lib/MC/WasmObjectWriter.cpp +++ llvm/trunk/lib/MC/WasmObjectWriter.cpp @@ -1256,7 +1256,7 @@ Segment.Offset = DataSize; Segment.Section = &Section; addData(Segment.Data, Section); - Segment.Alignment = Section.getAlignment(); + Segment.Alignment = Log2_32(Section.getAlignment()); Segment.Flags = 0; DataSize += Segment.Data.size(); Section.setSegmentIndex(SegmentIndex); Index: llvm/trunk/test/MC/WebAssembly/array-fill.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/array-fill.ll +++ llvm/trunk/test/MC/WebAssembly/array-fill.ll @@ -22,6 +22,6 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: ... Index: llvm/trunk/test/MC/WebAssembly/assembler-binary.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/assembler-binary.ll +++ llvm/trunk/test/MC/WebAssembly/assembler-binary.ll @@ -77,7 +77,7 @@ ; CHECK-NEXT: Body: 1080808080000B ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: FUNCTION Index: llvm/trunk/test/MC/WebAssembly/bss.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/bss.ll +++ llvm/trunk/test/MC/WebAssembly/bss.ll @@ -64,18 +64,18 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .bss.g0 -; CHECK-NEXT: Alignment: 4 +; CHECK-NEXT: Alignment: 2 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: .bss.g1 -; CHECK-NEXT: Alignment: 4 +; CHECK-NEXT: Alignment: 2 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Name: .bss.foo -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: Name: .bss.bar -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: ... Index: llvm/trunk/test/MC/WebAssembly/comdat.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/comdat.ll +++ llvm/trunk/test/MC/WebAssembly/comdat.ll @@ -75,7 +75,7 @@ ; CHECK-NEXT: Content: '616263' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: FUNCTION @@ -106,7 +106,7 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .rodata.constantData -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: Comdats: ; CHECK-NEXT: Name: basicInlineFn Index: llvm/trunk/test/MC/WebAssembly/event-section.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/event-section.ll +++ llvm/trunk/test/MC/WebAssembly/event-section.ll @@ -44,7 +44,7 @@ ; CHECK: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK: - Index: 1 Index: llvm/trunk/test/MC/WebAssembly/explicit-sections.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/explicit-sections.ll +++ llvm/trunk/test/MC/WebAssembly/explicit-sections.ll @@ -60,14 +60,14 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data.global0 -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: .sec1 -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Name: .sec2 -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: ... Index: llvm/trunk/test/MC/WebAssembly/function-sections.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/function-sections.ll +++ llvm/trunk/test/MC/WebAssembly/function-sections.ll @@ -14,7 +14,7 @@ ; CHECK: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: FUNCTION Index: llvm/trunk/test/MC/WebAssembly/global-ctor-dtor.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/global-ctor-dtor.ll +++ llvm/trunk/test/MC/WebAssembly/global-ctor-dtor.ll @@ -110,7 +110,7 @@ ; CHECK-NEXT: Content: '01040000' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: FUNCTION @@ -170,7 +170,7 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data.global1 -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: InitFunctions: ; CHECK-NEXT: - Priority: 42 Index: llvm/trunk/test/MC/WebAssembly/unnamed-data.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/unnamed-data.ll +++ llvm/trunk/test/MC/WebAssembly/unnamed-data.ll @@ -44,7 +44,7 @@ ; CHECK-NEXT: Content: '06000000' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: DATA @@ -73,18 +73,18 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .rodata..L.str1 -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: .rodata..L.str2 -; CHECK-NEXT: Alignment: 1 +; CHECK-NEXT: Alignment: 0 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Name: .data.a -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 3 ; CHECK-NEXT: Name: .data.b -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK_NEXT: ... Index: llvm/trunk/test/MC/WebAssembly/weak-alias.ll =================================================================== --- llvm/trunk/test/MC/WebAssembly/weak-alias.ll +++ llvm/trunk/test/MC/WebAssembly/weak-alias.ll @@ -138,7 +138,7 @@ ; CHECK-NEXT: Content: '01000000' ; CHECK-NEXT: - Type: CUSTOM ; CHECK-NEXT: Name: linking -; CHECK-NEXT: Version: 1 +; CHECK-NEXT: Version: 2 ; CHECK-NEXT: SymbolTable: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Kind: FUNCTION @@ -197,15 +197,15 @@ ; CHECK-NEXT: SegmentInfo: ; CHECK-NEXT: - Index: 0 ; CHECK-NEXT: Name: .data.bar -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 1 ; CHECK-NEXT: Name: .data.direct_address -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: - Index: 2 ; CHECK-NEXT: Name: .data.alias_address -; CHECK-NEXT: Alignment: 8 +; CHECK-NEXT: Alignment: 3 ; CHECK-NEXT: Flags: [ ] ; CHECK-NEXT: ... Index: llvm/trunk/test/Object/obj2yaml.test =================================================================== --- llvm/trunk/test/Object/obj2yaml.test +++ llvm/trunk/test/Object/obj2yaml.test @@ -651,7 +651,7 @@ WASM-NEXT: Version: 0x00000001 WASM: - Type: CUSTOM WASM-NEXT: Name: linking -WASM-NEXT: Version: 1 +WASM-NEXT: Version: 2 WASM-NEXT: SymbolTable: WASM-NEXT: - Index: 0 WASM-NEXT: Kind: FUNCTION @@ -675,7 +675,7 @@ WASM: SegmentInfo: WASM-NEXT: - Index: 0 WASM-NEXT: Name: .rodata..L.str -WASM-NEXT: Alignment: 1 +WASM-NEXT: Alignment: 0 WASM-NEXT: Flags: [ ] WASM-NEXT: - Index: 1 WASM: ... Index: llvm/trunk/test/Object/wasm-bad-metadata-version.yaml =================================================================== --- llvm/trunk/test/Object/wasm-bad-metadata-version.yaml +++ llvm/trunk/test/Object/wasm-bad-metadata-version.yaml @@ -8,4 +8,4 @@ Name: linking Version: 0 -# CHECK: {{.*}}: Unexpected metadata version: 0 (Expected: 1) +# CHECK: {{.*}}: Unexpected metadata version: 0 (Expected: 2) Index: llvm/trunk/test/ObjectYAML/wasm/code_section.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/code_section.yaml +++ llvm/trunk/test/ObjectYAML/wasm/code_section.yaml @@ -39,7 +39,7 @@ Body: 108180808000210020000F0B - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Index: llvm/trunk/test/ObjectYAML/wasm/data_section.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/data_section.yaml +++ llvm/trunk/test/ObjectYAML/wasm/data_section.yaml @@ -24,7 +24,7 @@ Addend: -6 - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: DATA Index: llvm/trunk/test/ObjectYAML/wasm/event_section.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/event_section.yaml +++ llvm/trunk/test/ObjectYAML/wasm/event_section.yaml @@ -32,7 +32,7 @@ Body: 200008808080800041000B - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION @@ -78,7 +78,7 @@ # CHECK-NEXT: Body: 200008808080800041000B # CHECK-NEXT: - Type: CUSTOM # CHECK-NEXT: Name: linking -# CHECK-NEXT: Version: 1 +# CHECK-NEXT: Version: 2 # CHECK-NEXT: SymbolTable: # CHECK-NEXT: - Index: 0 # CHECK-NEXT: Kind: FUNCTION Index: llvm/trunk/test/ObjectYAML/wasm/invalid_global_weak.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/invalid_global_weak.yaml +++ llvm/trunk/test/ObjectYAML/wasm/invalid_global_weak.yaml @@ -13,7 +13,7 @@ GlobalMutable: false - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: GLOBAL Index: llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml +++ llvm/trunk/test/ObjectYAML/wasm/linking_section.yaml @@ -29,7 +29,7 @@ Content: '11110000' - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Index: llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml =================================================================== --- llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml +++ llvm/trunk/test/ObjectYAML/wasm/weak_symbols.yaml @@ -36,7 +36,7 @@ Body: 00 - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Index: llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml =================================================================== --- llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml +++ llvm/trunk/test/tools/llvm-nm/wasm/exports.yaml @@ -37,7 +37,7 @@ Content: '616263' - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Index: llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml =================================================================== --- llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml +++ llvm/trunk/test/tools/llvm-nm/wasm/imports.yaml @@ -25,7 +25,7 @@ GlobalMutable: false - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: FUNCTION Index: llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml =================================================================== --- llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml +++ llvm/trunk/test/tools/llvm-nm/wasm/weak-symbols.yaml @@ -43,7 +43,7 @@ Content: '616263' - Type: CUSTOM Name: linking - Version: 1 + Version: 2 SymbolTable: - Index: 0 Kind: DATA