Skip to content
  1. Oct 12, 2017
    • Rui Ueyama's avatar
      Rename P -> Pieces. · 36d8db42
      Rui Ueyama authored
      Conventionally, an array of SectionPieces is named Pieces.
      It is better to follow the convention.
      
      llvm-svn: 315543
      36d8db42
    • Rui Ueyama's avatar
      Define RelType to represent relocation types. · 67533a2c
      Rui Ueyama authored
      We were using uint32_t as the type of relocation kind. It has a
      readability issue because what Type really means in `uint32_t Type`
      is not obvious. It could be a section type, a symbol type or a
      relocation type.
      
      Since we do not do any arithemetic operations on relocation types
      (e.g. adding one to R_X86_64_PC32 doesn't make sense), it would be
      more natural if they are represented as enums. Unfortunately, that
      is not doable because relocation type definitions are spread into
      multiple header files.
      
      So I decided to use typedef. This still should be better than the
      plain uint32_t because the intended type is now obvious.
      
      llvm-svn: 315525
      67533a2c
  2. Oct 11, 2017
  3. Oct 04, 2017
  4. Sep 19, 2017
  5. Sep 15, 2017
    • Rafael Espindola's avatar
      Keep some relocations with undefined weak symbols. · e05e2f8b
      Rafael Espindola authored
      This fixes pr34301.
      
      As the bug points out, we want to keep some relocations with undefined
      weak symbols. This means that we cannot always claim that these
      symbols are not preemptible as we do now.
      
      Unfortunately, we cannot also just always claim that they are
      preemptible. Doing so would, for example, cause us to try to create a
      plt entry when we don't even have a dynamic symbol table.
      
      What almost works is to say that weak undefined symbols are
      preemptible if and only if we have a dynamic symbol table. Almost
      because we don't want to fail the build trying to create a copy
      relocation to a weak undefined.
      
      llvm-svn: 313372
      e05e2f8b
  6. Sep 13, 2017
  7. Sep 12, 2017
  8. Aug 29, 2017
  9. Aug 24, 2017
    • Simon Atanasyan's avatar
      [MIPS] Keep all code read addends in the `getImplicitAddend` function · c5455e23
      Simon Atanasyan authored
      Currently LLD reads the R_MIPS_HI16's addends in the `computeMipsAddend`
      function, the R_MIPS_LO16's addends in both `computeMipsAddend` and
      `getImplicitAddend` functions. This patch moves reading all addends to
      the `getImplicitAddend` function. As a side effect it fixes a "paired"
      HI16/LO16 addend calculation if "LO16" part of a pair is not found.
      
      llvm-svn: 311711
      c5455e23
  10. Aug 10, 2017
    • Rafael Espindola's avatar
      Compute isPreemtible only once. · 35c908f2
      Rafael Espindola authored
      This is probably a small optimization, but the main motivation is
      having a way of fixing pr34053 that doesn't require a hash lookup in
      isPreempitible.
      
      llvm-svn: 310602
      35c908f2
  11. Aug 05, 2017
    • Rafael Espindola's avatar
      Move File from SymbolBody to Symbol. · 6e93d054
      Rafael Espindola authored
      With this Symbol has the same size as before, but DefinedRegular goes
      from 72 to 64 bytes.
      
      I also find this a bit easier to read. There are fewer places
      initializing File for example.
      
      This has a small but measurable speed improvement on all tests (1%
      max).
      
      llvm-svn: 310142
      6e93d054
  12. Aug 04, 2017
  13. Aug 02, 2017
    • Rafael Espindola's avatar
      Use more consistent names · 3a8e4d98
      Rafael Espindola authored
      Reviewing another change I noticed that we use "getSymbols" to mean
      different things in different files. Depending on the file it can
      return
      
      ArrayRef<StringRef>
      ArrayRef<SymbolBody*>
      ArrayRef<Symbol*>
      ArrayRef<Elf_Sym>
      
      With this change it always returns an ArrayRef<SymbolBody*>. The other
      functions are renamed getELFsyms() and getSymbolNames().
      
      Note that we cannot return ArrayRef<Symbol*> instead of
      ArreyRef<SymbolBody*> because local symbols have a SymbolBody but not
      a Symbol.
      
      llvm-svn: 309840
      3a8e4d98
  14. Jul 27, 2017
    • Rafael Espindola's avatar
      Merge OutputSectionCommand and OutputSection. · 8c022ca7
      Rafael Espindola authored
      This is a bit of a hack, but it is *so* convenient.
      
      Now that we create synthetic linker scripts when none is provided, we
      always have to handle paired OutputSection and OutputsectionCommand and
      keep a mapping from one to the other.
      
      This patch simplifies things by merging them and creating what used to
      be OutputSectionCommands really early.
      
      llvm-svn: 309311
      8c022ca7
  15. Jul 26, 2017
  16. Jul 18, 2017
  17. Jul 15, 2017
  18. Jul 14, 2017
  19. Jul 06, 2017
  20. Jul 05, 2017
    • Peter Smith's avatar
      [ELF] Fix Windows build error · 283b9f2d
      Peter Smith authored
      Attempt to fix Windows buildbots From 307131 Replaced return {ET, false};
      with return std::make_pair(ET, false);
      
      llvm-svn: 307137
      283b9f2d
    • Peter Smith's avatar
      [ELF] Allow multiple thunks to be added for a symbol. · fa237642
      Peter Smith authored
      This change permits there to be more than one thunk to be associated with
      a symbol. For interworking thunks we only require one thunk, but range
      extension thunks may require more than one.
      
      Differential Revision: https://reviews.llvm.org/D34037
      
      llvm-svn: 307136
      fa237642
    • Peter Smith's avatar
      [ELF] Introduce Thunk reuse compatibility · 7d66e849
      Peter Smith authored
      On ARM the interworking thunks are only produced for branch instructions
      that can't be changed into a blx instruction so only Thumb callers would
      call Thumb thunks and only ARM callers would call ARM thunks. With range
      extension thunks branch and link instructions may need a Thunk. These
      instructions can be rewritten as a blx and can use either ARM or Thumb
      thunks.
      
      We introduce an isCompatibleWith() function so that a caller can check if
      an existing Thunk is compatible before reusing it.
      
      Differential Revision: https://reviews.llvm.org/D34035
      
      llvm-svn: 307132
      7d66e849
  21. Jul 04, 2017
  22. Jun 26, 2017
    • Peter Smith's avatar
      [ELF] Define _GLOBAL_OFFSET_TABLE_ symbol relative to .got · 113a59e7
      Peter Smith authored
      On many architectures gcc and clang will recognize _GLOBAL_OFFSET_TABLE_ - .
      and produce a relocation that can be processed without needing to know the
      value of _GLOBAL_OFFSET_TABLE_. This is not always the case; for example ARM
      gcc produces R_ARM_BASE_PREL but clang produces the more general
      R_ARM_REL32 to _GLOBAL_OFFSET_TABLE_. To evaluate this relocation
      correctly _GLOBAL_OFFSET_TABLE_ must be defined to be the either the base of
      the GOT or end of the GOT dependent on architecture..
      
      If/when llvm-mc is changed to recognize _GLOBAL_OFFSET_TABLE_ - . this
      change will not be necessary for new objects. However there may still be
      old objects and versions of clang.
      
      Differential Revision: https://reviews.llvm.org/D34355
      
      llvm-svn: 306282
      113a59e7
  23. Jun 16, 2017
    • Peter Smith's avatar
      [ELF] Enable createThunks to be called more than once. · 32980279
      Peter Smith authored
          
      In preparation for supporting range extension thunks we now continually
      call createThunks() until no more thunks are added. This requires us to
      record the thunks we add on each pass and only merge the new ones into the
      OutputSection. We also need to check if a Relocation is targeting a thunk
      to prevent us from infinitely creating more thunks.
          
      Differential Revision: https://reviews.llvm.org/D34034
      
      llvm-svn: 305555
      32980279
  24. Jun 08, 2017
  25. Jun 07, 2017
    • Peter Smith's avatar
      [ELF] Convert Thunks to use InputSectionDescriptions · 8e791463
      Peter Smith authored
      Thunks are now generated per InputSectionDescription instead of per
      OutputSection. This allows created ThunkSections to be inserted directly
      into InputSectionDescription.
      
      Changes in this patch:
      - Loop over InputSectionDescriptions to find relocations to Thunks
      - Generate a ThunkSection per InputSectionDescription
      - Remove synchronize() as we no longer need it
      - Move fabricateDefaultCommands() before createThunks
      
      Differential Revision: https://reviews.llvm.org/D33835
      
      llvm-svn: 304887
      8e791463
  26. Jun 06, 2017
  27. Jun 01, 2017
    • George Rimar's avatar
      [ELF] - Properly handle R_386_GOTPC relocation. · d6029872
      George Rimar authored
      This is PR33243. R_GOTONLY_PC_FROM_END was not in a list of link time constant
      expressions and that was a result of confusiing messages like PR shows:
      
      /usr/bin/ld.lld: error: /usr/lib/go/src/runtime/alg.go:47: 
      can't create dynamic relocation R_386_GOTPC against local symbol in readonly segment defined in /tmp/nice/go-link-597453838/go.o
      
      Though in reality we just should not have try to create a dynamic relocation for this case at all.
      
      Patch fixes the issue.
      
      Differential revision: https://reviews.llvm.org/D33717
      
      llvm-svn: 304393
      d6029872
  28. May 31, 2017
    • Rafael Espindola's avatar
      Store a single Parent pointer for InputSectionBase. · db5e56f7
      Rafael Espindola authored
      Before InputSectionBase had an OutputSection pointer, but that was not
      always valid. For example, if it was a merge section one actually had
      to look at MergeSec->OutSec.
      
      This was brittle and caused bugs like the one fixed by r304260.
      
      We now have a single Parent pointer that points to an OutputSection
      for InputSection, but to a SyntheticSection for merge sections and
      .eh_frame. This makes it impossible to accidentally access an invalid
      OutSec.
      
      llvm-svn: 304338
      db5e56f7
  29. May 18, 2017
    • Rafael Espindola's avatar
      Alternative way to detemplate GotSection. · a6465bbb
      Rafael Espindola authored
      GetSection is a template because write calls relocate.
      
      relocate has two parts. The non alloc code really has to be a
      template, as it is looking a raw input file data.
      
      The alloc part is only a template because of getSize.
      
      This patch folds the value of getSize early, detemplates
      getRelocTargetVA and splits relocate into a templated non alloc case
      and a regular function for the alloc case. This has the nice advantage
      of making sure we collect all the information we need for relocations
      before getting to InputSection::relocateNonAlloc.
      
      Since we know got is alloc, it can just call the function directly and
      avoid the template.
      
      llvm-svn: 303355
      a6465bbb
  30. May 17, 2017
Loading