[OPENMP]Fix PR41826: symbols visibility in device code.
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 21 Nov 2019 16:30:43 +0000 (11:30 -0500)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 25 Nov 2019 20:01:28 +0000 (15:01 -0500)
commitbbc328c62430dd3e2e72973ca85c5c6fb550b227
tree07ec8bcbd6cd255edd565ff05d2b6205dd0dbe87
parent7b86188b50bf6e537fe98b326f258fbd23108b83
[OPENMP]Fix PR41826: symbols visibility in device code.

Summary:
Currently, we ignore all locality attributes/info when building for
the device and thus all symblos are externally visible and can be
preemted at the runtime. It may lead to incorrect results. We need to
follow the same logic, compiler uses for static/pie builds. But in some
cases changing of dso locality may lead to problems with codegen, so
instead mark external symbols as hidden instead in the device code.

Reviewers: jdoerfert

Subscribers: guansong, caomhin, kkwli0, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D70549
clang/lib/AST/Decl.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/test/OpenMP/declare_target_codegen.cpp
clang/test/OpenMP/nvptx_allocate_codegen.cpp
clang/test/OpenMP/nvptx_declare_target_var_ctor_dtor_codegen.cpp
clang/test/OpenMP/nvptx_target_codegen.cpp
clang/test/OpenMP/nvptx_unsupported_type_codegen.cpp