[llvm-bugs] [Bug 48971] New: [llvm-mc] crash on Free Pascal WebAssembly output with DWARF debug info

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 30 15:53:22 PST 2021


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

            Bug ID: 48971
           Summary: [llvm-mc] crash on Free Pascal WebAssembly output with
                    DWARF debug info
           Product: libraries
           Version: 11.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: nickysn at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 24468
  --> https://bugs.llvm.org/attachment.cgi?id=24468&action=edit
The actual file, produced by the FPC compiler, that causes the crash. Gzipped
to fit the 1MB bugzilla file attachment limit.

I'm working on a non-LLVM based WebAssembly back-end for the Free Pascal
Compiler. It only uses llvm-mc as a back-end assembler and wasm-ld as a linker.
When I enable the DWARF debug info output, I get the following error from
llvm-mc:

PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments: /usr/bin/llvm-mc --assemble --arch=wasm32
-mattr=+sign-ext --filetype=obj -o ./system.o ./system.wat 
 #0 0x00007f1373ede27a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/lib64/libLLVM-11.so+0xa8b27a)
 #1 0x00007f1373edc4e4 llvm::sys::RunSignalHandlers()
(/lib64/libLLVM-11.so+0xa894e4)
 #2 0x00007f1373edc676 (/lib64/libLLVM-11.so+0xa89676)
 #3 0x00007f13730dda60 __restore_rt (/lib64/libc.so.6+0x3da60)
 #4 0x00007f13751cbe89 (/lib64/libLLVM-11.so+0x1d78e89)
 #5 0x00007f1375179e71 llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&,
llvm::MCFragment&, llvm::MCFixup const&) (/lib64/libLLVM-11.so+0x1d26e71)
 #6 0x00007f137517afc1 llvm::MCAssembler::layout(llvm::MCAsmLayout&)
(/lib64/libLLVM-11.so+0x1d27fc1)
 #7 0x00007f137517b1a9 llvm::MCAssembler::Finish()
(/lib64/libLLVM-11.so+0x1d281a9)
 #8 0x00007f13752016fc (/lib64/libLLVM-11.so+0x1dae6fc)
 #9 0x00005610c7f71ba1 (/usr/bin/llvm-mc+0xbba1)
#10 0x00007f13730c81e2 __libc_start_main (/lib64/libc.so.6+0x281e2)
#11 0x00005610c7f71dbe (/usr/bin/llvm-mc+0xbdbe)

I'm sure there's something wrong or unsupported in the FPC generated .wat file,
but it's very difficult for me to figure out what it is from this error,
because it doesn't give me a line number, nor an identifier, that I can search
for. I don't necessarily expect a very user friendly error, but at least the
line number where an expected error occured would be very helpful.

I'm using llvm-mc from the llvm-11.0.0-1.fc33.x86_64 package from the official
Fedora 33 repositories. I tried also building llvm-mc from the git main branch
from a wwek ago (commit 689de5841c1c4c9b0fe711b61d26f7425cf99423). With this
version I get this error:

