[llvm-bugs] [Bug 45171] New: throw of a C string is causing an error when targeting wasm32

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 10 15:35:47 PDT 2020


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

            Bug ID: 45171
           Summary: throw of a C string is causing an error when targeting
                    wasm32
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: wasm
          Assignee: unassignedbugs at nondot.org
          Reporter: sliftist at gmail.com
                CC: llvm-bugs at lists.llvm.org, sbc at chromium.org

Compiling with code that throws an exception yields an undefined symbol error:
    ~/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang ./test.cpp
--target=wasm32 -nostdlib -Wl,--no-entry -Wl,--export-all

Error:
    wasm-ld: error: /tmp/test-eac9ed.o: undefined symbol: typeinfo for char
const*
    clang-9: error: linker command failed with exit code 1 (use -v to see
invocation)

./test.cpp:
    extern "C" {
        void* __cxa_allocate_exception(unsigned int thrown_size) { return
nullptr; }
        void __cxa_throw(void* thrown_object, void* type, void(*dest)(void*)) {
}
    }

    void testThrow() {
        throw "test";
    }

I could not find instructions for how to define "typeinfo for char const*" in
the llvm document on exception handling
(https://llvm.org/docs/ExceptionHandling.html), but there could just be an
undocumented (or maybe I just could not find the documentation) manner to allow
exception throwing of const char* in WebAssembly.

-- 
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/20200310/40d95c03/attachment-0001.html>


More information about the llvm-bugs mailing list