forked from OSchip/llvm-project
				
			Avoid identifiers that are different only in case. NFC.
Some variables in lld have the same name as functions ignoring case. This patch gives them different names, so that my next patch is easier to read. llvm-svn: 365003
This commit is contained in:
		
							parent
							
								
									c22e772a28
								
							
						
					
					
						commit
						11ae59f0ce
					
				| 
						 | 
					@ -58,7 +58,7 @@ namespace {
 | 
				
			||||||
template <class RelTy> struct LLDRelocationResolver {
 | 
					template <class RelTy> struct LLDRelocationResolver {
 | 
				
			||||||
  // In the ELF ABIs, S sepresents the value of the symbol in the relocation
 | 
					  // In the ELF ABIs, S sepresents the value of the symbol in the relocation
 | 
				
			||||||
  // entry. For Rela, the addend is stored as part of the relocation entry.
 | 
					  // entry. For Rela, the addend is stored as part of the relocation entry.
 | 
				
			||||||
  static uint64_t Resolve(object::RelocationRef Ref, uint64_t S,
 | 
					  static uint64_t resolve(object::RelocationRef Ref, uint64_t S,
 | 
				
			||||||
                          uint64_t /* A */) {
 | 
					                          uint64_t /* A */) {
 | 
				
			||||||
    return S + Ref.getRawDataRefImpl().p;
 | 
					    return S + Ref.getRawDataRefImpl().p;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -66,7 +66,7 @@ template <class RelTy> struct LLDRelocationResolver {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class ELFT> struct LLDRelocationResolver<Elf_Rel_Impl<ELFT, false>> {
 | 
					template <class ELFT> struct LLDRelocationResolver<Elf_Rel_Impl<ELFT, false>> {
 | 
				
			||||||
  // For Rel, the addend A is supplied by the caller.
 | 
					  // For Rel, the addend A is supplied by the caller.
 | 
				
			||||||
  static uint64_t Resolve(object::RelocationRef /*Ref*/, uint64_t S,
 | 
					  static uint64_t resolve(object::RelocationRef /*Ref*/, uint64_t S,
 | 
				
			||||||
                          uint64_t A) {
 | 
					                          uint64_t A) {
 | 
				
			||||||
    return S + A;
 | 
					    return S + A;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -110,7 +110,7 @@ LLDDwarfObj<ELFT>::findAux(const InputSectionBase &Sec, uint64_t Pos,
 | 
				
			||||||
  DataRefImpl D;
 | 
					  DataRefImpl D;
 | 
				
			||||||
  D.p = getAddend<ELFT>(Rel);
 | 
					  D.p = getAddend<ELFT>(Rel);
 | 
				
			||||||
  return RelocAddrEntry{SecIndex, RelocationRef(D, nullptr),
 | 
					  return RelocAddrEntry{SecIndex, RelocationRef(D, nullptr),
 | 
				
			||||||
                        LLDRelocationResolver<RelTy>::Resolve, Val};
 | 
					                        LLDRelocationResolver<RelTy>::resolve, Val};
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class ELFT>
 | 
					template <class ELFT>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -55,7 +55,7 @@ static ELFKind getELFKind(MemoryBufferRef MB, StringRef ArchiveName) {
 | 
				
			||||||
  unsigned char Endian;
 | 
					  unsigned char Endian;
 | 
				
			||||||
  std::tie(Size, Endian) = getElfArchType(MB.getBuffer());
 | 
					  std::tie(Size, Endian) = getElfArchType(MB.getBuffer());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto Fatal = [&](StringRef Msg) {
 | 
					  auto Report = [&](StringRef Msg) {
 | 
				
			||||||
    StringRef Filename = MB.getBufferIdentifier();
 | 
					    StringRef Filename = MB.getBufferIdentifier();
 | 
				
			||||||
    if (ArchiveName.empty())
 | 
					    if (ArchiveName.empty())
 | 
				
			||||||
      fatal(Filename + ": " + Msg);
 | 
					      fatal(Filename + ": " + Msg);
 | 
				
			||||||
| 
						 | 
					@ -64,16 +64,16 @@ static ELFKind getELFKind(MemoryBufferRef MB, StringRef ArchiveName) {
 | 
				
			||||||
  };
 | 
					  };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (!MB.getBuffer().startswith(ElfMagic))
 | 
					  if (!MB.getBuffer().startswith(ElfMagic))
 | 
				
			||||||
    Fatal("not an ELF file");
 | 
					    Report("not an ELF file");
 | 
				
			||||||
  if (Endian != ELFDATA2LSB && Endian != ELFDATA2MSB)
 | 
					  if (Endian != ELFDATA2LSB && Endian != ELFDATA2MSB)
 | 
				
			||||||
    Fatal("corrupted ELF file: invalid data encoding");
 | 
					    Report("corrupted ELF file: invalid data encoding");
 | 
				
			||||||
  if (Size != ELFCLASS32 && Size != ELFCLASS64)
 | 
					  if (Size != ELFCLASS32 && Size != ELFCLASS64)
 | 
				
			||||||
    Fatal("corrupted ELF file: invalid file class");
 | 
					    Report("corrupted ELF file: invalid file class");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  size_t BufSize = MB.getBuffer().size();
 | 
					  size_t BufSize = MB.getBuffer().size();
 | 
				
			||||||
  if ((Size == ELFCLASS32 && BufSize < sizeof(Elf32_Ehdr)) ||
 | 
					  if ((Size == ELFCLASS32 && BufSize < sizeof(Elf32_Ehdr)) ||
 | 
				
			||||||
      (Size == ELFCLASS64 && BufSize < sizeof(Elf64_Ehdr)))
 | 
					      (Size == ELFCLASS64 && BufSize < sizeof(Elf64_Ehdr)))
 | 
				
			||||||
    Fatal("corrupted ELF file: file is too short");
 | 
					    Report("corrupted ELF file: file is too short");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Size == ELFCLASS32)
 | 
					  if (Size == ELFCLASS32)
 | 
				
			||||||
    return (Endian == ELFDATA2LSB) ? ELF32LEKind : ELF32BEKind;
 | 
					    return (Endian == ELFDATA2LSB) ? ELF32LEKind : ELF32BEKind;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -566,10 +566,10 @@ template <class ELFT> static void addCopyRelSymbol(SharedSymbol &SS) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // See if this symbol is in a read-only segment. If so, preserve the symbol's
 | 
					  // See if this symbol is in a read-only segment. If so, preserve the symbol's
 | 
				
			||||||
  // memory protection by reserving space in the .bss.rel.ro section.
 | 
					  // memory protection by reserving space in the .bss.rel.ro section.
 | 
				
			||||||
  bool IsReadOnly = isReadOnly<ELFT>(SS);
 | 
					  bool IsRO = isReadOnly<ELFT>(SS);
 | 
				
			||||||
  BssSection *Sec = make<BssSection>(IsReadOnly ? ".bss.rel.ro" : ".bss",
 | 
					  BssSection *Sec =
 | 
				
			||||||
                                     SymSize, SS.Alignment);
 | 
					      make<BssSection>(IsRO ? ".bss.rel.ro" : ".bss", SymSize, SS.Alignment);
 | 
				
			||||||
  if (IsReadOnly)
 | 
					  if (IsRO)
 | 
				
			||||||
    In.BssRelRo->getParent()->addSection(Sec);
 | 
					    In.BssRelRo->getParent()->addSection(Sec);
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    In.Bss->getParent()->addSection(Sec);
 | 
					    In.Bss->getParent()->addSection(Sec);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,14 +40,21 @@ using namespace llvm::support::endian;
 | 
				
			||||||
using namespace lld;
 | 
					using namespace lld;
 | 
				
			||||||
using namespace lld::elf;
 | 
					using namespace lld::elf;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool isUnderSysroot(StringRef Path);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace {
 | 
					namespace {
 | 
				
			||||||
class ScriptParser final : ScriptLexer {
 | 
					class ScriptParser final : ScriptLexer {
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  ScriptParser(MemoryBufferRef MB)
 | 
					  ScriptParser(MemoryBufferRef MB) : ScriptLexer(MB) {
 | 
				
			||||||
      : ScriptLexer(MB),
 | 
					    // Initialize IsUnderSysroot
 | 
				
			||||||
        IsUnderSysroot(isUnderSysroot(MB.getBufferIdentifier())) {}
 | 
					    if (Config->Sysroot == "")
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    StringRef Path = MB.getBufferIdentifier();
 | 
				
			||||||
 | 
					    for (; !Path.empty(); Path = sys::path::parent_path(Path)) {
 | 
				
			||||||
 | 
					      if (!sys::fs::equivalent(Config->Sysroot, Path))
 | 
				
			||||||
 | 
					        continue;
 | 
				
			||||||
 | 
					      IsUnderSysroot = true;
 | 
				
			||||||
 | 
					      return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void readLinkerScript();
 | 
					  void readLinkerScript();
 | 
				
			||||||
  void readVersionScript();
 | 
					  void readVersionScript();
 | 
				
			||||||
| 
						 | 
					@ -118,7 +125,7 @@ private:
 | 
				
			||||||
  readSymbols();
 | 
					  readSymbols();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // True if a script being read is in a subdirectory specified by -sysroot.
 | 
					  // True if a script being read is in a subdirectory specified by -sysroot.
 | 
				
			||||||
  bool IsUnderSysroot;
 | 
					  bool IsUnderSysroot = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // A set to detect an INCLUDE() cycle.
 | 
					  // A set to detect an INCLUDE() cycle.
 | 
				
			||||||
  StringSet<> Seen;
 | 
					  StringSet<> Seen;
 | 
				
			||||||
| 
						 | 
					@ -131,15 +138,6 @@ static StringRef unquote(StringRef S) {
 | 
				
			||||||
  return S;
 | 
					  return S;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static bool isUnderSysroot(StringRef Path) {
 | 
					 | 
				
			||||||
  if (Config->Sysroot == "")
 | 
					 | 
				
			||||||
    return false;
 | 
					 | 
				
			||||||
  for (; !Path.empty(); Path = sys::path::parent_path(Path))
 | 
					 | 
				
			||||||
    if (sys::fs::equivalent(Config->Sysroot, Path))
 | 
					 | 
				
			||||||
      return true;
 | 
					 | 
				
			||||||
  return false;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Some operations only support one non absolute value. Move the
 | 
					// Some operations only support one non absolute value. Move the
 | 
				
			||||||
// absolute one to the right hand side for convenience.
 | 
					// absolute one to the right hand side for convenience.
 | 
				
			||||||
static void moveAbsRight(ExprValue &A, ExprValue &B) {
 | 
					static void moveAbsRight(ExprValue &A, ExprValue &B) {
 | 
				
			||||||
| 
						 | 
					@ -1449,8 +1447,8 @@ std::vector<SymbolVersion> ScriptParser::readVersionExtern() {
 | 
				
			||||||
  std::vector<SymbolVersion> Ret;
 | 
					  std::vector<SymbolVersion> Ret;
 | 
				
			||||||
  while (!errorCount() && peek() != "}") {
 | 
					  while (!errorCount() && peek() != "}") {
 | 
				
			||||||
    StringRef Tok = next();
 | 
					    StringRef Tok = next();
 | 
				
			||||||
    bool HasWildcard = !Tok.startswith("\"") && hasWildcard(Tok);
 | 
					    Ret.push_back(
 | 
				
			||||||
    Ret.push_back({unquote(Tok), IsCXX, HasWildcard});
 | 
					        {unquote(Tok), IsCXX, !Tok.startswith("\"") && hasWildcard(Tok)});
 | 
				
			||||||
    if (consume("}"))
 | 
					    if (consume("}"))
 | 
				
			||||||
      return Ret;
 | 
					      return Ret;
 | 
				
			||||||
    expect(";");
 | 
					    expect(";");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -317,18 +317,18 @@ void elf::maybeWarnUnorderableSymbol(const Symbol *Sym) {
 | 
				
			||||||
  const InputFile *File = Sym->File;
 | 
					  const InputFile *File = Sym->File;
 | 
				
			||||||
  auto *D = dyn_cast<Defined>(Sym);
 | 
					  auto *D = dyn_cast<Defined>(Sym);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  auto Warn = [&](StringRef S) { warn(toString(File) + S + Sym->getName()); };
 | 
					  auto Report = [&](StringRef S) { warn(toString(File) + S + Sym->getName()); };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (Sym->isUndefined())
 | 
					  if (Sym->isUndefined())
 | 
				
			||||||
    Warn(": unable to order undefined symbol: ");
 | 
					    Report(": unable to order undefined symbol: ");
 | 
				
			||||||
  else if (Sym->isShared())
 | 
					  else if (Sym->isShared())
 | 
				
			||||||
    Warn(": unable to order shared symbol: ");
 | 
					    Report(": unable to order shared symbol: ");
 | 
				
			||||||
  else if (D && !D->Section)
 | 
					  else if (D && !D->Section)
 | 
				
			||||||
    Warn(": unable to order absolute symbol: ");
 | 
					    Report(": unable to order absolute symbol: ");
 | 
				
			||||||
  else if (D && isa<OutputSection>(D->Section))
 | 
					  else if (D && isa<OutputSection>(D->Section))
 | 
				
			||||||
    Warn(": unable to order synthetic symbol: ");
 | 
					    Report(": unable to order synthetic symbol: ");
 | 
				
			||||||
  else if (D && !D->Section->Repl->isLive())
 | 
					  else if (D && !D->Section->Repl->isLive())
 | 
				
			||||||
    Warn(": unable to order discarded symbol: ");
 | 
					    Report(": unable to order discarded symbol: ");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Returns a symbol for an error message.
 | 
					// Returns a symbol for an error message.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue