Skip to content
  1. Oct 11, 2017
    • Rui Ueyama's avatar
      Move a loop invariant outside the loop. · 7f1c266e
      Rui Ueyama authored
      llvm-svn: 315404
      7f1c266e
    • Rui Ueyama's avatar
      Remove ScriptConfiguration class and move the members to LinkerScript class. · ac27de9d
      Rui Ueyama authored
      ScriptConfiguration was a class to contain parsed results of
      linker scripts. LinkerScript is a class to interpret it.
      
      That ditinction was needed because we haven't instantiated
      LinkerScript early (because, IIRC, LinkerScript class was a
      ELFT template function). So, when we parse linker scripts,
      we couldn't directly store the result to a LinkerScript instance.
      
      Now, that limitation is gone. We instantiate LinkerScript
      at the very beginning of our main function. We can directly
      store parse results to a LinkerScript instance.
      
      llvm-svn: 315403
      ac27de9d
    • Rui Ueyama's avatar
      Inline addRegular into addSymbol. · 18d19687
      Rui Ueyama authored
      Because addRegular's functionality is tightly coupled with
      addSymbol, and the former is called only once, it makes sense
      to merge the two functions. This patch also adds comments.
      
      llvm-svn: 315401
      18d19687
    • Rui Ueyama's avatar
      Remove a constructor from ExprValue. NFC. · 4fbe3518
      Rui Ueyama authored
      I think three ctors are too many for this simple class.
      
      llvm-svn: 315394
      4fbe3518
  2. Oct 10, 2017
    • James Henderson's avatar
      [ELF] Set Dot initially to --image-base value when using linker scripts · b5ca92ef
      James Henderson authored
      When parsing linker scripts, LLD previously started with a '.' value of 0,
      regardless of the internal default image base for the target, and regardless of
      switches such as --image-base. It seems reasonable to use a different image base
      value when using linker scripts and --image-base is specified, since otherwise the
      switch has no effect. This change does this, as well as removing unnecessary
      initialisation of Dot where it is not used.
      
      The default image base should not be used when processing linker
      scripts, because this will change the behaviour for existing linker script users,
      and potentially result in invalid output being produced, as a subsequent assignment
      to Dot could move the location counter backwards. Instead, we maintain the existing
      behaviour of starting from 0 if --image-base is not specified.
      
      Reviewers: ruiu
      
      Differential Revision: https://reviews.llvm.org/D38360
      
      llvm-svn: 315293
      b5ca92ef
  3. Oct 08, 2017
  4. Oct 07, 2017
    • Rui Ueyama's avatar
      Remove OutputSection::updateAlignment. · 8befefb2
      Rui Ueyama authored
      I feel it is easier to understand without this function.
      
      llvm-svn: 315140
      8befefb2
    • Rui Ueyama's avatar
      Merge addInputSec with OutputSection::addSection. · 0e2bfb1e
      Rui Ueyama authored
      Previously, when we added an input section to an output section, we
      called `OutputSectionFactory::addInputSec`. This isn't a good design
      because, a factory class is intended to create a new object and
      return it, but in this use case, it will never create a new object.
      This patch fixes the design flaw.
      
      llvm-svn: 315138
      0e2bfb1e
    • Rui Ueyama's avatar
      Remove unused parameters. · b4175edf
      Rui Ueyama authored
      llvm-svn: 315133
      b4175edf
    • Rui Ueyama's avatar
      Do not mutate Script->Opt.Commands from a leaf helper function. · c54d5b16
      Rui Ueyama authored
      Factory::addInputSec added an output section to Script->Opt.Commands,
      but that is too subtle. This patch makes it explicit so that it is easy
      to see when a new element is added to Script->Opt.Commands.
      
      llvm-svn: 315129
      c54d5b16
    • Rui Ueyama's avatar
      Simplify LinkerScript::addOrphanSections. NFCI. · d2f225fd
      Rui Ueyama authored
      This patch moves a std::find to a new function. It also removes
      the following piece of code. I believe it should be fine because all
      tests still pass.
      
        unsigned Index = std::distance(Opt.Commands.begin(), I);
        assert(Sec->SectionIndex == INT_MAX || Sec->SectionIndex == Index);
        Sec->SectionIndex = Index;
      
      llvm-svn: 315125
      d2f225fd
    • Rui Ueyama's avatar
      Split addSection into two small functions. NFCI. · edafba20
      Rui Ueyama authored
      addSection function was hard to read because it behaves differently
      depending on its arguments but what exactly it does is not clear.
      Now it should be better. Still, it is not clear (not what but) why
      it does what it does, but I'll take a look at it later.
      
      llvm-svn: 315124
      edafba20
  5. Oct 02, 2017
  6. Sep 28, 2017
  7. Sep 25, 2017
  8. Sep 20, 2017
    • Rafael Espindola's avatar
      Fix assigning to _gp in linker scripts. · 9be24cf5
      Rafael Espindola authored
      The previous logic was to try to detect if a linker script defined _gp
      by checking !ElfSym::MipsGp->Value. That doesn't work in all cases as
      the assigned value can be 0.
      
      We now just always defined it Writer.cpp and always overwrite it
      afterwards if needed.
      
      llvm-svn: 313788
      9be24cf5
    • Rafael Espindola's avatar
      Add a special case for trivial alignment. · 8b250344
      Rafael Espindola authored
      Normally to find the offset of a value in a section, we have to
      compute the value since the alignment is defined on the final address.
      
      If the alignment is trivial, we can skip the value computation. This
      allows us to know the offset even in cases where we cannot yet know
      the value.
      
      llvm-svn: 313777
      8b250344
    • Rafael Espindola's avatar
      Don't try to compute a value that is known to fail. · e4bad83e
      Rafael Espindola authored
      We try to evaluate expressions early when possible, but it is not
      possible to evaluate them early if they are based on a section.
      
      Before we would get this wrong on ABSOLUTE expressions.
      
      llvm-svn: 313764
      e4bad83e
  9. Sep 19, 2017
  10. Sep 18, 2017
  11. Sep 12, 2017
    • Rafael Espindola's avatar
      Remove Offset from Common. · 67df57a2
      Rafael Espindola authored
      It is not needed since it is always 0.
      
      llvm-svn: 313076
      67df57a2
    • Rafael Espindola's avatar
      Align addresses, not offsets. · a6acd23c
      Rafael Espindola authored
      This fixes two more cases where we were aligning the offset in a
      section, instead of the final address.
      
      llvm-svn: 312983
      a6acd23c
    • Rafael Espindola's avatar
      Correct ALIGN expression when inside a section. · b7147ad3
      Rafael Espindola authored
      When given
      
      foobar = ALIGN(., 0x100);
      
      my expectation from what the manual says is that the final address of
      foobar will be aligned. It seems that bfd aligns the offset in the
      section, which causes some odd results if the section is not 0x100
      aligned. Gold aligns the address.
      
      This changes lld to align the final address.
      
      llvm-svn: 312979
      b7147ad3
  12. Sep 08, 2017
  13. Sep 07, 2017
  14. Sep 06, 2017
  15. Aug 28, 2017
  16. Aug 25, 2017
  17. Aug 23, 2017
    • Petr Hosek's avatar
      [ELF] Don't output headers into a segment if there's no space for them · b93c5b9f
      Petr Hosek authored
      Currently, LLD checks whether there's enough space for headers by
      checking if headers fit below the address of the first allocated
      section. However, that's always thue if the binary doesn't start
      at zero which means that LLD always emits a segment for headers,
      even if no other sections belong to that segment.
      
      This is a problem in cases when linker script is being used with a
      non-zero start address when we don't want to make the headers visible
      by not leaving enough space for them. This pattern is common in
      embedded programming but doesn't work in LLD.
      
      This patch changes the behavior of LLD in case when linker script
      is being to match the behavior of BFD ld and gold, which is to only
      place headers into a segment when they're covered by some output
      section.
      
      Differential Revision: https://reviews.llvm.org/D36256
      
      llvm-svn: 311586
      b93c5b9f
  18. Aug 21, 2017
  19. Aug 17, 2017
  20. Aug 10, 2017
Loading