llvm-mc:
/home/nickysn/tralala/llvm/llvm-project/llvm/include/llvm/ADT/DenseMap.h:1239:
llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::value_type*
llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket, IsConst>::operator->()
const [with KeyT = const llvm::MCSection*; ValueT = const llvm::MCSymbol*;
KeyInfoT = llvm::DenseMapInfo<const llvm::MCSection*>; Bucket =
llvm::detail::DenseMapPair<const llvm::MCSection*, const llvm::MCSymbol*>; bool
IsConst = false; llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket,
IsConst>::pointer = llvm::detail::DenseMapPair<const llvm::MCSection*, const
llvm::MCSymbol*>*; llvm::DenseMapIterator<KeyT, ValueT, KeyInfoT, Bucket,
IsConst>::value_type = llvm::detail::DenseMapPair<const llvm::MCSection*, const
llvm::MCSymbol*>]: Assertion `Ptr != End && "dereferencing end() iterator"'
failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash
backtrace.
Stack dump:
0.      Program arguments:
/home/nickysn/tralala/llvm/llvm-project/build-lld/bin/llvm-mc --assemble
--arch=wasm32 -mattr=+sign-ext --filetype=obj -o ./system.o ./system.wat
 #0 0x0000000000c58ac5 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:22
 #1 0x0000000000c58b7c PrintStackTraceSignalHandler(void*)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:632:1
 #2 0x0000000000c56b7c llvm::sys::RunSignalHandlers()
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/Support/Signals.cpp:71:20
 #3 0x0000000000c58518 SignalHandler(int)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/Support/Unix/Signals.inc:407:1
 #4 0x00007f40c93c11e0 __restore_rt (/lib64/libpthread.so.0+0x141e0)
 #5 0x00007f40c8ea89d5 raise (/lib64/libc.so.6+0x3d9d5)
 #6 0x00007f40c8e918a4 abort (/lib64/libc.so.6+0x268a4)
 #7 0x00007f40c8e91789 _nl_load_domain.cold (/lib64/libc.so.6+0x26789)
 #8 0x00007f40c8ea1026 (/lib64/libc.so.6+0x36026)
 #9 0x0000000000ae738e llvm::DenseMapIterator<llvm::MCSection const*,
llvm::MCSymbol const*, llvm::DenseMapInfo<llvm::MCSection const*>,
llvm::detail::DenseMapPair<llvm::MCSection const*, llvm::MCSymbol const*>,
false>::operator->() const
/home/nickysn/tralala/llvm/llvm-project/llvm/include/llvm/ADT/DenseMap.h:1240:35
#10 0x0000000000ad4f8d (anonymous
namespace)::WasmObjectWriter::recordRelocation(llvm::MCAssembler&,
llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&,
llvm::MCValue, unsigned long&)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/WasmObjectWriter.cpp:492:21
#11 0x0000000000a3e399 llvm::MCAssembler::handleFixup(llvm::MCAsmLayout const&,
llvm::MCFragment&, llvm::MCFixup const&)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCAssembler.cpp:812:35
#12 0x0000000000a3eeb2 llvm::MCAssembler::layout(llvm::MCAsmLayout&)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCAssembler.cpp:936:48
#13 0x0000000000a3efdc llvm::MCAssembler::Finish()
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCAssembler.cpp:951:35
#14 0x0000000000a9d112 llvm::MCObjectStreamer::finishImpl()
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCObjectStreamer.cpp:863:1
#15 0x0000000000abb52b llvm::MCWasmStreamer::finishImpl()
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCWasmStreamer.cpp:186:1
#16 0x0000000000aad917 llvm::MCStreamer::Finish(llvm::SMLoc)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCStreamer.cpp:992:1
#17 0x0000000000b25e39 (anonymous namespace)::AsmParser::Run(bool, bool)
/home/nickysn/tralala/llvm/llvm-project/llvm/lib/MC/MCParser/AsmParser.cpp:1003:10
#18 0x0000000000409989 AssembleInput(char const*, llvm::Target const*,
llvm::SourceMgr&, llvm::MCContext&, llvm::MCStreamer&, llvm::MCAsmInfo&,
llvm::MCSubtargetInfo&, llvm::MCInstrInfo&, llvm::MCTargetOptions const&)
/home/nickysn/tralala/llvm/llvm-project/llvm/tools/llvm-mc/llvm-mc.cpp:309:45
#19 0x000000000040b035 main
/home/nickysn/tralala/llvm/llvm-project/llvm/tools/llvm-mc/llvm-mc.cpp:540:24
#20 0x00007f40c8e931e2 __libc_start_main (/lib64/libc.so.6+0x281e2)
#21 0x000000000040906e _start
(/home/nickysn/tralala/llvm/llvm-project/build-lld/bin/llvm-mc+0x40906e)

-- 
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/20210130/30e6a8ad/attachment-0001.html>


More information about the llvm-bugs mailing list