Skip to content
  1. Nov 10, 2016
    • Rafael Espindola's avatar
      Parse relocations only once. · 9f0c4bb7
      Rafael Espindola authored
      Relocations are the last thing that we wore storing a raw section
      pointer to and parsing on demand.
      
      With this patch we parse it only once and store a pointer to the
      actual data.
      
      The patch also changes where we store it. It is now in
      InputSectionBase. Not all sections have relocations, but most do and
      this simplifies the logic. It also means that we now only support one
      relocation section per section. Given that that constraint is
      maintained even with -r with gold bfd and lld, I think it is OK.
      
      llvm-svn: 286459
      9f0c4bb7
  2. Nov 08, 2016
  3. Nov 05, 2016
    • Rui Ueyama's avatar
      Create a vector containing all input sections. · 8c6a5aaf
      Rui Ueyama authored
      Previously, we do this piece of code to iterate over all input sections.
      
        for (elf::ObjectFile<ELFT> *F : Symtab.getObjectFiles())
          for (InputSectionBase<ELFT> *S : F->getSections())
      
      It turned out that this mechanisms doesn't work well with synthetic
      input sections because synthetic input sections don't belong to any
      input file.
      
      This patch defines a vector that contains all input sections including
      synthetic ones.
      
      llvm-svn: 286051
      8c6a5aaf
  4. Nov 03, 2016
  5. Oct 26, 2016
  6. Oct 25, 2016
    • Rafael Espindola's avatar
      Delete getSectionHdr. · 58139d17
      Rafael Espindola authored
      We were fairly inconsistent as to what information should be accessed
      with getSectionHdr and what information (like alignment) was stored
      elsewhere.
      
      Now all section info has a dedicated getter. The code is also a bit
      more compact.
      
      llvm-svn: 285079
      58139d17
  7. Oct 20, 2016
  8. Oct 10, 2016
    • Peter Smith's avatar
      [ELF][ARM] Garbage collection support for .ARM.exidx sections · 0760605a
      Peter Smith authored
      .ARM.exidx sections have a reverse dependency on the section they have
      a SHF_LINK_ORDER dependency on. In other words a .ARM.exidx section is
      live only if the executable section it describes is live. We implement
      this with a reverse dependency field in InputSection.
      
      Adding the dependency to InputSection is the simplest implementation
      but it could be moved out to a separate map if it were found to decrease
      performance for non ARM targets.
      
      Differential revision: https://reviews.llvm.org/D25234
      
      llvm-svn: 283734
      0760605a
  9. Oct 05, 2016
  10. Oct 04, 2016
  11. Sep 29, 2016
  12. Sep 27, 2016
    • George Rimar's avatar
      [ELF] - Fixed linkage error when using -g --gc-sections together. · 74661eb0
      George Rimar authored
      r282444 introduced new issue, sample program below
      fails to link on
      
      assert(Piece.Live);
      int main() { return 0; }
      clang test.cpp -c -o out.o -g
      ld.lld -flavor gnu --gc-sections out.o -o out
      
      Problem is that .debug_info contains relocations to .debug_str:
      Section (7) .rela.debug_info {
      ..
      
      0xC R_X86_64_32 .debug_str 0x0
      0x12 R_X86_64_32 .debug_str 0x37
      ..
      But we do not preserve .debug_str in a right way now.
      
      To fix this we should ignore relocations from non-allocatable sections to allocatable
      to allow GC work at full power, but still should proccess relocations from non-allocatable to non-allocatable sections
      as usual to mark some parts of debug sections alive to keep them so we do not end 
      up with such assert when trying to access dead pieces. That looks like what gold/ld do, they do 
      not strip .debug_str section from what I saw using sample provided.
      
      Thanks to Evgeny Leviant for suggestions about how to fix this.
      
      Differential revision: https://reviews.llvm.org/D24967
      
      llvm-svn: 282495
      74661eb0
  13. Sep 26, 2016
  14. Sep 22, 2016
  15. Sep 14, 2016
    • Rui Ueyama's avatar
      Simplify InputFile ownership management. · 38dbd3ee
      Rui Ueyama authored
      Previously, all input files were owned by the symbol table.
      Files were created at various places, such as the Driver, the lazy
      symbols, or the bitcode compiler, and the ownership of new files
      was transferred to the symbol table using std::unique_ptr.
      All input files were then free'd when the symbol table is freed
      which is on program exit.
      
      I think we don't have to transfer ownership just to free all
      instance at once on exit.
      
      In this patch, all instances are automatically collected to a
      vector and freed on exit. In this way, we no longer have to
      use std::unique_ptr.
      
      Differential Revision: https://reviews.llvm.org/D24493
      
      llvm-svn: 281425
      38dbd3ee
  16. Sep 13, 2016
  17. Sep 12, 2016
  18. Sep 08, 2016
    • Rafael Espindola's avatar
      Compute section names only once. · 042a3f20
      Rafael Espindola authored
      This simplifies error handling as there is now only one place in the
      code that needs to consider the possibility that the name is
      corrupted. Before we would do it in every access.
      
      llvm-svn: 280937
      042a3f20
  19. Aug 06, 2016
  20. Jul 21, 2016
    • Rafael Espindola's avatar
      Fix PR28575. · 2deeb609
      Rafael Espindola authored
      Not all relocations from a .eh_frame that point to an executable
      section should be ignored. In particular, the relocation finding the
      personality function should not.
      
      This is a reduction from trying to bootstrap a static lld on linux.
      
      llvm-svn: 276329
      2deeb609
  21. Jul 18, 2016
  22. Jul 02, 2016
  23. May 24, 2016
  24. May 23, 2016
    • Rui Ueyama's avatar
      Do not split mergeable sections if they are gc'ed. · b91bf1a9
      Rui Ueyama authored
      Previously, mergeable section's constructors did more than just
      setting member variables; it split section contents into small
      pieces. It is not always computationally cheap task because if
      the section is a mergeable string section, it needs to scan the
      entire section to split them by NUL characters.
      
      If a section would be thrown away by GC, that cost ended up
      being a waste of time. It is going to be larger problem if the
      section is compressed -- the whole time to uncompress it and
      split it up is going to be a waste.
      
      Luckily, we can defer section splitting after GC. We just have
      to remember which offsets are in use during GC and apply that later.
      This patch implements it.
      
      Differential Revision: http://reviews.llvm.org/D20516
      
      llvm-svn: 270455
      b91bf1a9
  25. May 22, 2016
    • Rui Ueyama's avatar
      Simplify SplitInputSection::getRangeAndSize. · 90fa3722
      Rui Ueyama authored
      This patch adds Size member to SectionPiece so that getRangeAndSize
      can just return a SectionPiece instead of a std::pair<SectionPiece *, uint_t>.
      Also renamed the function.
      
      llvm-svn: 270346
      90fa3722
    • Rui Ueyama's avatar
      Define SectionPiece and use it instead of std::pair<uint_t, uint_t>. · 3ea87271
      Rui Ueyama authored
      We were using std::pair to represents pieces of splittable section
      contents. It hurt readability because "first" and "second" are not
      meaningful. This patch give them names.
      
      One more thing is that piecewise liveness information is stored to
      the second element of the pair as a special value of output section
      offset. It was confusing, so I defiend a new bit, "Live", in the
      new struct.
      
      llvm-svn: 270340
      3ea87271
  26. May 05, 2016
    • Rafael Espindola's avatar
      Fix --gc-sections when .eh_frame has a lsda. · d89fbca2
      Rafael Espindola authored
      We have to add sections to the work list, not just mark them live.
      
      llvm-svn: 268628
      d89fbca2
    • Peter Collingbourne's avatar
      ELF: Do not use -1 to mark pieces of merge sections as being tail merged. · e29e142a
      Peter Collingbourne authored
      We were previously using an output offset of -1 for both GC'd and tail
      merged pieces. We need to distinguish these two cases in order to filter
      GC'd symbols from the symbol table -- we were previously asserting when we
      asked for the VA of a symbol pointing into a dead piece, which would end
      up asking the tail merging string table for an offset even though we hadn't
      initialized it properly.
      
      This patch fixes the bug by using an offset of -1 to exclusively mean GC'd
      pieces, using 0 for tail merges, and distinguishing the tail merge case from
      an offset of 0 by asking the output section whether it is tail merge.
      
      Differential Revision: http://reviews.llvm.org/D19953
      
      llvm-svn: 268604
      e29e142a
  27. May 02, 2016
  28. May 01, 2016
    • Peter Collingbourne's avatar
      ELF: New symbol table design. · 4f952706
      Peter Collingbourne authored
      This patch implements a new design for the symbol table that stores
      SymbolBodies within a memory region of the Symbol object. Symbols are mutated
      by constructing SymbolBodies in place over existing SymbolBodies, rather
      than by mutating pointers. As mentioned in the initial proposal [1], this
      memory layout helps reduce the cache miss rate by improving memory locality.
      
      Performance numbers:
      
                 old(s) new(s)
      Without debug info:
      chrome      7.178  6.432 (-11.5%)
      LLVMgold.so 0.505  0.502 (-0.5%)
      clang       0.954  0.827 (-15.4%)
      llvm-as     0.052  0.045 (-15.5%)
      With debug info:
      scylla      5.695  5.613 (-1.5%)
      clang      14.396 14.143 (-1.8%)
      
      Performance counter results show that the fewer required indirections is
      indeed the cause of the improved performance. For example, when linking
      chrome, stalled cycles decreases from 14,556,444,002 to 12,959,238,310, and
      instructions per cycle increases from 0.78 to 0.83. We are also executing
      many fewer instructions (15,516,401,933 down to 15,002,434,310), probably
      because we spend less time allocating SymbolBodies.
      
      The new mechanism by which symbols are added to the symbol table is by calling
      add* functions on the SymbolTable.
      
      In this patch, I handle local symbols by storing them inside "unparented"
      SymbolBodies. This is suboptimal, but if we do want to try to avoid allocating
      these SymbolBodies, we can probably do that separately.
      
      I also removed a few members from the SymbolBody class that were only being
      used to pass information from the input file to the symbol table.
      
      This patch implements the new design for the ELF linker only. I intend to
      prepare a similar patch for the COFF linker.
      
      [1] http://lists.llvm.org/pipermail/llvm-dev/2016-April/098832.html
      
      Differential Revision: http://reviews.llvm.org/D19752
      
      llvm-svn: 268178
      4f952706
  29. Apr 27, 2016
  30. Apr 26, 2016
  31. Apr 23, 2016
    • Rafael Espindola's avatar
      Bring r267164 back with a fix. · 0b9531c8
      Rafael Espindola authored
      The fix is to handle local symbols referring to SHF_MERGE sections.
      
      Original message:
      
      GC entries of SHF_MERGE sections.
      
      It is a fairly direct extension of the gc algorithm. For merge sections
      instead of remembering just a live bit, we remember which offsets
      were used.
      
      This reduces the .rodata sections in chromium from 9648861 to 9477472
      bytes.
      
      llvm-svn: 267233
      0b9531c8
Loading