<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54552>54552</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[WebAssembly] Use WebAssembly custom sections in C/C++ source files
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
nokotan
</td>
</tr>
</table>
<pre>
All global variables, including ones that have section attribute `__attribute__((section("<section-name>")))`, are located in WebAssembly data sections.
I know that this behavior is required to compatibility of other platforms, and that this is great solution because all data in WebAssembly custom section cannot be loaded into a linear memory.
If you want to embed some metadata into WebAssembly, file scope inline assembly can be used.
```c++
__asm(
".section .custom_section.my_section,\"G\",@,abc123\n"
".ascii \"my_section is here!\"\n"
);
```
I want global variables, attributed `__attribute__((section(".custom_section.*")))` and never read and written in the program, to be located into WebAssembly custom section.
This may be solution candidate of that llvm-cov is useless with WebAssembly because llvm-cov currently expects that llvm-cov specific sections are located in WebAssembly custom section. (<https://github.com/emscripten-core/emscripten/issues/13046>)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVE2TmzAM_TVw0SxDIGSzBw7ZbLfTezs9ZmRQwF1jp7ZJmn9f2WFpkml3OqMB5A_pSe8JYdpzvVEKOmUEKjiilSgUuaTYgtSNGlupOzCaHPgePfR4JHDUeGk0oPdWitETJKt8t5vd3S4p1mzTuegUSbmd_AeNAyXlp7BYPE22ykNKtATKNOip5fTwncTGORqEOkOLHt8zuyzJX5J8c3l-gTdtThd8vpcOBDFMaSzwt6Wfo7QczhtozHBAL4VU0p_B7MH4niwcFPq9sUMsGnV7FYmts8SeM2qMNQtqcHQEyE2LkO5gNqPzZphb1KDWxvMtLgvbWBUDQVBSE1oYaDD2fFvNHs5mhBNqHzBzVL7lzEB82OOUkjeukgbce6mYmMYciLdDdMAZEgbYwKjbm0yh59GapHgOFleZRzcEyqIHwCxl79Vkl-p2k58N593M8Taptnz28-UV_GWgFEWzKEpe1GH1Kia6Rkq4nP4TJ3ScOaGkWEyBrm8GoZTPd-hvpRD79jc1z-ps_0et95UmxeZOrlEpmo4sIFZIG92Tld6TDppgZcHBms7iELIzYeJa2rcE3qlmYulrUOCA53Bz1h-T2UpWAQX9RqEqdRweGnMMrWOOuVwHJ-n7mwTvsp0PN6O1pD1v0a8Dp3V3wRwvyr1s5pH7aDbv4EPoYbntvT-4pOTGvbJ1DGkUGc8gOzS4xsoD94qTBbavVtiRzo2BtddFmS9X8VfxlLZ12T6VT5h66RXVSfV8PQLVC3zj-v6NygXQrKjX7UXt3NLRNhQHx6WjVfUHeENbptcDs_qDQ17DrJZVVaR9nZfVApe42CMu1oSrElcCxaNYFu0akUSqUJByATurSdMJYogo85dU1kVeFHlZVIsir5Z51j7m-eO6WK6Qynafr3miaECpsoAjM7ZLbR0hibFzvKmk8-7PJv8AZKcptirEx9H3xtbavBmPOo2p6wj9N_8C_Pc">