undefined reference to `llvm_omp_target_alloc_shared

I'd like to use llvm_omp_targe_alloc_shared(), but can't link with Clang 12;
are they available in main?

The special allocators are supported upstream only for the nvptx64 target. The library interface was added in March and the nvptx64 implementation in May. The test file omp_device_managed_memory.c gives an example usage.

Hi Joseph, all,
I was looking at too the test code in the libomptarget/test/api
directory, and it can be built with today's main branch Clang.

However, are the llvm_ prefixed omp_targer_allocs callable from C++ codes?

Yes, but you will need to cast the returned void pointer and declare the function extern "C" so the name doesn’t get mangled.