Revert of r255626 "[ELF] - refactor of code in RelocationSection<ELFT>::writeTo()"

as it broke buildbot: 
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/17836/steps/build_Lld/logs/stdio
/Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:268:14: error: redefinition of 'Rel'
    unsigned Rel;   ^
/Users/buildslave/as-bldslv9/lld-x86_64-darwin13/llvm.src/tools/lld/ELF/OutputSections.cpp:241:34: note: previous definition is here
  for (const DynamicReloc<ELFT> &Rel : Relocs) {

That compiles fine on my MSVS 2015 thought.

llvm-svn: 255628
This commit is contained in:
George Rimar 2015-12-15 08:39:42 +00:00
parent 009c5d52e3
commit b076446368
1 changed files with 15 additions and 13 deletions

View File

@ -264,19 +264,21 @@ template <class ELFT> void RelocationSection<ELFT>::writeTo(uint8_t *Buf) {
bool LazyReloc = Body && Target->supportsLazyRelocations() &&
Target->relocNeedsPlt(Type, *Body);
unsigned Sym = CanBePreempted ? Body->getDynamicSymbolTableIndex() : 0;
unsigned Rel;
if (!CanBePreempted)
Rel = Target->getRelativeReloc();
else if (LazyReloc)
Rel = Target->getPltReloc();
else if (NeedsGot)
Rel = Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
else if (NeedsCopy)
Rel = Target->getCopyReloc();
else
Rel = Target->getDynReloc(Type);
P->setSymbolAndType(Sym, Rel, Config->Mips64EL);
if (CanBePreempted) {
unsigned GotReloc =
Body->isTLS() ? Target->getTlsGotReloc() : Target->getGotReloc();
if (NeedsGot)
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
LazyReloc ? Target->getPltReloc() : GotReloc,
Config->Mips64EL);
else
P->setSymbolAndType(Body->getDynamicSymbolTableIndex(),
NeedsCopy ? Target->getCopyReloc()
: Target->getDynReloc(Type),
Config->Mips64EL);
} else {
P->setSymbolAndType(0, Target->getRelativeReloc(), Config->Mips64EL);
}
if (NeedsGot) {
if (LazyReloc)