Fix __hip_fabin visibility

In -fgpu-rdc case, fat binary is embedded as global variable __hip_fatbin.
It needs to have protected visibility to avoid conflict between shared
libraries.

Reviewed by: Siu Chi Chan

Differential Revision: https://reviews.llvm.org/D106571

Fixes: SWDEV-292290
This commit is contained in:
Yaxun (Sam) Liu 2021-07-22 12:36:46 -04:00
parent af5602d369
commit 9a977daaf6
2 changed files with 2 additions and 0 deletions

View File

@ -180,6 +180,7 @@ void AMDGCN::Linker::constructGenerateObjFileFromHIPFatBinary(
// in several main host machines. // in several main host machines.
ObjStream << "# HIP Object Generator\n"; ObjStream << "# HIP Object Generator\n";
ObjStream << "# *** Automatically generated by Clang ***\n"; ObjStream << "# *** Automatically generated by Clang ***\n";
ObjStream << " .protected __hip_fatbin\n";
ObjStream << " .type __hip_fatbin,@object\n"; ObjStream << " .type __hip_fatbin,@object\n";
ObjStream << " .section .hip_fatbin,\"a\",@progbits\n"; ObjStream << " .section .hip_fatbin,\"a\",@progbits\n";
ObjStream << " .globl __hip_fatbin\n"; ObjStream << " .globl __hip_fatbin\n";

View File

@ -14,6 +14,7 @@
// RUN: 2>&1 | FileCheck %s // RUN: 2>&1 | FileCheck %s
// check code object alignment in dumped llvm-mc input // check code object alignment in dumped llvm-mc input
// CHECK: .protected __hip_fatbin
// CHECK: .p2align 12 // CHECK: .p2align 12
// emit objects for host side path // emit objects for host side path