mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Szabolcs Nagy <nsz@port70.net>
To: "Kenny, Joseph P" <jpkenny@sandia.gov>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] Re: [EXTERNAL] [musl] C++ segfault on riscv64
Date: Sat, 19 Mar 2022 09:44:14 +0100	[thread overview]
Message-ID: <20220319084414.GJ1320090@port70.net> (raw)
In-Reply-To: <79055819-8B6E-4B53-AA1C-638B7E4C7FF7@sandia.gov>

* Kenny, Joseph P <jpkenny@sandia.gov> [2022-03-18 16:48:11 +0000]:
> Sorry for the confusing post. I get the same behavior on qemu for both riscv64 and riscv32. I posted output from riscv32.
> 
> Here is the C++ code:
> $ cat hello.cc
> #include <iostream>
> int main() {
> std::cout << "Hello\n";
> return 0;
> }
> 
> From: "Kenny, Joseph P" <jpkenny@sandia.gov>
> Reply-To: "musl@lists.openwall.com" <musl@lists.openwall.com>
> Date: Friday, March 18, 2022 at 9:42 AM
> To: "musl@lists.openwall.com" <musl@lists.openwall.com>
> Subject: [EXTERNAL] [musl] C++ segfault on riscv64
> 
> I’m getting segfaults with musl for C++ code on riscv64. I have tested mipsel using qemu user mode as described below and found no issues.
> 
> I’m cross-compiling using the latest riscv64-linux-musl-cross.tgz (23-Nov-2021) from musl.cc on x86_64/Fedora 35. I have confirmed that I get the following behavior for both riscv64 hardware and qemu user mode.
...
> C++ segfaults:
> 
> $ riscv32-linux-musl-g++ -static -g -Og hello.cc -o hello
> $ qemu-riscv32 hello
> Segmentation fault (core dumped)
> 
> GDB confirms the segfault in __dynamic_cast on both qmeu and riscv64 hardware. I’ll paste in the assembly below. Segfault occurs on the last instruction shown [ld      a5,0(a0)].
> 
> I’ve taken this as far as my skills allow. Any ideas what’s going on here or how to debug further?

listdc++ iostreams initializers call __dynamic_cast many times (this is
all in libstdc++, nothing to do with musl).

you need to figure out which cast fails and why the type info is corrupt.

e.g. build libstdc++ with debug info and printing the backtrace may help.

      reply	other threads:[~2022-03-19  8:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 16:41 Kenny, Joseph P
2022-03-18 16:48 ` [musl] Re: [EXTERNAL] " Kenny, Joseph P
2022-03-19  8:44   ` Szabolcs Nagy [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220319084414.GJ1320090@port70.net \
    --to=nsz@port70.net \
    --cc=jpkenny@sandia.gov \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).