Skip to content
  1. Jan 26, 2018
  2. Jan 25, 2018
    • Jake Ehrlich's avatar
      [llvm-objcopy] Refactor llvm-objcopy to use reader and writer objects · 76e9110f
      Jake Ehrlich authored
      While writing code for input and output formats in llvm-objcopy it became
      apparent that there was a code health problem. This change attempts to solve
      that problem by refactoring the code to use Reader and Writer objects that can
      read in different objects in different formats, convert them to a single shared
      internal representation, and then write them to any other representation.
      
      New classes:
      Reader: the base class used to construct instances of the internal
      representation
      Writer: the base class used to write out instances of the internal
      representation
      ELFBuilder: a helper class for ELFWriter that takes an ELFFile and converts it
      to a Object
      SectionVisitor: it became necessary to remove writeSection from SectionBase
      because, under the new Reader/Writer scheme, it's possible to convert between
      ELF Types such as ELF32LE and ELF32BE. This isn't possible with writeSection
      because it (dynamically) depends on the underlying section type *and*
      (statically) depends on the ELF type. Bad things would happen if the underlying
      sections for ELF32LE were used for writing to ELF64BE. To avoid this code smell
      (which would have compiled, run, and output some nonsesnse) I decoupled writing
      of sections from a class.
      SectionWriter: This is just the ELFT templated implementation of
      SectionVisitor. Many classes now have this class as a friend so that the
      writing methods in this class can write out private data.
      ELFWriter: This is the Writer that outputs to ELF
      BinaryWriter: This is the Writer that outputs to Binary
      ElfType: Because the ELF Type is not a part of the Object anymore we need a way
      to construct the correct default Writer based on properties of the Reader. This
      enum just keeps track of the ELF type of the input so it can be used as the
      default output type as well.
      
      Object has correspondingly undergone some serious changes as well. It now has
      more generic methods for building and manipulating ELF binaries. This interface
      makes ELFBuilder easy enough to use and will make the BinaryReader/Builder easy
      to create as well. Most changes in this diff are cosmetic and deal with the
      fact that a method has been moved from one class to another or a change from a
      pointer to a reference. Almost no changes should result in a functional
      difference (this is after all a refactor). One minor functional change was made
      and the result can be seen in remove-shstrtab-error.test. The fact that it
      fails hasn't changed but the error message has changed because that failure is
      detected at a later point in the code now (because WriteSectionHeaders is a
      property of the ElfWriter *not* a property of the Object). I'd say roughly
      80-90% of this code is cosmetically different, 10-19% is different but
      functionally the same, and 1-5% is functionally different despite not causing a
      change in tests.
      
      Differential Revision: https://reviews.llvm.org/D42222
      
      llvm-svn: 323480
      76e9110f
    • Marshall Clow's avatar
      Mark 2903 as complete; we already do this · 8abbc96c
      Marshall Clow authored
      llvm-svn: 323479
      8abbc96c
    • Easwaran Raman's avatar
      Add testcase accidentally left out from r323460. · 6b7209b3
      Easwaran Raman authored
      llvm-svn: 323478
      6b7209b3
    • Jake Ehrlich's avatar
      [llvm-objcopy] Add --add-gnu-debuglink · ea07d3cf
      Jake Ehrlich authored
      This change adds support for --add-gnu-debuglink to llvm-objcopy
      
      Differential Revision: https://reviews.llvm.org/D41731
      
      llvm-svn: 323477
      ea07d3cf
    • Paul Robinson's avatar
      [DWARFv5] Support DW_FORM_line_strp in llvm-dwarfdump. · b6aa01ca
      Paul Robinson authored
      This form is like DW_FORM_strp, but points to .debug_line_str instead
      of .debug_str as the string section.  It's intended to be used from
      the line-table header, and allows string-pooling of directory and
      filenames across compilation units.
      
      Differential Revision: https://reviews.llvm.org/D42553
      
      llvm-svn: 323476
      b6aa01ca
Loading