Skip to content

Conversation

@daxpedda
Copy link

@daxpedda daxpedda commented Dec 19, 2025

The additional parameter was unnecessary when the information is already readily available in the WasmTableType.

Fixes: #172868

@github-actions
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2025

@llvm/pr-subscribers-lld-wasm
@llvm/pr-subscribers-lld

@llvm/pr-subscribers-llvm-mc

Author: None (daxpedda)

Changes

The additional parameter was unnecessary when the information is already readily available in the WasmTableType.

Fixes #172868.

Pinging @sbc100 as the target maintainer.


Full diff: https://github.com/llvm/llvm-project/pull/172992.diff

2 Files Affected:

  • (modified) lld/test/wasm/import-table-explicit.s (+18)
  • (modified) llvm/lib/MC/WasmObjectWriter.cpp (+7-6)
diff --git a/lld/test/wasm/import-table-explicit.s b/lld/test/wasm/import-table-explicit.s
index 701b7a1dc3e16..34dfea4466ebd 100644
--- a/lld/test/wasm/import-table-explicit.s
+++ b/lld/test/wasm/import-table-explicit.s
@@ -5,11 +5,18 @@
 .globl __indirect_function_table
 .tabletype __indirect_function_table, funcref
 
+.globl __table_with_limits
+.import_module __table_with_limits, env
+.import_name __table_with_limits, __table_with_limits
+.tabletype __table_with_limits, funcref, 2, 10
+
 .globl _start
 _start:
   .functype _start () -> ()
   i32.const 1
   call_indirect __indirect_function_table, () -> ()
+  i32.const 1
+  call_indirect __table_with_limits, () -> ()
   end_function
 
 # Verify the --import-table flag creates a table import
@@ -24,3 +31,14 @@ _start:
 # CHECK-NEXT:          ElemType:        FUNCREF
 # CHECK-NEXT:          Limits:
 # CHECK-NEXT:            Minimum:         0x1
