Skip to content
  1. Jun 02, 2017
    • George Rimar's avatar
      [ELF] - Assign SHF_INFO_LINK flag to REL[A] sections. · ef84219d
      George Rimar authored
      Spec says: (http://www.sco.com/developers/gabi/latest/ch4.sheader.html)
      
      sh_info
      This member holds extra information, whose interpretation depends on the section type.
      If the sh_flags field for this section header includes the attribute SHF_INFO_LINK, 
      then this member represents a section header table index.
      
      SHF_INFO_LINK
      The sh_info field of this section header holds a section header table index.
      
      Since sh_info for SHT_REL[A] sections should contain the section header index of the
      section to which the relocation applies, this is
      consistent with spec to put this flag. Behavior matches both bfd and gold as well.
      
      Differential revision: https://reviews.llvm.org/D33763
      
      llvm-svn: 304531
      ef84219d
  2. Jun 01, 2017
  3. May 31, 2017
    • Rafael Espindola's avatar
      Fix a crash. · b47c6e5c
      Rafael Espindola authored
      We would crash if a SHF_LINK_ORDER section pointed to a non
      InputSection section. Since those sections are not merged in order,
      SHF_LINK_ORDER is pretty meaningless and we can error on that case.
      
      llvm-svn: 304327
      b47c6e5c
    • Rafael Espindola's avatar
      Fix crash when processing relocations in .eh_frame. · 180de970
      Rafael Espindola authored
      This happens when attempting to link shared libraries using exceptions on
      MIPS. It requires -z notext because clang generates R_MIPS_64 relocations
      inside .eh_frame.
      The crash happened because for EhInputSection the OutSec member is null.
      
      Patch by Alexander Richardson!
      
      llvm-svn: 304260
      180de970
  4. May 30, 2017
  5. May 29, 2017
    • George Rimar's avatar
      [ELF] - Do not allow -r to eat comdats. · 3b189d16
      George Rimar authored
      This is PR33052, "Bug 33052 - -r eats comdats ".
      
      To fix it I stop removing group section from out when -r is given
      and fixing SHT_GROUP content when writing it just like we do some
      other fixup, e.g. for Rel[a]. (it needs fix for section indices that
      are in group).
      
      Differential revision: https://reviews.llvm.org/D33485
      
      llvm-svn: 304140
      3b189d16
  6. May 26, 2017
    • Petr Hosek's avatar
      [lld][ELF]Add option to make .dynamic read only · ffa786f4
      Petr Hosek authored
      The .dynamic section of an ELF almost doesn't need to be written to with
      the exception of the DT_DEBUG entry. For several reasons having a read
      only .dynamic section would be useful. This change adds the -z keyword
      "rodynamic" which forces .dynamic to be read-only. In this case DT_DEBUG
      will not be emited.
      
      Patch by Jake Ehrlich
      
      Differential Revision: https://reviews.llvm.org/D33251
      
      llvm-svn: 304024
      ffa786f4
    • Rafael Espindola's avatar
      Order writable executable sections before writable ones. · d23e9267
      Rafael Espindola authored
      On SPARC, .plt is both writeable and executable. The current way
      sections are sorted means that lld puts it after .data/.bss. but it
      really needs to be close to .test to make sure branches into .plt
      don't overflow. I'd argue that because .bss is supposed to come last
      on all architectures, we should change the default sort order such
      that writable and executable sections come before sections that are
      just writeable. read-only executable sections should still come after
      sections that are just read-only of course. This diff makes this
      change.
      
      llvm-svn: 304008
      d23e9267
    • George Rimar's avatar
      [ELF] - Do not produce duplicate values in .gdb_index's constant pool area. · c1a0364c
      George Rimar authored
      I found this when builded llc binary using gcc 5.4.1 + LLD.
      gcc produces duplicate entries in .debug_gnu_pubtypes section, ex:
      
      UnifyFunctionExitNodes.cpp.o has:
      0x0000ac07 EXTERNAL TYPE "std::success_type<void*>"
      0x0000ac07 EXTERNAL TYPE "std::success_type<void*>"
      
      clang produces single entry here:
      0x0000d291 EXTERNAL TYPE "std::__success_type<void *>"
      
      If we link output from gcc with LLD, that would produce excessive duplicate
      entries in .gdb_index constant pool area. That does not seem affect gdb work,
      but makes .gdb_index larger than it can be.
      
      I also checked that gold filters out such duplicates too. Patch fixes it.
      
      Differential revision: https://reviews.llvm.org/D32647
      
      llvm-svn: 303975
      c1a0364c
  7. May 25, 2017
  8. May 24, 2017
  9. May 23, 2017
  10. May 22, 2017
  11. May 18, 2017
    • Peter Smith's avatar
      [ELF] Support R_ARM_SBREL32 Relocation · d54f368e
      Peter Smith authored
      This change adds support for the R_ARM_SBREL32 relocation. The relocation
      is a base relative relocation that is produced by clang/llvm when -frwpi
      is used. The use case for the -frwpi option is position independent data
      for embedded systems that do not have a GOT. With -frwpi all data is
      accessed via an offset from a base register (usually r9), where r9 is set
      at run time to where the data has been loaded. The base of the data is
      known as the static base.
      
      The ARM ABI defines the static base as:
      B(S) is the addressing origin of the output segment defining the symbol S.
      The origin is not required to be the base address of the segment. For
      simplicity we choose to use the base address of the segment.
      
      The ARM procedure call standard only defines a read write variant using
      R_ARM_SBREL32 relocations. The read-only data is accessed via pc-relative
      offsets from the code, this is implemented in clang as -fropi.
      
      Fixes PR32924
      
      Differential Revision: https://reviews.llvm.org/D33280
      
      llvm-svn: 303337
      d54f368e
  12. May 15, 2017
  13. May 12, 2017
    • Rafael Espindola's avatar
      Optimize orphan placement in a general way. · 5210141b
      Rafael Espindola authored
      We used to place orphans by just using compareSectionsNonScript.
      
      Then we noticed that since linker scripts can use another order, we
      should first try match the section to a given PT_LOAD. But there is
      nothing special about PT_LOAD. The same issue can show up for
      PT_GNU_RELRO for example.
      
      In general, we have to search for the most similar section and put the
      orphan next to it. Most similar being defined as how long they follow
      the same code path in compareSecitonsNonScript.
      
      That is what this patch does. We now compute a rank for each output
      section, with a bit for each branch in what was
      compareSectionsNonScript.
      
      With this findOrphanPos is now fully general and orphan placement can
      be optimized by placing every section with the same rank at once.
      
      The included testcase is a variation of many-sections.s that uses
      allocatable sections to avoid the fast path in the existing
      code. Without threads it goes form 46 seconds to 0.9 seconds.
      
      llvm-svn: 302903
      5210141b
    • George Rimar's avatar
      [ELF] - Stop support of DF_STATIC_TLS flag. · b4081bb0
      George Rimar authored
      This reverts changes introduced in r302414 "[ELF] - Set DF_STATIC_TLS flag for i386 target."
      
      Because DF_STATIC_TLS does not look to be used by glibc or anything else.
      
      llvm-svn: 302884
      b4081bb0
    • George Rimar's avatar
      [ELF] - Don't allow R_X86_64_TPOFF32 dynamic relocation when linking PIC · 6f586731
      George Rimar authored
      Both gold and bfd restrict that one:
      
      ld.bfd: test.o: relocation R_X86_64_TPOFF32 against `var' can not be 
      used when making a shared object; recompile with -fPIC
      ld.gold: error: test.o: unsupported reloc 23 against global symbol var
      
      What looks reasonable because it is 32 bit one. Patch do the same.
      
      Differential revision: https://reviews.llvm.org/D33100
      
      llvm-svn: 302881
      6f586731
  14. May 11, 2017
  15. May 10, 2017
  16. May 09, 2017
  17. May 08, 2017
    • George Rimar's avatar
      [ELF] - Set DF_STATIC_TLS flag for i386 target. · 1564122b
      George Rimar authored
      This is PR32437.
      
      DF_STATIC_TLS
      If set in a shared object or executable, this flag instructs the 
      dynamic linker to reject attempts to load this file dynamically. 
      It indicates that the shared object or executable contains code 
      using a static thread-local storage scheme. Implementations need 
      not support any form of thread-local storage.
      
      Patch checks if IE/LE relocations were used to check if code uses
      static model. If so it sets the DF_STATIC_TLS flag.
      
      Differential revision: https://reviews.llvm.org/D32354
      
      llvm-svn: 302414
      1564122b
    • George Rimar's avatar
      [ELF] - Linkerscript: support combination of linkerscript and --compress-debug-sections. · d86a4e50
      George Rimar authored
      Previously it was impossible to use linkerscript with --compress-debug-sections 
      because of assert failture:
      Assertion failed: isFinalized(), file C:\llvm\lib\MC\StringTableBuilder.cpp, line 64
      
      Patch fixes the issue
      
      llvm-svn: 302413
      d86a4e50
  18. May 05, 2017
  19. May 04, 2017
    • Rafael Espindola's avatar
      Fix accounting of tbss. · 7c4eafa3
      Rafael Espindola authored
      We were correctly computing the size contribution of a .tbss input
      section (it is none), but we were incorrectly considering the
      alignment of the output section: it was advancing Dot instead of
      ThreadBssOffset.
      
      As far as I can tell this was always wrong in our linkerscript
      implementation, but that became more visible now that the code is
      shared with the non linker script case.
      
      llvm-svn: 302107
      7c4eafa3
  20. May 03, 2017
    • Rui Ueyama's avatar
      Accept archive files with no symbol table instad of warning on them. · fd7deda5
      Rui Ueyama authored
      It seems virtually everyone who tries to do LTO build with Clang and
      LLD was hit by a mistake to forget using llvm-ar command to create
      archive files. I wasn't an exception. Since this is an annoying common
      issue, it is probably better to handle that gracefully rather than
      reporting an error and tell the user to redo build with different
      configuration.
      
      Differential Revision: https://reviews.llvm.org/D32721
      
      llvm-svn: 302083
      fd7deda5
    • Rafael Espindola's avatar
      Handle mixed strong and weak undefined symbols. · 5e20c75e
      Rafael Espindola authored
      We were ignoring strong undefined symbols if they followed weak ones.
      
      Fixes pr32899.
      
      llvm-svn: 302065
      5e20c75e
    • Peter Smith's avatar
      [ELF] Fix problems with fabricateDefaultCommands() and --section-start · c60b4510
      Peter Smith authored
      The --section-start <name>=<address> needs to be translated into equivalent
      linker script commands. There are a couple of problems with the existing
      implementation:
      - The --section-start with the lowest address is assumed to be at the start
      of the map. This assumption is incorrect, we have to iterate through the
      SectionStartMap to find the lowest address.
      - The addresses in --section-start were being over-aligned when the
      sections were marked as PageAlign. This is inconsistent with the use of
      SectionStartMap in fixHeaders(), and can cause problems when the PageAlign
      causes an "unable to move location counter backward" error when the
      --section-start with PageAlign is aligned to an address higher than the next
      --section-start. The ld.bfd and ld.gold seem to be more consistent with this
      approach but this is not a well specified area.
          
      This change fixes the problems above and also corrects a typo in which
      fabricateDefaultCommands() is called with the wrong parameter, it should be
      called with AllocateHeader not Config->MaxPageSize.
      
      Differential Revision: https://reviews.llvm.org/D32749
      
      llvm-svn: 302007
      c60b4510
    • George Rimar's avatar
      [ELF] - Added testcase gdb-index-ranges.s (https://reviews.llvm.org/D32750) · 99e1890e
      George Rimar authored
      Before rL301170 was landed, LLD did not produce correct entries in .gdb_index address area.
      Issue was fixed on LLVM DWARF parsers side and was relative to how .debug_ranges
      section was scanned. It was main problem of PR32319.
      
      It makes sense to have testcase on LLD size too. This checks that we generate proper values 
      now, because we do not have any tests for .gdb_index which works with .debug_ranges atm.
      
      Differential revision: https://reviews.llvm.org/D32750
      
      llvm-svn: 302006
      99e1890e
Loading