[llvm-bugs] [Bug 48972] New: wasm-ld: crash when creating map file with Free Pascal generated object files

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 30 16:48:07 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=48972

            Bug ID: 48972
           Summary: wasm-ld: crash when creating map file with Free Pascal
                    generated object files
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: wasm
          Assignee: unassignedbugs at nondot.org
          Reporter: nickysn at gmail.com
                CC: llvm-bugs at lists.llvm.org, sbc at chromium.org

Created attachment 24469
  --> https://bugs.llvm.org/attachment.cgi?id=24469&action=edit
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 https://bugs.llvm.org/ 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210131/1ecaf3dc/attachment.html>


More information about the llvm-bugs mailing list