From 3d9b26b4ada8b87bfc7b4adcebd01a515f85d123 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Fri, 15 Jul 2016 04:57:46 +0000 Subject: [PATCH] Inline traceUndefined function. llvm-svn: 275531 --- lld/ELF/InputFiles.cpp | 14 +++++--------- lld/ELF/InputFiles.h | 2 -- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 4614e9ca017c..256a344b33ae 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -319,14 +319,6 @@ elf::ObjectFile::createInputSection(const Elf_Shdr &Sec) { return new (IAlloc.Allocate()) InputSection(this, &Sec); } -// Print the module names which reference the notified -// symbols provided through -y or --trace-symbol option. -template -void elf::ObjectFile::traceUndefined(StringRef Name) { - if (!Config->TraceSymbol.empty() && Config->TraceSymbol.count(Name)) - outs() << getFilename(this) << ": reference to " << Name << "\n"; -} - template void elf::ObjectFile::initializeSymbols() { this->initStringTable(); Elf_Sym_Range Syms = this->getElfSymbols(false); @@ -365,7 +357,11 @@ SymbolBody *elf::ObjectFile::createSymbolBody(const Elf_Sym *Sym) { 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::X ->addUndefined(Name, Binding, Sym->st_other, Sym->getType(), /*CanOmitFromDynSym*/ false, this) diff --git a/lld/ELF/InputFiles.h b/lld/ELF/InputFiles.h index 191318d81376..416e7cef7c4f 100644 --- a/lld/ELF/InputFiles.h +++ b/lld/ELF/InputFiles.h @@ -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.