undefined-symbol-lto.test 685 Bytes
REQUIRES: x86

RUN: rm -rf %t && mkdir -p %t && cd %t
RUN: llvm-as %S/Inputs/undefined-symbol-lto-a.ll -o t.obj
RUN: llvm-as %S/Inputs/undefined-symbol-lto-b.ll -o b.obj
RUN: llvm-lib b.obj -out:b.lib
RUN: not lld-link -entry:main -nodefaultlib t.obj b.lib -subsystem:console 2>&1 | FileCheck %s

CHECK: undefined symbol: main
CHECK: undefined symbol: void __cdecl undefined_ref(void)
CHECK: referenced by

Originally reported as PR42536.

a.ll corresponds to this C++:

struct __declspec(dllimport) S {
  virtual void foo();
};
void undefined_ref();
struct Init {
  Init() { undefined_ref(); }
  S c;
} d;

b.ll is from this C++:

struct S {
  virtual void foo();
};
void S::foo() {}