Bugs #43

c++ exception not working on mips when musl is used as C library

Added by Abdoulaye Walsimou Gaye almost 3 years ago. Updated almost 2 years ago.

Status:ClosedStart date:2014-09-21
Priority:HighDue date:
Assignee:-% Done:

0%

Category:ToolchainSpent time:-
Target version:embtoolkit-1.8.0

Description

The following simple test code generates a segfault in
libstdc++-v3/libsupc++/eh_throw.cc: _cxxabiv1::_cxa_throw() when globals pointer is dereferenced
The issue seems to be musl returning wrong pointer when __tls_get_addr() is called
(library call generated by g++ as part of TLS handle)

To workaround this issue emulated TLS in libgcc is used for the moment (see 0f0875e7f0ebb812f6fed4f8b691a76093fd2d6e)

#include <stdio.h>
#include <exception>
#include <ostream>

int main(int argc, char **argv)
{
    (void)argc;
    (void)argv;

    try {
        throw 20;
    } catch (int e) {
        printf("Exception Nr %d occurred\n", e);
    }

    return 0;
}

History

#1 Updated by Abdoulaye Walsimou Gaye almost 2 years ago

  • Status changed from New to Closed
  • Target version changed from development to embtoolkit-1.8.0

Fixed upstream in musl-1.1.10+ and backported in embtoolkit musl-1.1.10 patch set

Also available in: Atom PDF