[llvm] r206773 - Revert "[rtdyld, c++11] Range'ify symbol table walking."

Jim Grosbach grosbach at apple.com
Mon Apr 21 12:33:10 PDT 2014


Bother. Forgot to edit the hash. That should be “This revers commit r206769.” Sorry about that.

-jim
On Apr 21, 2014, at 12:23 PM, Jim Grosbach <grosbach at apple.com> wrote:

> Author: grosbach
> Date: Mon Apr 21 14:23:59 2014
> New Revision: 206773
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=206773&view=rev
> Log:
> Revert "[rtdyld,c++11] Range'ify symbol table walking."
> 
> Tentative revert for
> http://lab.llvm.org:8011/builders/llvm-mips-linux/builds/8305.
> 
> This reverts commit c2a58efff07294fca724f89500538f2ddbcd12ff.
> 
> Modified:
>    llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
> 
> Modified: llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp?rev=206773&r1=206772&r2=206773&view=diff
> ==============================================================================
> --- llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp (original)
> +++ llvm/trunk/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp Mon Apr 21 14:23:59 2014
> @@ -53,7 +53,7 @@ void RuntimeDyldImpl::resolveRelocations
>     // symbol for the relocation is located.  The SectionID in the relocation
>     // entry provides the section to which the relocation will be applied.
>     uint64_t Addr = Sections[i].LoadAddress;
> -    DEBUG(dbgs() << "Resolving relocations Section " << i << "\t"
> +    DEBUG(dbgs() << "Resolving relocations Section #" << i << "\t"
>                  << format("%p", (uint8_t *)Addr) << "\n");
>     resolveRelocationList(Relocations[i], Addr);
>     Relocations.erase(i);
> @@ -131,23 +131,24 @@ ObjectImage *RuntimeDyldImpl::loadObject
> 
>   // Parse symbols
>   DEBUG(dbgs() << "Parse symbols:\n");
> -  for (const SymbolRef &Sym : Obj->symbols()) {
> +  for (symbol_iterator I = Obj->begin_symbols(), E = Obj->end_symbols(); I != E;
> +       ++I) {
>     object::SymbolRef::Type SymType;
>     StringRef Name;
> -    Check(Sym.getType(SymType));
> -    Check(Sym.getName(Name));
> +    Check(I->getType(SymType));
> +    Check(I->getName(Name));
> 
> -    uint32_t Flags = Sym.getFlags();
> +    uint32_t Flags = I->getFlags();
> 
>     bool IsCommon = Flags & SymbolRef::SF_Common;
>     if (IsCommon) {
>       // Add the common symbols to a list.  We'll allocate them all below.
>       uint32_t Align;
> -      Check(Sym.getAlignment(Align));
> +      Check(I->getAlignment(Align));
>       uint64_t Size = 0;
> -      Check(Sym.getSize(Size));
> +      Check(I->getSize(Size));
>       CommonSize += Size + Align;
> -      CommonSymbols[Sym] = CommonSymbolInfo(Size, Align);
> +      CommonSymbols[*I] = CommonSymbolInfo(Size, Align);
>     } else {
>       if (SymType == object::SymbolRef::ST_Function ||
>           SymType == object::SymbolRef::ST_Data ||
> @@ -156,8 +157,8 @@ ObjectImage *RuntimeDyldImpl::loadObject
>         StringRef SectionData;
>         bool IsCode;
>         section_iterator SI = Obj->end_sections();
> -        Check(getOffset(Sym, SectOffset));
> -        Check(Sym.getSection(SI));
> +        Check(getOffset(*I, SectOffset));
> +        Check(I->getSection(SI));
>         if (SI == Obj->end_sections())
>           continue;
>         Check(SI->getContents(SectionData));
> @@ -179,13 +180,14 @@ ObjectImage *RuntimeDyldImpl::loadObject
> 
>   // Parse and process relocations
>   DEBUG(dbgs() << "Parse relocations:\n");
> -  for (const SectionRef &Section : Obj->sections()) {
> +  for (section_iterator SI = Obj->begin_sections(), SE = Obj->end_sections();
> +       SI != SE; ++SI) {
>     unsigned SectionID = 0;
>     StubMap Stubs;
> -    section_iterator RelocatedSection = Section.getRelocatedSection();
> +    section_iterator RelocatedSection = SI->getRelocatedSection();
> 
> -    relocation_iterator I = Section.relocation_begin();
> -    relocation_iterator E = Section.relocation_end();
> +    relocation_iterator I = SI->relocation_begin();
> +    relocation_iterator E = SI->relocation_end();
> 
>     if (I == E && !ProcessAllSections)
>       continue;
> @@ -214,8 +216,9 @@ static uint64_t
> computeAllocationSizeForSections(std::vector<uint64_t> &SectionSizes,
>                                  uint64_t Alignment) {
>   uint64_t TotalSize = 0;
> -  for (uint64_t Size : SectionSizes) {
> -    uint64_t AlignedSize = (Size + Alignment - 1) / Alignment * Alignment;
> +  for (size_t Idx = 0, Cnt = SectionSizes.size(); Idx < Cnt; Idx++) {
> +    uint64_t AlignedSize =
> +        (SectionSizes[Idx] + Alignment - 1) / Alignment * Alignment;
>     TotalSize += AlignedSize;
>   }
>   return TotalSize;
> @@ -235,7 +238,10 @@ void RuntimeDyldImpl::computeTotalAllocS
> 
>   // Collect sizes of all sections to be loaded;
>   // also determine the max alignment of all sections
> -  for (const SectionRef &Section : Obj.sections()) {
> +  for (section_iterator SI = Obj.begin_sections(), SE = Obj.end_sections();
> +       SI != SE; ++SI) {
> +    const SectionRef &Section = *SI;
> +
>     bool IsRequired;
>     Check(Section.isRequiredForExecution(IsRequired));
> 
> @@ -318,12 +324,13 @@ unsigned RuntimeDyldImpl::computeSection
>   // necessary section allocation size in loadObject by walking all the sections
>   // once.
>   unsigned StubBufSize = 0;
> -  for (const SectionRef &Section : Obj.sections()) {
> -    section_iterator RelSecI = Section.getRelocatedSection();
> +  for (section_iterator SI = Obj.begin_sections(), SE = Obj.end_sections();
> +       SI != SE; ++SI) {
> +    section_iterator RelSecI = SI->getRelocatedSection();
>     if (!(RelSecI == Section))
>       continue;
> 
> -    for (const RelocationRef &Reloc : Section.relocations()) {
> +    for (const RelocationRef &Reloc : SI->relocations()) {
>       (void)Reloc;
>       StubBufSize += StubSize;
>     }
> @@ -362,11 +369,12 @@ void RuntimeDyldImpl::emitCommonSymbols(
>                << format("%p", Addr) << " DataSize: " << TotalSize << "\n");
> 
>   // Assign the address of each symbol
> -  for (const auto &Entry : CommonSymbols) {
> -    uint64_t Size = Entry.second.first;
> -    uint64_t Align = Entry.second.second;
> +  for (CommonSymbolMap::const_iterator it = CommonSymbols.begin(),
> +       itEnd = CommonSymbols.end(); it != itEnd; ++it) {
> +    uint64_t Size = it->second.first;
> +    uint64_t Align = it->second.second;
>     StringRef Name;
> -    Entry.first.getName(Name);
> +    it->first.getName(Name);
>     if (Align) {
>       // This symbol has an alignment requirement.
>       uint64_t AlignOffset = OffsetToAlignment((uint64_t)Addr, Align);
> @@ -375,7 +383,7 @@ void RuntimeDyldImpl::emitCommonSymbols(
>       DEBUG(dbgs() << "Allocating common symbol " << Name << " address "
>                    << format("%p\n", Addr));
>     }
> -    Obj.updateSymbolAddress(Entry.first, (uint64_t)Addr);
> +    Obj.updateSymbolAddress(it->first, (uint64_t)Addr);
>     SymbolTable[Name.data()] = SymbolLoc(SectionID, Offset);
>     Offset += Size;
>     Addr += Size;
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list