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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to