ronlieb wrote:

@Jason-VanBeusekom   could you try and amdgpu target build on the following 
test case ?
Th
e test compiles/runs ok with a build of trunk from yesterday

clang++  -O2    -fopenmp --offload-arch=gfx90a   -D__OFFLOAD_ARCH_gfx90a__ 
virtual_functions.cpp -o virtual_functions

ld.lld: error: undefined symbol: __cxa_pure_virtual
>>> referenced by /tmp/virtual_functions.amdgcn.gfx90a-74bdb3.img.lto.o:(vtable 
>>> for A)
clang: error: ld.lld command failed with exit code 1 (use -v to see invocation)
/work2/rlieberm/rocm/trunk_1.0/bin/clang-linker-wrapper: error: 'clang' failed
clang++: error: linker command failed with exit code 1 (use -v to see 
invocation)



#include <cstdio>

class A {
public:
  A(int konst) : konst(konst) {}
  virtual int foo(int x) = 0;
protected:
  int konst;
};

class B : public A {
public:
  B(int konst) : A(konst) {}
  virtual int foo(int x) {
    return x-konst;
  }
};

class C : public B {
public:
  C(int konst) : B(konst) {}
  virtual int foo(int x) {
    return x+konst;
  }
};

#pragma omp declare target
C gbl_C(10);
#pragma omp end declare target


int main() {
  C host_C(200);

  int g, h, d;
  g = h = d = -1;

  #pragma omp target map(from:g, h, d)
  {
    C dev_C(3000);

    g = gbl_C.foo(3);
    h = host_C.foo(3);
    d = dev_C.foo(3);
  }

  int err = 0;
  if (g != 13 || h != 203 || d != 3003) {
    printf("Error!\n");
    err = 1;
  }

  return err;
}





https://github.com/llvm/llvm-project/pull/159856
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to