Skip to content
  1. Jan 10, 2017
  2. Jan 09, 2017
  3. Jan 05, 2017
    • Rafael Espindola's avatar
      Change which input sections we concatenate · 33713983
      Rafael Espindola authored
      After Mark's patch I was wondering what was the rationale for the ELF
      spec requiring us to merge only sections with matching flags and
      types. I tried emailing
      https://groups.google.com/forum/#!forum/generic-abi, but looks like my
      emails are not being posted (the list is probably moderated). I
      emailed Cary Coutant instead.
      
      Cary pointed out that the section was a late addition and didn't got
      the scrutiny it deserved. Given that and the problems found by
      implementing the letter of the standard, I propose changing lld to
      merge all sections with the same name and issue errors if the types or
      some critical flags are different.
      
      This should allow an unmodified firefox linked with lld to run.
      
      This also merges some code with the linkerscript path.
      
      llvm-svn: 291107
      33713983
  4. Dec 23, 2016
  5. Dec 22, 2016
  6. Dec 21, 2016
    • George Rimar's avatar
      [ELF] - Linkerscript: Fall back to search paths when INCLUDE not found · d4500653
      George Rimar authored
      From https://sourceware.org/binutils/docs/ld/File-Commands.html:
      The file will be searched for in the current directory, and in any 
      directory specified with the -L option.
      
      Patch done by Alexander Richardson.
      
      Differential revision: https://reviews.llvm.org/D27831
      
      llvm-svn: 290247
      d4500653
    • Rui Ueyama's avatar
      De-template DefinedSynthetic. · 4f2f50dc
      Rui Ueyama authored
      DefinedSynthetic is not created for a real ELF object, so it doesn't
      have to be a template function. It has a virtual st_value, which is
      either 32 bit or 64 bit, but we can simply use 64 bit.
      
      llvm-svn: 290241
      4f2f50dc
    • George Rimar's avatar
      [ELF] - Fix use of freed memory. · 4fb6e79c
      George Rimar authored
      It was revealed by D27831.
      
      If we have linkerscript that includes another one that sets OUTPUT for example:
      
      RUN: echo "INCLUDE \"foo.script\"" > %t.script
      RUN: echo "OUTPUT(\"%t.out\")" > %T/foo.script
      then we do:
      
      void ScriptParser::readInclude() {
      ...
        std::unique_ptr<MemoryBuffer> &MB = *MBOrErr;
        tokenize(MB->getMemBufferRef());
        OwningMBs.push_back(std::move(MB));
      }
      
      void ScriptParser::readOutput() {
      ...
          Config->OutputFile = unquote(Tok);
      ...
      }
      Problem is that OwningMBs are destroyed after script parser do its job.
      So all Toks are dead and Config->OutputFile points to destroyed data.
      
      Patch suggests to save all included scripts into using string Saver.
      
      Differential revision: https://reviews.llvm.org/D27987
      
      llvm-svn: 290238
      4fb6e79c
  7. Dec 19, 2016
    • Rafael Espindola's avatar
      Fix corner cases of setting the section address. · 5967c973
      Rafael Espindola authored
      This handles all the corner cases if setting a section address:
      
      - If the address is too low, we cannot allocate the program headers.
      - If the load address is lowered, we have to do that before finalize
      
      This also shares some code with the linker script since it was already
      hitting similar cases.
      
      This is used by the freebsd boot loader. It is not clear if we need to
      support this with a non binary output, but it is not as bad as I was
      expecting.
      
      llvm-svn: 290136
      5967c973
    • Rafael Espindola's avatar
      Detemplate PhdrEntry. NFC. · 17cb7c0a
      Rafael Espindola authored
      llvm-svn: 290115
      17cb7c0a
  8. Dec 18, 2016
    • Rui Ueyama's avatar
      Remove lld/Support/Memory.h. · 9381eb10
      Rui Ueyama authored
      I thought for a while about how to remove it, but it looks like we
      can just copy the file for now. Of course I'm not happy about that,
      but it's just less than 50 lines of code, and we already have
      duplicate code in Error.h and some other places. I want to solve
      them all at once later.
      
      Differential Revision: https://reviews.llvm.org/D27819
      
      llvm-svn: 290062
      9381eb10
  9. Dec 16, 2016
  10. Dec 15, 2016
    • George Rimar's avatar
      [ELF] - Apply format. NFC. · 93c64025
      George Rimar authored
      llvm-svn: 289823
      93c64025
    • George Rimar's avatar
      [ELF] - Do not crash when move location counter backward. · 14460e02
      George Rimar authored
      PR31335 shows that we do that in next case:
      SECTIONS { .text 0x2000 : {. = 0x100 ; *(.text) } }
      
      though documentations says that "If . is used inside a section 
      description however, it refers to the byte offset from the start
      of that section, not an absolute address. " looks does not work 
      as documented in bfd (as mentioned in comments for PR31335).
      
      Until we find out the expected behavior was suggested at least not
      to 'crash', what we do after trying to generate huge file.
      
      Differential revision: https://reviews.llvm.org/D27712
      
      llvm-svn: 289782
      14460e02
  11. Dec 09, 2016
  12. Dec 08, 2016
    • Rui Ueyama's avatar
      Move Memory.{h,cpp} to lld/Support so that we can use them from COFF. · 520d9169
      Rui Ueyama authored
      llvm-svn: 289084
      520d9169
    • Rafael Espindola's avatar
      Change the implementation of --dynamic-list to use linker script parsing. · d0ebd84c
      Rafael Espindola authored
      The feature is documented as
      -----------------------------
      The format of the dynamic list is the same as the version node
      without scope and node name.  See *note VERSION:: for more
      information.
      --------------------------------
      
      And indeed qt uses a dynamic list with an 'extern "C++"' in it. With
      this patch we support that
      
      The change to gc-sections-shared makes us match bfd. Just because we
      kept bar doesn't mean it has to be in the dynamic symbol table.
      
      The changes to invalid-dynamic-list.test and reproduce.s are because
      of the new parser.
      
      The changes to version-script.s are the only case where we change
      behavior with regards to bfd, but I would like to see a mix of
      --version-script and --dynamic-list used in the wild before
      complicating the code.
      
      llvm-svn: 289082
      d0ebd84c
    • Rafael Espindola's avatar
      Add support for 'extern "C"'. · 7e71415c
      Rafael Espindola authored
      It is used by Qt.
      
      llvm-svn: 289074
      7e71415c
    • Rafael Espindola's avatar
      Delete dead code. · 41217616
      Rafael Espindola authored
      Thanks to George Rimar for pointing it out.
      
      llvm-svn: 289020
      41217616
  13. Dec 06, 2016
  14. Dec 05, 2016
  15. Dec 01, 2016
  16. Nov 29, 2016
  17. Nov 28, 2016
  18. Nov 27, 2016
  19. Nov 26, 2016
  20. Nov 25, 2016
  21. Nov 24, 2016
  22. Nov 22, 2016
  23. Nov 21, 2016
    • Rafael Espindola's avatar
      Use the correct page size. · 28d5f059
      Rafael Espindola authored
      Config->MaxPageSize is what we use for the segment alignment, so that
      is the one that we have to use for placing the header.
      
      llvm-svn: 287569
      28d5f059
    • Rafael Espindola's avatar
      Fix address computation for headers. · 1c57007e
      Rafael Espindola authored
      If the linker script has SECTIONS, the address computation is now
      always done in LinkerScript::assignAddresses, like for any other
      section.
      
      Before fixHeaders would do a tentative computation that
      assignAddresses would sometimes override.
      
      This patch also splits the cases where assignAddresses needs to add
      the headers to the first PT_LOAD and the address computation. The net
      effect is that we no longer create an empty page for no reason in the
      included test case, which matches bfd behavior.
      
      llvm-svn: 287565
      1c57007e
    • Eugene Leviant's avatar
      [ELF] Better error reporting for linker scripts · 03ff0166
      Eugene Leviant authored
      Differential revision: https://reviews.llvm.org/D26795
      
      llvm-svn: 287547
      03ff0166
    • Rui Ueyama's avatar
      Add comments. · 0b1b695a
      Rui Ueyama authored
      This patch rearranges code a bit to make it easy to explain.
      
      llvm-svn: 287515
      0b1b695a
    • Rui Ueyama's avatar
      Simplify. NFC. · e0be2901
      Rui Ueyama authored
      llvm-svn: 287514
      e0be2901
    • Rui Ueyama's avatar
      Add a flag to InputSectionBase for linker script. · f94efddd
      Rui Ueyama authored
      Previously, we set (uintptr_t)-1 to InputSectionBase::OutSec to record
      that a section has already been set to be assigned to some output section
      by linker scripts. Later, we restored nullptr to the pointer to use
      the field for the original purpose. That overloading is not very easy to
      understand.
      
      This patch adds a bit flag for that purpose, so that we don't need
      to piggyback the flag on an unrelated pointer.
      
      llvm-svn: 287508
      f94efddd
  24. Nov 19, 2016
Loading