Index: lld/trunk/ELF/Arch/MipsArchTree.cpp =================================================================== --- lld/trunk/ELF/Arch/MipsArchTree.cpp +++ lld/trunk/ELF/Arch/MipsArchTree.cpp @@ -166,17 +166,17 @@ {EF_MIPS_ARCH_2, EF_MIPS_ARCH_1}, }; -static bool isArchMatched(uint32_t New, uint32_t res) { - if (New == res) +static bool isArchMatched(uint32_t newFlags, uint32_t res) { + if (newFlags == res) return true; - if (New == EF_MIPS_ARCH_32 && isArchMatched(EF_MIPS_ARCH_64, res)) + if (newFlags == EF_MIPS_ARCH_32 && isArchMatched(EF_MIPS_ARCH_64, res)) return true; - if (New == EF_MIPS_ARCH_32R2 && isArchMatched(EF_MIPS_ARCH_64R2, res)) + if (newFlags == EF_MIPS_ARCH_32R2 && isArchMatched(EF_MIPS_ARCH_64R2, res)) return true; for (const auto &edge : archTree) { if (res == edge.child) { res = edge.parent; - if (res == New) + if (res == newFlags) return true; } } @@ -278,18 +278,18 @@ uint32_t ret = files[0].flags & (EF_MIPS_ARCH | EF_MIPS_MACH); for (const FileFlags &f : files.slice(1)) { - uint32_t New = f.flags & (EF_MIPS_ARCH | EF_MIPS_MACH); + uint32_t newFlags = f.flags & (EF_MIPS_ARCH | EF_MIPS_MACH); // Check ISA compatibility. - if (isArchMatched(New, ret)) + if (isArchMatched(newFlags, ret)) continue; - if (!isArchMatched(ret, New)) { + if (!isArchMatched(ret, newFlags)) { error("incompatible target ISA:\n>>> " + toString(files[0].file) + ": " + getFullArchName(ret) + "\n>>> " + toString(f.file) + ": " + - getFullArchName(New)); + getFullArchName(newFlags)); return 0; } - ret = New; + ret = newFlags; } return ret; } Index: lld/trunk/ELF/InputFiles.cpp =================================================================== --- lld/trunk/ELF/InputFiles.cpp +++ lld/trunk/ELF/InputFiles.cpp @@ -1475,10 +1475,10 @@ int c = objSym.getComdatIndex(); if (objSym.isUndefined() || (c != -1 && !keptComdats[c])) { - Undefined New(&f, name, binding, visibility, type); + Undefined newSym(&f, name, binding, visibility, type); if (canOmitFromDynSym) - New.exportDynamic = false; - return symtab->addSymbol(New); + newSym.exportDynamic = false; + return symtab->addSymbol(newSym); } if (objSym.isCommon()) @@ -1486,10 +1486,10 @@ CommonSymbol{&f, name, binding, visibility, STT_OBJECT, objSym.getCommonAlignment(), objSym.getCommonSize()}); - Defined New(&f, name, binding, visibility, type, 0, 0, nullptr); + Defined newSym(&f, name, binding, visibility, type, 0, 0, nullptr); if (canOmitFromDynSym) - New.exportDynamic = false; - return symtab->addSymbol(New); + newSym.exportDynamic = false; + return symtab->addSymbol(newSym); } template void BitcodeFile::parse() { Index: lld/trunk/ELF/LinkerScript.cpp =================================================================== --- lld/trunk/ELF/LinkerScript.cpp +++ lld/trunk/ELF/LinkerScript.cpp @@ -181,12 +181,12 @@ // write expressions like this: `alignment = 16; . = ALIGN(., alignment)`. uint64_t symValue = value.sec ? 0 : value.getValue(); - Defined New(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, symValue, - 0, sec); + Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, + symValue, 0, sec); Symbol *sym = symtab->insert(cmd->name); - sym->mergeProperties(New); - sym->replace(New); + sym->mergeProperties(newSym); + sym->replace(newSym); cmd->sym = cast(sym); } @@ -197,13 +197,13 @@ return; uint8_t visibility = cmd->hidden ? STV_HIDDEN : STV_DEFAULT; - Defined New(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0, - nullptr); + Defined newSym(nullptr, cmd->name, STB_GLOBAL, visibility, STT_NOTYPE, 0, 0, + nullptr); // We can't calculate final value right now. Symbol *sym = symtab->insert(cmd->name); - sym->mergeProperties(New); - sym->replace(New); + sym->mergeProperties(newSym); + sym->replace(newSym); cmd->sym = cast(sym); cmd->provide = false; Index: lld/trunk/ELF/SymbolTable.h =================================================================== --- lld/trunk/ELF/SymbolTable.h +++ lld/trunk/ELF/SymbolTable.h @@ -43,7 +43,7 @@ Symbol *insert(StringRef name); - Symbol *addSymbol(const Symbol &New); + Symbol *addSymbol(const Symbol &newSym); void scanVersionScript(); Index: lld/trunk/ELF/SymbolTable.cpp =================================================================== --- lld/trunk/ELF/SymbolTable.cpp +++ lld/trunk/ELF/SymbolTable.cpp @@ -83,9 +83,9 @@ return sym; } -Symbol *SymbolTable::addSymbol(const Symbol &New) { - Symbol *sym = symtab->insert(New.getName()); - sym->resolve(New); +Symbol *SymbolTable::addSymbol(const Symbol &newSym) { + Symbol *sym = symtab->insert(newSym.getName()); + sym->resolve(newSym); return sym; } Index: lld/trunk/ELF/Symbols.h =================================================================== --- lld/trunk/ELF/Symbols.h +++ lld/trunk/ELF/Symbols.h @@ -135,7 +135,7 @@ // True if this symbol is specified by --trace-symbol option. unsigned traced : 1; - inline void replace(const Symbol &New); + inline void replace(const Symbol &newSym); bool includeInDynsym() const; uint8_t computeBinding() const; @@ -511,7 +511,7 @@ // replace() replaces "this" object with a given symbol by memcpy'ing // it over to "this". This function is called as a result of name // resolution, e.g. to replace an undefind symbol with a defined symbol. -void Symbol::replace(const Symbol &New) { +void Symbol::replace(const Symbol &newSym) { using llvm::ELF::STT_TLS; // Symbols representing thread-local variables must be referenced by @@ -519,16 +519,13 @@ // non-TLS relocations, so there's a clear distinction between TLS // and non-TLS symbols. It is an error if the same symbol is defined // as a TLS symbol in one file and as a non-TLS symbol in other file. - if (symbolKind != PlaceholderKind && !isLazy() && !New.isLazy()) { - bool tlsMismatch = (type == STT_TLS && New.type != STT_TLS) || - (type != STT_TLS && New.type == STT_TLS); - if (tlsMismatch) - error("TLS attribute mismatch: " + toString(*this) + "\n>>> defined in " + - toString(New.file) + "\n>>> defined in " + toString(file)); - } + if (symbolKind != PlaceholderKind && !isLazy() && !newSym.isLazy() && + (type == STT_TLS) != (newSym.type == STT_TLS)) + error("TLS attribute mismatch: " + toString(*this) + "\n>>> defined in " + + toString(newSym.file) + "\n>>> defined in " + toString(file)); Symbol old = *this; - memcpy(this, &New, New.getSymbolSize()); + memcpy(this, &newSym, newSym.getSymbolSize()); versionId = old.versionId; visibility = old.visibility;