[PATCH] [lld][ELF] Fix non SHF_ALLOC sections.
    Michael Spencer 
    bigcheesegs at gmail.com
       
    Wed Sep 18 15:42:29 PDT 2013
    
    
  
================
Comment at: lib/ReaderWriter/ELF/Atoms.h:309-312
@@ -305,2 +308,6 @@
     case llvm::ELF::SHT_PROGBITS:
+      if (!(flags & llvm::ELF::SHF_ALLOC)) {
+        ret = typeNoAlloc;
+        break;
+      }
       flags &= ~llvm::ELF::SHF_ALLOC;
----------------
Shankar Kalpathi Easwaran wrote:
> isnt this already handled lines (288-290) ?
Ah, it should have all moved here.
================
Comment at: lib/ReaderWriter/ELF/DefaultLayout.h:832
@@ +831,3 @@
+      if (auto as = dyn_cast<AtomSection<ELFT>>(section)) {
+        uint64_t addr = -fileoffset;
+        section->assignVirtualAddress(addr);
----------------
Shankar Kalpathi Easwaran wrote:
> Why is addr set to -fileoffset ?
Because assignVirtualAddress starts at fileoffset, so we need to cancel it out.
http://llvm-reviews.chandlerc.com/D1680
    
    
More information about the llvm-commits
mailing list