Mercurial > hg > CbC > CbC_llvm
comparison lld/ELF/Symbols.h @ 207:2e18cbf3894f
LLVM12
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 08 Jun 2021 06:07:14 +0900 |
parents | 0572611fdcc8 |
children | c4bab56944e8 |
comparison
equal
deleted
inserted
replaced
173:0572611fdcc8 | 207:2e18cbf3894f |
---|---|
130 // False if LTO shouldn't inline whatever this symbol points to. If a symbol | 130 // False if LTO shouldn't inline whatever this symbol points to. If a symbol |
131 // is overwritten after LTO, LTO shouldn't inline the symbol because it | 131 // is overwritten after LTO, LTO shouldn't inline the symbol because it |
132 // doesn't know the final contents of the symbol. | 132 // doesn't know the final contents of the symbol. |
133 uint8_t canInline : 1; | 133 uint8_t canInline : 1; |
134 | 134 |
135 // Used by Undefined and SharedSymbol to track if there has been at least one | 135 // Used to track if there has been at least one undefined reference to the |
136 // undefined reference to the symbol. The binding may change to STB_WEAK if | 136 // symbol. For Undefined and SharedSymbol, the binding may change to STB_WEAK |
137 // the first undefined reference from a non-shared object is weak. | 137 // if the first undefined reference from a non-shared object is weak. |
138 // | |
139 // This is also used to retain __wrap_foo when foo is referenced. | |
138 uint8_t referenced : 1; | 140 uint8_t referenced : 1; |
139 | 141 |
140 // True if this symbol is specified by --trace-symbol option. | 142 // True if this symbol is specified by --trace-symbol option. |
141 uint8_t traced : 1; | 143 uint8_t traced : 1; |
142 | 144 |
175 nameData = s.data(); | 177 nameData = s.data(); |
176 nameSize = s.size(); | 178 nameSize = s.size(); |
177 } | 179 } |
178 | 180 |
179 void parseSymbolVersion(); | 181 void parseSymbolVersion(); |
182 | |
183 // Get the NUL-terminated version suffix ("", "@...", or "@@..."). | |
184 // | |
185 // For @@, the name has been truncated by insert(). For @, the name has been | |
186 // truncated by Symbol::parseSymbolVersion(). | |
187 const char *getVersionSuffix() const { | |
188 (void)getName(); | |
189 return nameData + nameSize; | |
190 } | |
180 | 191 |
181 bool isInGot() const { return gotIndex != -1U; } | 192 bool isInGot() const { return gotIndex != -1U; } |
182 bool isInPlt() const { return pltIndex != -1U; } | 193 bool isInPlt() const { return pltIndex != -1U; } |
183 | 194 |
184 uint64_t getVA(int64_t addend = 0) const; | 195 uint64_t getVA(int64_t addend = 0) const; |
210 // If this is a lazy symbol, fetch an input file and add the symbol | 221 // If this is a lazy symbol, fetch an input file and add the symbol |
211 // in the file to the symbol table. Calling this function on | 222 // in the file to the symbol table. Calling this function on |
212 // non-lazy object causes a runtime error. | 223 // non-lazy object causes a runtime error. |
213 void fetch() const; | 224 void fetch() const; |
214 | 225 |
215 private: | |
216 static bool isExportDynamic(Kind k, uint8_t visibility) { | 226 static bool isExportDynamic(Kind k, uint8_t visibility) { |
217 if (k == SharedKind) | 227 if (k == SharedKind) |
218 return visibility == llvm::ELF::STV_DEFAULT; | 228 return visibility == llvm::ELF::STV_DEFAULT; |
219 return config->shared || config->exportDynamic; | 229 return config->shared || config->exportDynamic; |
220 } | 230 } |
221 | 231 |
232 private: | |
222 void resolveUndefined(const Undefined &other); | 233 void resolveUndefined(const Undefined &other); |
223 void resolveCommon(const CommonSymbol &other); | 234 void resolveCommon(const CommonSymbol &other); |
224 void resolveDefined(const Defined &other); | 235 void resolveDefined(const Defined &other); |
225 template <class LazyT> void resolveLazy(const LazyT &other); | 236 template <class LazyT> void resolveLazy(const LazyT &other); |
226 void resolveShared(const SharedSymbol &other); | 237 void resolveShared(const SharedSymbol &other); |
565 bool computeIsPreemptible(const Symbol &sym); | 576 bool computeIsPreemptible(const Symbol &sym); |
566 void reportBackrefs(); | 577 void reportBackrefs(); |
567 | 578 |
568 // A mapping from a symbol to an InputFile referencing it backward. Used by | 579 // A mapping from a symbol to an InputFile referencing it backward. Used by |
569 // --warn-backrefs. | 580 // --warn-backrefs. |
570 extern llvm::DenseMap<const Symbol *, const InputFile *> backwardReferences; | 581 extern llvm::DenseMap<const Symbol *, |
582 std::pair<const InputFile *, const InputFile *>> | |
583 backwardReferences; | |
571 | 584 |
572 } // namespace elf | 585 } // namespace elf |
573 } // namespace lld | 586 } // namespace lld |
574 | 587 |
575 #endif | 588 #endif |