[ELF] Add LLVM_LIBRARY_VISIBILITY to some global variables. NFC
authorFangrui Song <i@maskray.me>
Sun, 2 Oct 2022 20:23:52 +0000 (13:23 -0700)
committerFangrui Song <i@maskray.me>
Sun, 2 Oct 2022 20:23:52 +0000 (13:23 -0700)
lld/ELF/InputSection.h
lld/ELF/LinkerScript.h
lld/ELF/OutputSections.h
lld/ELF/Symbols.h
lld/ELF/SyntheticSections.h
lld/ELF/Target.h

index ce1cdc7..0663b27 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/TinyPtrVector.h"
 #include "llvm/Object/ELF.h"
+#include "llvm/Support/Compiler.h"
 
 namespace lld {
 namespace elf {
@@ -30,7 +31,7 @@ class SyntheticSection;
 template <class ELFT> class ObjFile;
 class OutputSection;
 
-extern std::vector<Partition> partitions;
+LLVM_LIBRARY_VISIBILITY extern std::vector<Partition> partitions;
 
 // Returned by InputSectionBase::relsOrRelas. At least one member is empty.
 template <class ELFT> struct RelsOrRelas {
index 614e868..f50b6c4 100644 (file)
@@ -17,6 +17,7 @@
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/Support/Compiler.h"
 #include <cstddef>
 #include <cstdint>
 #include <functional>
@@ -362,7 +363,7 @@ public:
   SmallVector<const InputSectionBase *, 0> orphanSections;
 };
 
-extern std::unique_ptr<LinkerScript> script;
+LLVM_LIBRARY_VISIBILITY extern std::unique_ptr<LinkerScript> script;
 
 } // end namespace lld::elf
 
index 2ba8652..f7f5dc3 100644 (file)
@@ -12,6 +12,7 @@
 #include "InputSection.h"
 #include "LinkerScript.h"
 #include "lld/Common/LLVM.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Parallel.h"
 
 #include <array>
@@ -156,7 +157,8 @@ struct Out {
 
 uint64_t getHeaderSize();
 
-extern llvm::SmallVector<OutputSection *, 0> outputSections;
+LLVM_LIBRARY_VISIBILITY extern llvm::SmallVector<OutputSection *, 0>
+    outputSections;
 } // namespace lld::elf
 
 #endif
index 2d1b1d4..8fa3844 100644 (file)
@@ -18,6 +18,7 @@
 #include "lld/Common/Memory.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/Object/ELF.h"
+#include "llvm/Support/Compiler.h"
 #include <tuple>
 
 namespace lld {
@@ -64,7 +65,7 @@ struct SymbolAux {
   uint32_t tlsGdIdx = -1;
 };
 
-extern SmallVector<SymbolAux, 0> symAux;
+LLVM_LIBRARY_VISIBILITY extern SmallVector<SymbolAux, 0> symAux;
 
 // The base class for real symbol classes.
 class Symbol {
index a09477e..e2f719a 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/MC/StringTableBuilder.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/Endian.h"
 #include "llvm/Support/Parallel.h"
 #include "llvm/Support/Threading.h"
@@ -1262,7 +1263,7 @@ struct Partition {
   unsigned getNumber() const { return this - &partitions[0] + 1; }
 };
 
-extern Partition *mainPart;
+LLVM_LIBRARY_VISIBILITY extern Partition *mainPart;
 
 inline Partition &SectionBase::getPartition() const {
   assert(isLive());
@@ -1300,7 +1301,7 @@ struct InStruct {
   void reset();
 };
 
-extern InStruct in;
+LLVM_LIBRARY_VISIBILITY extern InStruct in;
 
 } // namespace lld::elf
 
index 14b1f53..cfe2880 100644 (file)
@@ -13,6 +13,7 @@
 #include "InputSection.h"
 #include "lld/Common/ErrorHandler.h"
 #include "llvm/Object/ELF.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/MathExtras.h"
 #include <array>
 
@@ -238,7 +239,7 @@ public:
                        uint64_t secAddr, uint8_t *buf) const;
 };
 
-extern const TargetInfo *target;
+LLVM_LIBRARY_VISIBILITY extern const TargetInfo *target;
 TargetInfo *getTarget();
 
 template <class ELFT> bool isMipsPIC(const Defined *sym);