[llvm] 4841577 - Revert "[Object][WebAssembly] Fix data segment offsets higher than 2^31 (#125739)" (#125786)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 4 16:16:20 PST 2025
Author: Sam Clegg
Date: 2025-02-04T16:16:17-08:00
New Revision: 48415777ea6a0367800b3b37493263ff613f57f6
URL: https://github.com/llvm/llvm-project/commit/48415777ea6a0367800b3b37493263ff613f57f6
DIFF: https://github.com/llvm/llvm-project/commit/48415777ea6a0367800b3b37493263ff613f57f6.diff
LOG: Revert "[Object][WebAssembly] Fix data segment offsets higher than 2^31 (#125739)" (#125786)
This reverts commit c798a5c4d5c3c8cb21e6001f505d8f44217c2244.
This broke bunch of test the emscripten side. Reverting while we
investigate.
Added:
Modified:
llvm/include/llvm/BinaryFormat/Wasm.h
llvm/lib/Object/WasmObjectFile.cpp
llvm/test/ObjectYAML/wasm/global_section.yaml
Removed:
llvm/test/Object/Wasm/data-offsets.yaml
llvm/test/ObjectYAML/wasm/invalidate_data_offset.yaml
################################################################################
diff --git a/llvm/include/llvm/BinaryFormat/Wasm.h b/llvm/include/llvm/BinaryFormat/Wasm.h
index 30271be232ca77..ede2d692a59491 100644
--- a/llvm/include/llvm/BinaryFormat/Wasm.h
+++ b/llvm/include/llvm/BinaryFormat/Wasm.h
@@ -333,8 +333,8 @@ struct WasmTable {
struct WasmInitExprMVP {
uint8_t Opcode;
union {
- uint32_t Int32;
- uint64_t Int64;
+ int32_t Int32;
+ int64_t Int64;
uint32_t Float32;
uint64_t Float64;
uint32_t Global;
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 7815c267022319..0f6fd5612f9d82 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/lib/Object/WasmObjectFile.cpp
@@ -201,10 +201,10 @@ static Error readInitExpr(wasm::WasmInitExpr &Expr,
Expr.Inst.Opcode = readOpcode(Ctx);
switch (Expr.Inst.Opcode) {
case wasm::WASM_OPCODE_I32_CONST:
- Expr.Inst.Value.Int32 = readVaruint32(Ctx);
+ Expr.Inst.Value.Int32 = readVarint32(Ctx);
break;
case wasm::WASM_OPCODE_I64_CONST:
- Expr.Inst.Value.Int64 = readVaruint64(Ctx);
+ Expr.Inst.Value.Int64 = readVarint64(Ctx);
break;
case wasm::WASM_OPCODE_F32_CONST:
Expr.Inst.Value.Float32 = readFloat32(Ctx);
diff --git a/llvm/test/Object/Wasm/data-offsets.yaml b/llvm/test/Object/Wasm/data-offsets.yaml
deleted file mode 100644
index b2e1d00675233e..00000000000000
--- a/llvm/test/Object/Wasm/data-offsets.yaml
+++ /dev/null
@@ -1,22 +0,0 @@
-# RUN: yaml2obj %s | llvm-objdump -s -
-
-## Tests data offsets above 2**31 for I32_CONST and offset over 2**32 work for I64_CONST
-
---- !WASM
-FileHeader:
- Version: 0x00000001
-Sections:
- - Type: DATA
- Segments:
- - SectionOffset: 0
- InitFlags: 0
- Offset:
- Opcode: I32_CONST
- Value: 2147483649
- Content: '6401020304'
- - SectionOffset: 0
- InitFlags: 0
- Offset:
- Opcode: I64_CONST
- Value: 4294967297
- Content: '6401020304'
diff --git a/llvm/test/ObjectYAML/wasm/global_section.yaml b/llvm/test/ObjectYAML/wasm/global_section.yaml
index 20f4d5440990fe..e330b072a726ef 100644
--- a/llvm/test/ObjectYAML/wasm/global_section.yaml
+++ b/llvm/test/ObjectYAML/wasm/global_section.yaml
@@ -10,7 +10,7 @@ Sections:
Mutable: false
InitExpr:
Opcode: I64_CONST
- Value: 5
+ Value: -5
...
# CHECK: --- !WASM
# CHECK: FileHeader:
@@ -23,5 +23,5 @@ Sections:
# CHECK: Mutable: false
# CHECK: InitExpr:
# CHECK: Opcode: I64_CONST
-# CHECK: Value: 5
+# CHECK: Value: -5
# CHECK: ...
diff --git a/llvm/test/ObjectYAML/wasm/invalidate_data_offset.yaml b/llvm/test/ObjectYAML/wasm/invalidate_data_offset.yaml
deleted file mode 100644
index ac12026379905b..00000000000000
--- a/llvm/test/ObjectYAML/wasm/invalidate_data_offset.yaml
+++ /dev/null
@@ -1,18 +0,0 @@
-# RUN: not yaml2obj %s 2>&1 | FileCheck %s
-
-## Tests data offsets above 2**32 are not valid for for I32_CONST
-
---- !WASM
-FileHeader:
- Version: 0x00000001
-Sections:
- - Type: DATA
- Segments:
- - SectionOffset: 0
- InitFlags: 0
- Offset:
- Opcode: I32_CONST
- Value: 4294967297
- Content: '6401020304'
-
-# CHECK: error: out of range number
More information about the llvm-commits
mailing list