File: visibility-hidden.patch

package info (click to toggle)
spirv-llvm-translator-14 14.0.17-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 15,700 kB
  • sloc: cpp: 47,811; lisp: 3,704; sh: 153; python: 43; makefile: 41
file content (93 lines) | stat: -rw-r--r-- 2,474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Author: Andreas Beckmann <anbe@debian.org>
Description: reduce the amount of symbols exposed by the library
Forwarded: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/issues/1963

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -117,6 +117,9 @@ if(NOT SPIRV_TOOLS_FOUND)
           "--spirv-tools-dis support.")
 endif(NOT SPIRV_TOOLS_FOUND)
 
+add_compile_options(-fvisibility=hidden)
+add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fvisibility-inlines-hidden>)
+
 add_subdirectory(lib/SPIRV)
 add_subdirectory(tools/llvm-spirv)
 if(LLVM_SPIRV_INCLUDE_TESTS)
--- a/include/LLVMSPIRVLib.h
+++ b/include/LLVMSPIRVLib.h
@@ -46,6 +46,8 @@
 #include <iostream>
 #include <string>
 
+#pragma GCC visibility push(default)
+
 namespace llvm {
 // Pass initialization functions need to be declared before inclusion of
 // PassSupport.h.
@@ -68,8 +70,12 @@ class ModulePass;
 class FunctionPass;
 } // namespace llvm
 
+#pragma GCC visibility pop
+
 #include "llvm/IR/Module.h"
 
+#pragma GCC visibility push(default)
+
 namespace SPIRV {
 
 class SPIRVModule;
@@ -250,4 +256,6 @@ FunctionPass *createSPIRVLowerBitCastToN
 
 } // namespace llvm
 
+#pragma GCC visibility pop
+
 #endif // SPIRV_H
--- a/include/LLVMSPIRVOpts.h
+++ b/include/LLVMSPIRVOpts.h
@@ -48,6 +48,8 @@
 #include <map>
 #include <unordered_map>
 
+#pragma GCC visibility push(default)
+
 namespace llvm {
 class IntrinsicInst;
 } // namespace llvm
@@ -288,4 +290,6 @@ private:
 
 } // namespace SPIRV
 
+#pragma GCC visibility pop
+
 #endif // SPIRV_LLVMSPIRVOPTS_H
--- a/lib/SPIRV/libSPIRV/SPIRVStream.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVStream.cpp
@@ -82,6 +82,7 @@ static void readQuotedString(std::istrea
 }
 
 #ifdef _SPIRV_SUPPORT_TEXT_FMT
+__attribute__ ((visibility ("default")))
 bool SPIRVUseTextFormat = false;
 #endif
 
--- a/lib/SPIRV/libSPIRV/SPIRVModule.cpp
+++ b/lib/SPIRV/libSPIRV/SPIRVModule.cpp
@@ -2308,6 +2308,7 @@ bool isSpirvBinary(const std::string &Im
 
 #ifdef _SPIRV_SUPPORT_TEXT_FMT
 
+__attribute__ ((visibility ("default")))
 bool convertSpirv(std::istream &IS, std::ostream &OS, std::string &ErrMsg,
                   bool FromText, bool ToText) {
   auto SaveOpt = SPIRVUseTextFormat;
@@ -2344,6 +2345,7 @@ bool isSpirvText(const std::string &Img)
   return Magic == MagicNumber;
 }
 
+__attribute__ ((visibility ("default")))
 bool convertSpirv(std::string &Input, std::string &Out, std::string &ErrMsg,
                   bool ToText) {
   auto FromText = isSpirvText(Input);