[lld] r275531 - Inline traceUndefined function.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 21:57:46 PDT 2016


Author: ruiu
Date: Thu Jul 14 23:57:46 2016
New Revision: 275531

URL: http://llvm.org/viewvc/llvm-project?rev=275531&view=rev
Log:
Inline traceUndefined function.

Modified:
    lld/trunk/ELF/InputFiles.cpp
    lld/trunk/ELF/InputFiles.h

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=275531&r1=275530&r2=275531&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Jul 14 23:57:46 2016
@@ -319,14 +319,6 @@ elf::ObjectFile<ELFT>::createInputSectio
   return new (IAlloc.Allocate()) InputSection<ELFT>(this, &Sec);
 }
 
-// Print the module names which reference the notified
-// symbols provided through -y or --trace-symbol option.
-template <class ELFT>
-void elf::ObjectFile<ELFT>::traceUndefined(StringRef Name) {
-  if (!Config->TraceSymbol.empty() && Config->TraceSymbol.count(Name))
-    outs() << getFilename(this) << ": reference to " << Name << "\n";
-}
-
 template <class ELFT> void elf::ObjectFile<ELFT>::initializeSymbols() {
   this->initStringTable();
   Elf_Sym_Range Syms = this->getElfSymbols(false);
@@ -365,7 +357,11 @@ SymbolBody *elf::ObjectFile<ELFT>::creat
 
   switch (Sym->st_shndx) {
   case SHN_UNDEF:
-    traceUndefined(Name);
+    // Handle --trace-symbol option. Prints out a log message
+    // if the current symbol is being watched. Useful for debugging.
+    if (!Config->TraceSymbol.empty() && Config->TraceSymbol.count(Name))
+      outs() << getFilename(this) << ": reference to " << Name << "\n";
+
     return elf::Symtab<ELFT>::X
         ->addUndefined(Name, Binding, Sym->st_other, Sym->getType(),
                        /*CanOmitFromDynSym*/ false, this)

Modified: lld/trunk/ELF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.h?rev=275531&r1=275530&r2=275531&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.h (original)
+++ lld/trunk/ELF/InputFiles.h Thu Jul 14 23:57:46 2016
@@ -143,8 +143,6 @@ public:
 
   const Elf_Shdr *getSymbolTable() const { return this->Symtab; };
 
-  void traceUndefined(StringRef Name);
-
   // Get MIPS GP0 value defined by this file. This value represents the gp value
   // used to create the relocatable object and required to support
   // R_MIPS_GPREL16 / R_MIPS_GPREL32 relocations.




More information about the llvm-commits mailing list