[PATCH] D56758: [WebAssembly] Store section alignment as a power of 2

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 16:27:30 PST 2019


sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.

This change bumps for version number of the wasm object file
metadata.

See https://github.com/WebAssembly/tool-conventions/pull/92


Repository:
  rL LLVM

https://reviews.llvm.org/D56758

Files:
  include/llvm/BinaryFormat/Wasm.h
  lib/MC/WasmObjectWriter.cpp
  test/MC/WebAssembly/array-fill.ll


Index: test/MC/WebAssembly/array-fill.ll
===================================================================
--- test/MC/WebAssembly/array-fill.ll
+++ 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: lib/MC/WasmObjectWriter.cpp
===================================================================
--- lib/MC/WasmObjectWriter.cpp
+++ 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: include/llvm/BinaryFormat/Wasm.h
===================================================================
--- include/llvm/BinaryFormat/Wasm.h
+++ 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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56758.181924.patch
Type: text/x-patch
Size: 1450 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190116/7b5cd4b9/attachment.bin>


More information about the llvm-commits mailing list