Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 23 Aug 2015 20:35:41 +0200
From: Szabolcs Nagy <nsz@...t70.net>
To: Dirk Vanden Boer <dirk.vdb@...il.com>
Cc: musl@...ts.openwall.com, gregor.richards@...terloo.ca
Subject: Re: Segfault when using c++11 thread

* Dirk Vanden Boer <dirk.vdb@...il.com> [2015-08-22 20:03:28 +0200]:
> I compiled a native x86_64-linux-musl toolchain on my arch linux box using
> the musl-cross scripts (no modifications).
> 
> When running code that uses c++11 threading functionality I get segfaults:
> 
> Minimal reproduction file:
> #include <thread>
> #include <iostream>
> 
> int main()
> {
>     std::cout << "Thread id: " << std::this_thread::get_id() << std::endl;
> }
> 
> compile with:
> ./cross/x86_64-linux-musl/bin/x86_64-linux-musl-g++ -pthread -std=c++11
> -static -g main.cpp -o test
> 

-static is broken if you don't patch gcc properly
maybe the musl-cross gcc patch is missing the gthr weak ref fix.

(fwiw static linking works for me with the backported
musl patches from gcc-trunk
http://port70.net/~nsz/musl/gcc-5.2.0/gcc-5.2.0-combined.diff
but this link might get broken in the future)

> file test
> test: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically
> linked, not stripped
> 
> Running test crashes, gdb backtrace:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000000000000000 in ?? ()
> (gdb) bt
> #0  0x0000000000000000 in ?? ()
> #1  0x00000000004006ac in __gthread_self () at
> /home/dirk/cross/x86_64-linux-musl/x86_64-linux-musl/include/c++/5.2.0/x86_64-linux-musl/bits/gthr-default.h:686
> #2  0x00000000004007ad in std::this_thread::get_id () at
> /home/dirk/cross/x86_64-linux-musl/x86_64-linux-musl/include/c++/5.2.0/thread:263
> #3  0x00000000004006bc in main () at main.cpp:6
> 
> Am I doing something wrong?
> 
> Regards,
> Dirk

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.