Skip to content
  1. Jan 10, 2017
  2. Jan 04, 2017
  3. Dec 25, 2016
  4. Dec 21, 2016
  5. Dec 20, 2016
    • George Rimar's avatar
      [ELF] - Treat .openbsd.randomdata as relro section · d003c7f3
      George Rimar authored
      That was requested by Mark Kettenis in llvm-dev:
      
      "It is the intention that .openbsd.randomdata sections are made
      read-only after initialization. The native (ld.bfd based) OpenBSD
      toolchain accomplishes this by including .openbsd.randomdata into the
      PT_GNU_RELRO segment."
      
      He suggested code change, I added testcase.
      
      Differential revision: https://reviews.llvm.org/D27974
      
      llvm-svn: 290174
      d003c7f3
    • Rui Ueyama's avatar
      Simplify type of Config->SymbolOrderingFile. · 31270311
      Rui Ueyama authored
      That variable was of type DenseMap<StringRef, unsigned>, but the
      unsigned numbers needed to be monotonicly increasing numbers because
      the implementation that used the variable depended on that fact.
      That was an implementation detail and shouldn't have leaked into Config.
      
      This patch simplifies its type to std::vector<StringRef>.
      
      llvm-svn: 290151
      31270311
  6. 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
    • George Rimar's avatar
      [ELF] - Implemented --retain-symbols-file option · 2bb88ab5
      George Rimar authored
      --retain-symbols-file=filename
      Retain only the symbols listed in the file filename, discarding all others. 
      filename is simply a flat file, with one symbol name per line. This option 
      is especially useful in environments (such as VxWorks) where a large global 
      symbol table is accumulated gradually, to conserve run-time memory.
      
      Note: though documentation says "--retain-symbols-file does not discard 
      undefined symbols, or symbols needed for relocations.", both bfd and gold 
      do that, and this patch too, like testcase show.
      
      Differential revision: https://reviews.llvm.org/D27716
      
      llvm-svn: 290122
      2bb88ab5
    • Rafael Espindola's avatar
      Detemplate PhdrEntry. NFC. · 17cb7c0a
      Rafael Espindola authored
      llvm-svn: 290115
      17cb7c0a
    • Rui Ueyama's avatar
      Remove inappropriate use of CachedHashStringRef. · 8f687f71
      Rui Ueyama authored
      Use of CachedHashStringRef makes sense only when we reuse hash values.
      Sprinkling it to all DenseMap has no benefits and just complicates data types.
      Basically we shouldn't use CachedHashStringRef unless there is a strong
      reason to to do so.
      
      llvm-svn: 290076
      8f687f71
  7. 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
  8. Dec 12, 2016
  9. 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
    • Peter Smith's avatar
      [ELF] ifunc implementation using synthetic sections · baffdb8b
      Peter Smith authored
      This change introduces new synthetic sections IpltSection, IgotPltSection
      that represent the ifunc entries that would previously have been put in
      the PltSection and the GotPltSection. The separation makes sure that
      the R_*_IRELATIVE relocations are placed after the non R_*_IRELATIVE
      relocations, which permits ifunc resolvers to know that the .got.plt
      slots will be initialized prior to the resolver being called.
      
      A secondary benefit is that for ARM we can move the IgotPltSection and its
      dynamic relocations to the .got and .rel.dyn as the ARM glibc expects all
      the R_*_IRELATIVE relocations to be in the .rel.dyn
      
      Differential revision: https://reviews.llvm.org/D27406
      
      llvm-svn: 289045
      baffdb8b
    • Simon Atanasyan's avatar
      [ELF][MIPS] Make _gp, _gp_disp, __gnu_local_gp global symbols · 6a4eb75c
      Simon Atanasyan authored
      These MIPS specific symbols should be global because in general they can
      have an arbitrary value. By default this value is a fixed offset from .got
      section.
      
      This patch adds more checks to the mips-gp-local.s test case but marks
      it as XFAIL because LLD does not allow redefinition of absolute symbols
      value by a linker script. This should be fixed by D27276.
      
      Differential revision: https://reviews.llvm.org/D27524
      
      llvm-svn: 289025
      6a4eb75c
    • Rafael Espindola's avatar
      Delete dead code. · 41217616
      Rafael Espindola authored
      Thanks to George Rimar for pointing it out.
      
      llvm-svn: 289020
      41217616
  10. Dec 07, 2016
  11. Dec 06, 2016
    • Rafael Espindola's avatar
      Don't print empty PT_LOAD. · 074ba93c
      Rafael Espindola authored
      If we do, the freebsd dynamic linker tries to call mmap with a size 0,
      which fails.
      
      It is hard to avoid creating them when linker scripts are used, so we
      just delete empty PT_LOADs at the end.
      
      llvm-svn: 288808
      074ba93c
  12. Dec 05, 2016
  13. Dec 03, 2016
    • George Rimar's avatar
      [ELF] - Change the way how we compute offsets for binary output. · 40c28c7f
      George Rimar authored
      Binary output feature is a bit confuzing. bfd and gold output differs a lot sometimes,
      though it is important for FreeBSD mbr loaders.
      
      Patch change the way how we compute file offsets for binary output.
      This fixes PR31196.
      
      Previously offsets were calculated basing on offsets and addresses of sections
      from the same loads:
      if (Sec == First)
        return alignTo(Off, Target->MaxPageSize, Sec->Addr);
      return First->Offset + Sec->Addr - First->Addr;
      
      bfd assigns offsets for each section to VA - MinVA:
      https://github.com/redox-os/binutils-gdb/blob/master/bfd/binary.c#L27
      https://github.com/redox-os/binutils-gdb/blob/master/bfd/binary.c#L255 
      (LMA == VA usually)
      
      This patch for now just stops creating phdrs for binary output. 
      An effect from this that no any additional calculation for offset is performed:
      
      uintX_t getFileAlignment(uintX_t Off, OutputSectionBase *Sec) {
      OutputSectionBase *First = Sec->FirstInPtLoad;
      // If the section is not in a PT_LOAD, we have no other constraint.
      if (!First)
        return Off; //**First is always null, condition always happens**
      
      That is enough now with combination of another patch to generate output
      that is similar to what bfd produce for mbr loader.
      
      Differential revision: https://reviews.llvm.org/D27341
      
      llvm-svn: 288580
      40c28c7f
  14. Nov 29, 2016
  15. Nov 28, 2016
  16. Nov 25, 2016
  17. Nov 24, 2016
    • Peter Smith's avatar
      [ELF] Add terminating sentinel .ARM.exidx table entry · 719eb8ef
      Peter Smith authored
          
      The .ARM.exidx table has an entry for each function with the first entry
      giving the start address of the function, the table is sorted in ascending
      order of function address. Given a PC value, the unwinder will search the
      table for the entry that contains the PC value.
          
      If the table entry happens to be the last, the range of the addresses that
      the final unwinding table describes will extend to the end of the address
      space. To prevent an incorrect address outside the address range of the
      program matching the last entry we follow ld.bfd's example and add a
      sentinel EXIDX_CANTUNWIND entry at the end of the table. This gives the
      final real table entry an upper bound.
          
      In addition the llvm libunwind unwinder currently depends on the presence
      of a sentinel entry (PR31091).
      
      Differential revision: https://reviews.llvm.org/D26977
      
      llvm-svn: 287869
      719eb8ef
    • Rui Ueyama's avatar
      Remove HasError and use ErrorCount instead. · f373dd76
      Rui Ueyama authored
      HasError was always true if ErrorCount > 0, so we can use ErrorCount instead.
      
      llvm-svn: 287849
      f373dd76
  18. Nov 23, 2016
    • Rui Ueyama's avatar
      Set default entry point to .text if no entry point is found. · 2eda6d16
      Rui Ueyama authored
      Previously, if a symbol specified by -e or ENTRY() is not found,
      we didn't set entry point address. That is incompatible with GNU
      because GNU linkers set the first address of .text to entry.
      This patch implement that behavior.
      
      llvm-svn: 287836
      2eda6d16
Loading