[cfe-dev] LLVM ERROR: Program used external function '??_7type_info@@6B@' which could not be resolved!

Stammerjohann, Kai via cfe-dev cfe-dev at lists.llvm.org
Wed Jun 8 02:52:28 PDT 2016


Hi,

When I try to run this code via lli:

#include <stdio.h>

int main()
{
    try
    {
        throw "hi";
    }
    catch (const char *msg)
    {
        printf("%s\n", msg);
    }
    return 0;
}

It works as expected on linux but fails on windows:
LLVM ERROR: Program used external function '??_7type_info@@6B@' which could not be resolved!

This is what I execute:
	clang -fexceptions -c -emit-llvm a.cpp
	lli a.bc

I guess "??_7type_info@@6B@" (aka "const type_info::`vftable'") comes from libcmt.lib and would require link.exe to resolve.
type_info sounds like RTTI, but disabling (-fno-rtti) doesn't it fix the problem, I guess it's a requirement for exceptionhandling?

Is there a way to use gnu exception handling on windows generated bitcode? For my usecase, its perfectly fine to break compatibility to microsoft binaries (I tried to run clang with various targettriples, but didn't get it to work)




More information about the cfe-dev mailing list