<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - AsmParser cannot recognize function types without definitions"
href="https://bugs.llvm.org/show_bug.cgi?id=39557">39557</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>AsmParser cannot recognize function types without definitions
</td>
</tr>
<tr>
<th>Product</th>
<td>libraries
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Backend: WebAssembly
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>aheejin@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=21082" name="attach_21082" title="Test case .ll file">attachment 21082</a> <a href="attachment.cgi?id=21082&action=edit" title="Test case .ll file">[details]</a></span>
Test case .ll file
When there is a function call to a function that does not have a definition, if
we generate .s file using `llc` and generate .o file from it using `llvm-mc`,
the function symbol is recognized as not a function but a data.
Commands that reproduce the bug:
```
llc -filetype=asm -asm-verbose=false test.ll -o test.s
llvm-mc -triple=wasm32-unknown-unknown -filetype=obj test.s -o test_from_s.o
obj2yaml test_from_s.o > test_from_s.yaml
llc -filetype=obj test.ll -o test.o
obj2yaml test.o > test.yaml
```
test.yaml and test_from_s.yaml are supposed to be the same, but they are not.
In test_from_s.yaml, foo, which is defined, is listed as a function symbol, but
bar, which is not defined, is listed as data.
```
SymbolTable:
- Index: 0
Kind: FUNCTION
Name: foo
Flags: [ BINDING_LOCAL ]
Function: 0
- Index: 1
Kind: DATA
Name: bar
Flags: [ UNDEFINED ]
```
And consequentially, it has no function import entry in the 'Import' section,
and no type signature entry in 'Type' section as well.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>