[PATCH] D89633: [VE] Fix initializer visibility
Sergei Trofimovich via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 17 12:30:24 PDT 2020
trofi created this revision.
trofi added a reviewer: simoll.
Herald added subscribers: llvm-commits, dexonsmith, hiraditya.
Herald added a project: LLVM.
trofi requested review of this revision.
Before the change attempt to link libLTO.so against shared
LLVM library failed as:
[ 76%] Linking CXX shared library ../../lib/libLTO.so
... /usr/bin/cmake -E cmake_link_script CMakeFiles/LTO.dir/link.txt --verbose=1
c++ -o ...libLTO.so.12git ...ibLLVM-12git.so
ld: CMakeFiles/LTO.dir/lto.cpp.o: in function `llvm::InitializeAllTargetInfos()':
include/llvm/Config/Targets.def:31: undefined reference to `LLVMInitializeVETargetInfo'
It happens because on linux llvm build system sets default
symbol visibility to "hidden". The fix is to set visibility
back to "default" for exported APIs with LLVM_EXTERNAL_VISIBILITY.
Bug: https://bugs.llvm.org/show_bug.cgi?id=47847
Signed-off-by: Sergei Trofimovich <slyfox at inbox.ru>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89633
Files:
llvm/lib/Target/VE/Disassembler/VEDisassembler.cpp
llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
llvm/lib/Target/VE/VEAsmPrinter.cpp
llvm/lib/Target/VE/VETargetMachine.cpp
Index: llvm/lib/Target/VE/VETargetMachine.cpp
===================================================================
--- llvm/lib/Target/VE/VETargetMachine.cpp
+++ llvm/lib/Target/VE/VETargetMachine.cpp
@@ -23,7 +23,7 @@
#define DEBUG_TYPE "ve"
-extern "C" void LLVMInitializeVETarget() {
+extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETarget() {
// Register the target.
RegisterTargetMachine<VETargetMachine> X(getTheVETarget());
}
Index: llvm/lib/Target/VE/VEAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/VE/VEAsmPrinter.cpp
+++ llvm/lib/Target/VE/VEAsmPrinter.cpp
@@ -350,6 +350,6 @@
}
// Force static initialization.
-extern "C" void LLVMInitializeVEAsmPrinter() {
+extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVEAsmPrinter() {
RegisterAsmPrinter<VEAsmPrinter> X(getTheVETarget());
}
Index: llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
===================================================================
--- llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
+++ llvm/lib/Target/VE/TargetInfo/VETargetInfo.cpp
@@ -16,7 +16,7 @@
return TheVETarget;
}
-extern "C" void LLVMInitializeVETargetInfo() {
+extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETargetInfo() {
RegisterTarget<Triple::ve, /*HasJIT=*/false> X(getTheVETarget(), "ve",
"VE", "VE");
}
Index: llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
===================================================================
--- llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
+++ llvm/lib/Target/VE/MCTargetDesc/VEMCTargetDesc.cpp
@@ -80,7 +80,7 @@
return new VEInstPrinter(MAI, MII, MRI);
}
-extern "C" void LLVMInitializeVETargetMC() {
+extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVETargetMC() {
// Register the MC asm info.
RegisterMCAsmInfoFn X(getTheVETarget(), createVEMCAsmInfo);
Index: llvm/lib/Target/VE/Disassembler/VEDisassembler.cpp
===================================================================
--- llvm/lib/Target/VE/Disassembler/VEDisassembler.cpp
+++ llvm/lib/Target/VE/Disassembler/VEDisassembler.cpp
@@ -47,7 +47,7 @@
return new VEDisassembler(STI, Ctx);
}
-extern "C" void LLVMInitializeVEDisassembler() {
+extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeVEDisassembler() {
// Register the disassembler.
TargetRegistry::RegisterMCDisassembler(getTheVETarget(),
createVEDisassembler);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89633.298847.patch
Type: text/x-patch
Size: 2513 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201017/5c21c368/attachment.bin>
More information about the llvm-commits
mailing list