+
+# CHECK:           - Module:          env
+# CHECK-NEXT:        Field:           __table_with_limits
+# CHECK-NEXT:        Kind:            TABLE
+# CHECK-NEXT:        Table:
+# CHECK-NEXT:          Index:           0
+# CHECK-NEXT:          ElemType:        FUNCREF
+# CHECK-NEXT:          Limits:
+# CHECK-NEXT:          Flags:           [ HAS_MAX ]
+# CHECK-NEXT:            Minimum:         0x2
+# CHECK-NEXT:            Maximum:         0xA
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 15590b31fd07f..f0ad3bf97a2b4 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -323,8 +323,8 @@ class WasmObjectWriter : public MCObjectWriter {
   void writeValueType(wasm::ValType Ty) { W->OS << static_cast<char>(Ty); }
 
   void writeTypeSection(ArrayRef<wasm::WasmSignature> Signatures);
-  void writeImportSection(ArrayRef<wasm::WasmImport> Imports, uint64_t DataSize,
-                          uint32_t NumElements);
+  void writeImportSection(ArrayRef<wasm::WasmImport> Imports,
+                          uint64_t DataSize);
   void writeFunctionSection(ArrayRef<WasmFunction> Functions);
   void writeExportSection(ArrayRef<wasm::WasmExport> Exports);
   void writeElemSection(const MCSymbolWasm *IndirectFunctionTable,
@@ -823,8 +823,7 @@ void WasmObjectWriter::writeTypeSection(
 }
 
 void WasmObjectWriter::writeImportSection(ArrayRef<wasm::WasmImport> Imports,
-                                          uint64_t DataSize,
-                                          uint32_t NumElements) {
+                                          uint64_t DataSize) {
   if (Imports.empty())
     return;
 
@@ -855,7 +854,9 @@ void WasmObjectWriter::writeImportSection(ArrayRef<wasm::WasmImport> Imports,
     case wasm::WASM_EXTERNAL_TABLE:
       W->OS << char(Import.Table.ElemType);
       encodeULEB128(Import.Table.Limits.Flags, W->OS);
-      encodeULEB128(NumElements, W->OS); // initial
+      encodeULEB128(Import.Table.Limits.Minimum, W->OS);
+      if (Import.Table.Limits.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
+        encodeULEB128(Import.Table.Limits.Maximum, W->OS);
       break;
     case wasm::WASM_EXTERNAL_TAG:
       W->OS << char(0); // Reserved 'attribute' field
@@ -1901,7 +1902,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
   uint32_t CodeSectionIndex, DataSectionIndex;
   if (Mode != DwoMode::DwoOnly) {
     writeTypeSection(Signatures);
-    writeImportSection(Imports, DataSize, TableElems.size());
+    writeImportSection(Imports, DataSize);
     writeFunctionSection(Functions);
     writeTableSection(Tables);
     // Skip the "memory" section; we import the memory instead.

@llvmbot
Copy link
Member

llvmbot commented Dec 19, 2025

@llvm/pr-subscribers-backend-webassembly

Author: None (daxpedda)

Changes

The additional parameter was unnecessary when the information is already readily available in the WasmTableType.

Fixes #172868.

Pinging @sbc100 as the target maintainer.


Full diff: https://github.com/llvm/llvm-project/pull/172992.diff

2 Files Affected:

  • (modified) lld/test/wasm/import-table-explicit.s (+18)
  • (modified) llvm/lib/MC/WasmObjectWriter.cpp (+7-6)
diff --git a/lld/test/wasm/import-table-explicit.s b/lld/test/wasm/import-table-explicit.s
index 701b7a1dc3e16..34dfea4466ebd 100644
--- a/lld/test/wasm/import-table-explicit.s
+++ b/lld/test/wasm/import-table-explicit.s
@@ -5,11 +5,18 @@
 .globl __indirect_function_table
 .tabletype __indirect_function_table, funcref
 
+.globl __table_with_limits
+.import_module __table_with_limits, env
+.import_name __table_with_limits, __table_with_limits
+.tabletype __table_with_limits, funcref, 2, 10
+
 .globl _start
 _start:
   .functype _start () -> ()
   i32.const 1
   call_indirect __indirect_function_table, () -> ()
+  i32.const 1
+  call_indirect __table_with_limits, () -> ()
   end_function
 
 # Verify the --import-table flag creates a table import
@@ -24,3 +31,14 @@ _start:
 # CHECK-NEXT:          ElemType:        FUNCREF
 # CHECK-NEXT:          Limits:
 # CHECK-NEXT:            Minimum:         0x1
+
+# CHECK:           - Module:          env
+# CHECK-NEXT:        Field:           __table_with_limits
+# CHECK-NEXT:        Kind:            TABLE
+# CHECK-NEXT:        Table:
+# CHECK-NEXT:          Index:           0
+# CHECK-NEXT:          ElemType:        FUNCREF
+# CHECK-NEXT:          Limits:
+# CHECK-NEXT:          Flags:           [ HAS_MAX ]
+# CHECK-NEXT:            Minimum:         0x2
+# CHECK-NEXT:            Maximum:         0xA
diff --git a/llvm/lib/MC/WasmObjectWriter.cpp b/llvm/lib/MC/WasmObjectWriter.cpp
index 15590b31fd07f..f0ad3bf97a2b4 100644
--- a/llvm/lib/MC/WasmObjectWriter.cpp
+++ b/llvm/lib/MC/WasmObjectWriter.cpp
@@ -323,8 +323,8 @@ class WasmObjectWriter : public MCObjectWriter {
   void writeValueType(wasm::ValType Ty) { W->OS << static_cast<char>(Ty); }
 
   void writeTypeSection(ArrayRef<wasm::WasmSignature> Signatures);
-  void writeImportSection(ArrayRef<wasm::WasmImport> Imports, uint64_t DataSize,
-                          uint32_t NumElements);
+  void writeImportSection(ArrayRef<wasm::WasmImport> Imports,
+                          uint64_t DataSize);
   void writeFunctionSection(ArrayRef<WasmFunction> Functions);
   void writeExportSection(ArrayRef<wasm::WasmExport> Exports);
   void writeElemSection(const MCSymbolWasm *IndirectFunctionTable,
@@ -823,8 +823,7 @@ void WasmObjectWriter::writeTypeSection(
 }
 
 void WasmObjectWriter::writeImportSection(ArrayRef<wasm::WasmImport> Imports,
-                                          uint64_t DataSize,
-                                          uint32_t NumElements) {
+                                          uint64_t DataSize) {
   if (Imports.empty())
     return;
 
@@ -855,7 +854,9 @@ void WasmObjectWriter::writeImportSection(ArrayRef<wasm::WasmImport> Imports,
     case wasm::WASM_EXTERNAL_TABLE:
       W->OS << char(Import.Table.ElemType);
       encodeULEB128(Import.Table.Limits.Flags, W->OS);
-      encodeULEB128(NumElements, W->OS); // initial
+      encodeULEB128(Import.Table.Limits.Minimum, W->OS);
+      if (Import.Table.Limits.Flags & wasm::WASM_LIMITS_FLAG_HAS_MAX)
+        encodeULEB128(Import.Table.Limits.Maximum, W->OS);
       break;
     case wasm::WASM_EXTERNAL_TAG:
       W->OS << char(0); // Reserved 'attribute' field
@@ -1901,7 +1902,7 @@ uint64_t WasmObjectWriter::writeOneObject(MCAssembler &Asm,
   uint32_t CodeSectionIndex, DataSectionIndex;
   if (Mode != DwoMode::DwoOnly) {
     writeTypeSection(Signatures);
-    writeImportSection(Imports, DataSize, TableElems.size());
+    writeImportSection(Imports, DataSize);
     writeFunctionSection(Functions);
     writeTableSection(Tables);
     // Skip the "memory" section; we import the memory instead.

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

lgtm % testing comment

@sbc100 sbc100 changed the title [WebAssembly] fix importing tables with limits [MC][WebAssembly] Fix importing tables with limits Dec 19, 2025
@daxpedda daxpedda force-pushed the wasm-import-table-limits branch from a63a97c to 158f4f4 Compare December 19, 2025 19:49
@daxpedda daxpedda requested a review from sbc100 December 20, 2025 20:34
Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks for working on this.

@github-actions
Copy link

🐧 Linux x64 Test Results

  • 167338 tests passed
  • 2968 tests skipped
  • 4 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.MC/WebAssembly/global-ctor-dtor.ll
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mcpu=mvp -filetype=obj /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -mcpu=mvp -filetype=obj /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll -o -
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll:56:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: Minimum: 0x2
# |               ^
# | <stdin>:54:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:55:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/global-ctor-dtor.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           49:  Field: __indirect_function_table 
# |           50:  Kind: TABLE 
# |           51:  Table: 
# |           52:  Index: 0 
# |           53:  ElemType: FUNCREF 
# |           54:  Limits: 
# | next:56'0             X error: no match found
# |           55:  Minimum: 0x0 
# | next:56'0     ~~~~~~~~~~~~~~
# | next:56'1      ?             possible intended match
# |           56:  - Type: FUNCTION 
# | next:56'0     ~~~~~~~~~~~~~~~~~~
# |           57:  FunctionTypes: [ 0, 1, 0, 1 ] 
# | next:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           58:  - Type: ELEM 
# | next:56'0     ~~~~~~~~~~~~~~
# |           59:  Segments: 
# | next:56'0     ~~~~~~~~~~~
# |           60:  - Offset: 
# | next:56'0     ~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/reloc-pic.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
sed -e '/^REF-/d' /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm32-unknown-unknown -filetype=obj | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s
# executed command: sed -e '/^REF-/d' /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm32-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s:94:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:38:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:39:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           33:  Field: __indirect_function_table 
# |           34:  Kind: TABLE 
# |           35:  Table: 
# |           36:  Index: 0 
# |           37:  ElemType: FUNCREF 
# |           38:  Limits: 
# | next:94'0             X error: no match found
# |           39:  Minimum: 0x0 
# | next:94'0     ~~~~~~~~~~~~~~
# | next:94'1      ?             possible intended match
# |           40:  - Module: GOT.mem 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~
# |           41:  Field: default_data 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~~~
# |           42:  Kind: GLOBAL 
# | next:94'0     ~~~~~~~~~~~~~~
# |           43:  GlobalType: I32 
# | next:94'0     ~~~~~~~~~~~~~~~~~
# |           44:  GlobalMutable: true 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/reloc-pic64.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm64-unknown-unknown -filetype=obj < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic64.s | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic64.s
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm64-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic64.s
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic64.s:97:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:44:18: note: scanning from here
# |  Flags: [ IS_64 ]
# |                  ^
# | <stdin>:45:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/reloc-pic64.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           39:  Kind: TABLE 
# |           40:  Table: 
# |           41:  Index: 0 
# |           42:  ElemType: FUNCREF 
# |           43:  Limits: 
# |           44:  Flags: [ IS_64 ] 
# | next:97'0                      X error: no match found
# |           45:  Minimum: 0x0 
# | next:97'0     ~~~~~~~~~~~~~~
# | next:97'1      ?             possible intended match
# |           46:  - Module: GOT.mem 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~
# |           47:  Field: default_data 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~~~
# |           48:  Kind: GLOBAL 
# | next:97'0     ~~~~~~~~~~~~~~
# |           49:  GlobalType: I32 
# | next:97'0     ~~~~~~~~~~~~~~~~~
# |           50:  GlobalMutable: true 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/weak-alias.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/weak-alias.s | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CHECK /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/weak-alias.s
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llvm-mc -triple=wasm32-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/obj2yaml
# note: command had no output on stdout or stderr
# executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck --check-prefix=CHECK /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/weak-alias.s
# .---command stderr------------
# | /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/weak-alias.s:100:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:24:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:25:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/MC/WebAssembly/weak-alias.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            19:  Field: __indirect_function_table 
# |            20:  Kind: TABLE 
# |            21:  Table: 
# |            22:  Index: 0 
# |            23:  ElemType: FUNCREF 
# |            24:  Limits: 
# | next:100'0             X error: no match found
# |            25:  Minimum: 0x0 
# | next:100'0     ~~~~~~~~~~~~~~
# | next:100'1      ?             possible intended match
# |            26:  - Type: FUNCTION 
# | next:100'0     ~~~~~~~~~~~~~~~~~~
# |            27:  FunctionTypes: [ 0, 0, 0, 0, 0 ] 
# | next:100'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            28:  - Type: ELEM 
# | next:100'0     ~~~~~~~~~~~~~~
# |            29:  Segments: 
# | next:100'0     ~~~~~~~~~~~
# |            30:  - Offset: 
# | next:100'0     ~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@github-actions
Copy link

🪟 Windows x64 Test Results

  • 128822 tests passed
  • 2836 tests skipped
  • 4 tests failed

Failed Tests

(click on a test name to see its output)

LLVM

LLVM.MC/WebAssembly/global-ctor-dtor.ll
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llc.exe -mcpu=mvp -filetype=obj C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll -o - | c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llc.exe' -mcpu=mvp -filetype=obj 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll' -o -
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll:56:15: error: CHECK-NEXT: expected string not found in input
# | ; CHECK-NEXT: Minimum: 0x2
# |               ^
# | <stdin>:54:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:55:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\global-ctor-dtor.ll
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           49:  Field: __indirect_function_table 
# |           50:  Kind: TABLE 
# |           51:  Table: 
# |           52:  Index: 0 
# |           53:  ElemType: FUNCREF 
# |           54:  Limits: 
# | next:56'0             X error: no match found
# |           55:  Minimum: 0x0 
# | next:56'0     ~~~~~~~~~~~~~~
# | next:56'1      ?             possible intended match
# |           56:  - Type: FUNCTION 
# | next:56'0     ~~~~~~~~~~~~~~~~~~
# |           57:  FunctionTypes: [ 0, 1, 0, 1 ] 
# | next:56'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |           58:  - Type: ELEM 
# | next:56'0     ~~~~~~~~~~~~~~
# |           59:  Segments: 
# | next:56'0     ~~~~~~~~~~~
# |           60:  - Offset: 
# | next:56'0     ~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/reloc-pic.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
sed -e '/^REF-/d' C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s | c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe -triple=wasm32-unknown-unknown -filetype=obj | c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s
# executed command: sed -e '/^REF-/d' 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe' -triple=wasm32-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s:94:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:38:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:39:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           33:  Field: __indirect_function_table 
# |           34:  Kind: TABLE 
# |           35:  Table: 
# |           36:  Index: 0 
# |           37:  ElemType: FUNCREF 
# |           38:  Limits: 
# | next:94'0             X error: no match found
# |           39:  Minimum: 0x0 
# | next:94'0     ~~~~~~~~~~~~~~
# | next:94'1      ?             possible intended match
# |           40:  - Module: GOT.mem 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~
# |           41:  Field: default_data 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~~~
# |           42:  Kind: GLOBAL 
# | next:94'0     ~~~~~~~~~~~~~~
# |           43:  GlobalType: I32 
# | next:94'0     ~~~~~~~~~~~~~~~~~
# |           44:  GlobalMutable: true 
# | next:94'0     ~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/reloc-pic64.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe -triple=wasm64-unknown-unknown -filetype=obj < C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic64.s | c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic64.s
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe' -triple=wasm64-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic64.s'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic64.s:97:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:44:18: note: scanning from here
# |  Flags: [ IS_64 ]
# |                  ^
# | <stdin>:45:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\reloc-pic64.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           39:  Kind: TABLE 
# |           40:  Table: 
# |           41:  Index: 0 
# |           42:  ElemType: FUNCREF 
# |           43:  Limits: 
# |           44:  Flags: [ IS_64 ] 
# | next:97'0                      X error: no match found
# |           45:  Minimum: 0x0 
# | next:97'0     ~~~~~~~~~~~~~~
# | next:97'1      ?             possible intended match
# |           46:  - Module: GOT.mem 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~
# |           47:  Field: default_data 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~~~
# |           48:  Kind: GLOBAL 
# | next:97'0     ~~~~~~~~~~~~~~
# |           49:  GlobalType: I32 
# | next:97'0     ~~~~~~~~~~~~~~~~~
# |           50:  GlobalMutable: true 
# | next:97'0     ~~~~~~~~~~~~~~~~~~~~~
# |            .
# |            .
# |            .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

LLVM.MC/WebAssembly/weak-alias.s
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe -triple=wasm32-unknown-unknown -filetype=obj < C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\weak-alias.s | c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe --check-prefix=CHECK C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\weak-alias.s
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-mc.exe' -triple=wasm32-unknown-unknown -filetype=obj
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\obj2yaml.exe'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' --check-prefix=CHECK 'C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\weak-alias.s'
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\weak-alias.s:100:15: error: CHECK-NEXT: expected string not found in input
# | # CHECK-NEXT: Minimum: 0x1
# |               ^
# | <stdin>:24:9: note: scanning from here
# |  Limits:
# |         ^
# | <stdin>:25:2: note: possible intended match here
# |  Minimum: 0x0
# |  ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\MC\WebAssembly\weak-alias.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             .
# |             .
# |             .
# |            19:  Field: __indirect_function_table 
# |            20:  Kind: TABLE 
# |            21:  Table: 
# |            22:  Index: 0 
# |            23:  ElemType: FUNCREF 
# |            24:  Limits: 
# | next:100'0             X error: no match found
# |            25:  Minimum: 0x0 
# | next:100'0     ~~~~~~~~~~~~~~
# | next:100'1      ?             possible intended match
# |            26:  - Type: FUNCTION 
# | next:100'0     ~~~~~~~~~~~~~~~~~~
# |            27:  FunctionTypes: [ 0, 0, 0, 0, 0 ] 
# | next:100'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |            28:  - Type: ELEM 
# | next:100'0     ~~~~~~~~~~~~~~
# |            29:  Segments: 
# | next:100'0     ~~~~~~~~~~~
# |            30:  - Offset: 
# | next:100'0     ~~~~~~~~~~~
# |             .
# |             .
# |             .
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the infrastructure label.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 21, 2025

Looks like a few test failures.

@daxpedda daxpedda requested a review from sbc100 December 21, 2025 06:28
@daxpedda
Copy link
Author

Ran the full MC Wasm test suite locally now to confirm.

Comment on lines +1848 to +1855
// Update minimum size of `__indirect_function_table` table.
auto It = llvm::find_if(Imports, [](const wasm::WasmImport &I) {
return I.Field == "__indirect_function_table";
});

if (It != Imports.end()) {
It->Table.Limits.Minimum = TableElems.size();
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure why TableElems exists in the first place. I would assume that the correct data should be present in the symbol to begin with, but seems that it isn't and that its supposed to be different.

I placed it here because its after TableElems has been modified, but I'm happy to move it elsewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebAssembly] error importing tables with limits

3 participants