diff 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
line wrap: on
line diff
--- a/lld/ELF/Symbols.h	Mon May 25 11:55:54 2020 +0900
+++ b/lld/ELF/Symbols.h	Tue Jun 08 06:07:14 2021 +0900
@@ -132,9 +132,11 @@
   // doesn't know the final contents of the symbol.
   uint8_t canInline : 1;
 
-  // Used by Undefined and SharedSymbol to track if there has been at least one
-  // undefined reference to the symbol. The binding may change to STB_WEAK if
-  // the first undefined reference from a non-shared object is weak.
+  // Used to track if there has been at least one undefined reference to the
+  // symbol. For Undefined and SharedSymbol, the binding may change to STB_WEAK
+  // if the first undefined reference from a non-shared object is weak.
+  //
+  // This is also used to retain __wrap_foo when foo is referenced.
   uint8_t referenced : 1;
 
   // True if this symbol is specified by --trace-symbol option.
@@ -178,6 +180,15 @@
 
   void parseSymbolVersion();
 
+  // Get the NUL-terminated version suffix ("", "@...", or "@@...").
+  //
+  // For @@, the name has been truncated by insert(). For @, the name has been
+  // truncated by Symbol::parseSymbolVersion().
+  const char *getVersionSuffix() const {
+    (void)getName();
+    return nameData + nameSize;
+  }
+
   bool isInGot() const { return gotIndex != -1U; }
   bool isInPlt() const { return pltIndex != -1U; }
 
@@ -212,13 +223,13 @@
   // non-lazy object causes a runtime error.
   void fetch() const;
 
-private:
   static bool isExportDynamic(Kind k, uint8_t visibility) {
     if (k == SharedKind)
       return visibility == llvm::ELF::STV_DEFAULT;
     return config->shared || config->exportDynamic;
   }
 
+private:
   void resolveUndefined(const Undefined &other);
   void resolveCommon(const CommonSymbol &other);
   void resolveDefined(const Defined &other);
@@ -567,7 +578,9 @@
 
 // A mapping from a symbol to an InputFile referencing it backward. Used by
 // --warn-backrefs.
-extern llvm::DenseMap<const Symbol *, const InputFile *> backwardReferences;
+extern llvm::DenseMap<const Symbol *,
+                      std::pair<const InputFile *, const InputFile *>>
+    backwardReferences;
 
 } // namespace elf
 } // namespace lld