[clang] 9a977da - Fix __hip_fabin visibility
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 23 07:15:14 PDT 2021
Author: Yaxun (Sam) Liu
Date: 2021-07-23T10:14:29-04:00
New Revision: 9a977daaf6b19c6ff7a53afbe8ece2cb7011dd9e
URL: https://github.com/llvm/llvm-project/commit/9a977daaf6b19c6ff7a53afbe8ece2cb7011dd9e
DIFF: https://github.com/llvm/llvm-project/commit/9a977daaf6b19c6ff7a53afbe8ece2cb7011dd9e.diff
LOG: 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
Added:
Modified:
clang/lib/Driver/ToolChains/HIP.cpp
clang/test/Driver/hip-toolchain-rdc.hip
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/HIP.cpp b/clang/lib/Driver/ToolChains/HIP.cpp
index 28d4e5ddad10..8c85cc755adb 100644
--- a/clang/lib/Driver/ToolChains/HIP.cpp
+++ b/clang/lib/Driver/ToolChains/HIP.cpp
@@ -180,6 +180,7 @@ void AMDGCN::Linker::constructGenerateObjFileFromHIPFatBinary(
// in several main host machines.
ObjStream << "# HIP Object Generator\n";
ObjStream << "# *** Automatically generated by Clang ***\n";
+ ObjStream << " .protected __hip_fatbin\n";
ObjStream << " .type __hip_fatbin, at object\n";
ObjStream << " .section .hip_fatbin,\"a\", at progbits\n";
ObjStream << " .globl __hip_fatbin\n";
diff --git a/clang/test/Driver/hip-toolchain-rdc.hip b/clang/test/Driver/hip-toolchain-rdc.hip
index 6a60686e3a95..abcc14538486 100644
--- a/clang/test/Driver/hip-toolchain-rdc.hip
+++ b/clang/test/Driver/hip-toolchain-rdc.hip
@@ -14,6 +14,7 @@
// RUN: 2>&1 | FileCheck %s
// check code object alignment in dumped llvm-mc input
+// CHECK: .protected __hip_fatbin
// CHECK: .p2align 12
// emit objects for host side path
More information about the cfe-commits
mailing list