<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 - wasm-ld: crash when creating map file with Free Pascal generated object files"
href="https://bugs.llvm.org/show_bug.cgi?id=48972">48972</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>wasm-ld: crash when creating map file with Free Pascal generated object files
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>wasm
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nickysn@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, sbc@chromium.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=24469" name="attach_24469" title="Object modules and linker script to reproduce the crash">attachment 24469</a> <a href="attachment.cgi?id=24469&action=edit" title="Object modules and linker script to reproduce the crash">[details]</a></span>
Object modules and linker script to reproduce the crash
Linker crashes, when asked to create a map file. It produces a working
WebAssembly binary when not creating a map file. The WebAssembly binary targets
the WASI platform and can be run using wasmtime.
Object modules being linked are produced by the llvm-mc assembler. Assembly
output that was previously fed to llvm-mc was generated by the Free Pascal
Compiler.
I have attached all the object modules and two linker scripts - one that
invokes the linker without map file (this one produces a working WebAssembly
binary), and one that tries to create a map file, which causes a crash. The
linker scripts are exactly as produced by the Free Pascal Compiler and use
absolute paths to the linker binary, which needs to be adjusted for your
system.
I have included the source code for the Pascal program that was compiled
(hello.pas). This gives information of how a successful hello.wasm should
behave. It demonstrates that standard input and output are working and needs no
file access.
I have not included the assembler files, produced by the Free Pascal compiler,
but I can provide them as well, if that would help resolve the bug. They are
quite big. The assembly source for producing system.o alone is enough to reach
the 1 MB bugzilla attachment limit after gzipping.
The llvm-mc and wasm-ld linkers are compiled from the git main branch, commit
689de5841c1c4c9b0fe711b61d26f7425cf99423.
The crash looks like this:
Linking hello.wasm
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
./link-linkmap.sh: line 10: 30785 Segmentation fault (core dumped)
/home/nickysn/tralala/llvm/llvm-project/build-lld/bin/wasm-ld system.o hello.o
si_prc.o --gc-sections -Map hello.map -o hello.wasm --no-entry --strip-all
An error occurred while linking hello.wasm</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>