<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57356>57356</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
symbol offset in wasm32 data section is ignored silently
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
TerrorJack
</td>
</tr>
</table>
<pre>
Example:
```
.functype foo () -> ()
.section .rodata.bar,"",@
bar:
.p2align 2
.size bar, 4
.int32 foo+42
.hidden baz
.globl baz
.section .text.baz,"",@
baz:
.functype baz () -> (i32)
i32.const bar
i32.load 0
end_function
```
```c
#include <stdio.h>
void foo() {}
void *baz();
int main() {
printf("%p %p\n", foo, baz());
}
```
Compile and link these two files using `wasi-sdk` (based on llvm 15 branch), the two output values should differ, the second value should be larger. But the real output is `0x1 0x1`, which indicates `.int32 foo+42` is silently interpreted as `.int32 foo` in the assembly file.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxtU8uSmzAQ_Bq4TC2FJcD2gUPs3Rxyzj0l0GCUFRIlifV6vz4j-RnXVomHRtM9Pc3QWXlq3z7FNGvM-I-sfM3K670pLyttAYphMX04zQiDtZCxTca28JLxt8v7I5iyPfZBWQOFs1IEUXTCZWyfMZbWPqsuxDHO77CZCa0OBtidSH0hnNFQ3aLKBM6ikoztKvZUe1RSoiHQ1y100LbT_0VuAgN-hiKefC_v61HezQOKP3ugOLvZAEC7orfGh6T9IaitkHBzFY38k0hJyrfGPwX7y55xZXq9SISM732QyhYj6XjEfFglzw4lmdl6l61fH44ylro7fzy-e4SSuzAJZR6gF72zo7MhxanbeoZ4y-q9Oft2rreHO_Ej97X8ty3u7TQrjSCMBK3MO4QRPUI4Whgo7mHxyhyAUEfh1YuX7_Qafe-ERwn0JbX-mGBVQ-eE6cdUfB9ZEoddwrwE-BB6IS4_2kVLkGoY0F3TaCIsFU8p14wOQQt3QFfAjuAxzaHQVzrlo6DycwV0xYaI6jiqfgRlpOpFwJTwPK4knJCe2jJBnyg3oJsdBupDPANirkmFhfc4dZQf_ShybFdNs6pWdcNZLlsut3wr8qCCxtafps6SymHwGCKePJuIMP6KcJ18kkC_mnVU9SolX5xuxxBmH6ee_aR1UGFcOprliTbR4svjZXb2LzHRVnlPptJLveZ1k4_ttqzkptxseiGaoamrEnFd1kPT9Xwt1lWXa9Gh9m1W72huDB4hUcQZql9z1bKSsXLDarpKvio6XtWC92xAWa2ElPR3Io2nLqKOwrpD7tokqVsOng618sHfD8k36hMxlSN-sYTRuvY3OmfdL9G_56l6m9T_AxwWeoo">