Skip to content
  1. Aug 17, 2019
    • George Rimar's avatar
      [llvm-readobj] - An attemp to fix BB after r369191. · e9f28133
      George Rimar authored
      Few BB failed with the following error:
      
      Command Output (stderr):
      --
      /home/buildbots/ppc64be-clang-lnt-test/clang-ppc64be-lnt/llvm/test/tools/llvm-readobj/stack-sizes.test:263:19: error: BADSECTION-OUT: expected string not found in input
      # BADSECTION-OUT: 8 ?
                        ^
      <stdin>:4:1: note: scanning from here
      
      ^
      
      It doesn't reproduce on ubuntu/windows I have. Also, seems many of the bots
      are happy too.
      
      This slightly reorders the code to make fouts().flush() call earlier,
      like it was before the r369191.
      
      llvm-svn: 369192
      e9f28133
    • George Rimar's avatar
      [llvm-readobj/llvm-readelf] - Improve/cleanup the error reporting API. · bb56755f
      George Rimar authored
      urrently we have the following functions for error reporting:
      
      --
      LLVM_ATTRIBUTE_NORETURN void reportError(Twine Msg);
      void reportError(Error Err, StringRef Input); 
      void reportWarning(Twine Msg);
      void reportWarning(StringRef Input, Error Err);
      void warn(llvm::Error Err);
      void error(std::error_code EC);
      ---
      
      Problems are: naming is inconsistent, arguments order is inconsistent,
      some of the functions looks excessive.
      
      After applying this patch we have:
      
      ---
      LLVM_ATTRIBUTE_NORETURN void reportError(Error Err, StringRef Input); 
      LLVM_ATTRIBUTE_NORETURN void reportError(std::error_code EC, StringRef Input);
      void reportWarning(Error Err, StringRef Input);
      ---
      
      I'd be happy to remove reportError(std::error_code EC, StringRef Input) too, but it
      is used by COFF heavily.
      
      Test cases were updated, they show an improvement introduced.
      
      Differential revision: https://reviews.llvm.org/D66286
      
      llvm-svn: 369190
      bb56755f
  2. Aug 13, 2019
  3. Aug 09, 2019
  4. Aug 08, 2019
    • George Rimar's avatar
      [llvm-readobj/libObject] - Introduce a custom warning handler for `ELFFile<ELFT>` methods. · 67ea32a0
      George Rimar authored
      Currently, we have a code duplication in llvm-readobj which was introduced in D63266.
      The duplication was introduced to allow llvm-readobj to dump the partially
      broken object. Methods in ELFFile<ELFT> perform a strict validation of the inputs,
      what is itself good, but not for dumper tools, that might want to dump the information,
      even if some pieces are broken/unexpected.
      
      This patch introduces a warning handler which can be passed to ELFFile<ELFT> methods
      and can allow skipping the non-critical errors when needed/possible.
      
      For demonstration, I removed the duplication from llvm-readobj and implemented a warning using
      the new custom warning handler. It also deduplicates the strings printed, making the output less verbose.
      
      Differential revision: https://reviews.llvm.org/D65515
      
      llvm-svn: 368260
      67ea32a0
  5. Aug 06, 2019
  6. Jul 16, 2019
  7. Jul 11, 2019
  8. Jun 21, 2019
  9. Jun 18, 2019
    • Fangrui Song's avatar
      [llvm-readobj] Allow --hex-dump/--string-dump to dump multiple sections · 67742399
      Fangrui Song authored
      1) `-x foo` currently dumps one `foo`. This change makes it dump all `foo`.
      2) `-x foo -x foo` currently dumps `foo` twice. This change makes it dump `foo` once.
         In addition, if foo has section index 9, `-x foo -x 9` dumps `foo` once.
      3) Give a warning instead of an error if `foo` does not exist.
      
      The new behaviors match GNU readelf.
      
      Also, print a new line as a separator between two section dumps.
      GNU readelf uses two lines, but one seems good enough.
      
      Reviewed By: grimar, jhenderson
      
      Differential Revision: https://reviews.llvm.org/D63475
      
      llvm-svn: 363683
      67742399
  10. Jun 12, 2019
  11. Jun 10, 2019
  12. May 20, 2019
  13. May 03, 2019
  14. May 02, 2019
  15. May 01, 2019
    • Fangrui Song's avatar
      [llvm-readobj] Change -long-option to --long-option in tests. NFC · e29e30b1
      Fangrui Song authored
      We use both -long-option and --long-option in tests. Switch to --long-option for consistency.
      
      In the "llvm-readelf" mode, -long-option is discouraged as it conflicts with grouped short options and it is not accepted by GNU readelf.
      
      While updating the tests, change llvm-readobj -s to llvm-readobj -S to reduce confusion ("s" is --section-headers in llvm-readobj but --symbols in llvm-readelf).
      
      llvm-svn: 359649
      e29e30b1
  16. Apr 15, 2019
    • Stephen Tozer's avatar
      [llvm-readobj] Reapply: Improve error message for --string-dump · 19bb1d57
      Stephen Tozer authored
      This is a resubmission of a previous patch that caused test failures,
      with the fixes for the relevant tests included.
      
      Fixes bug 40630: https://bugs.llvm.org/show_bug.cgi?id=40630
      
      This patch changes the error message when the section specified by
      --string-dump cannot be found by including the name of the section in
      the error message and changing the prefix text to not imply that the
      file itself was invalid. As part of this change some uses of
      std::error_code have been replaced with the llvm Error class to better
      encapsulate the error info (rather than passing File strings around),
      and the WithColor class replaces string literal error prefixes.
      
      llvm-svn: 358395
      19bb1d57
  17. Apr 05, 2019
  18. Mar 29, 2019
  19. Mar 01, 2019
    • Igor Kudrin's avatar
      [CommandLine] Allow grouping options which can have values. · a38432ce
      Igor Kudrin authored
      This patch allows all forms of values for options to be used at the end
      of a group. With the fix, it is possible to follow the way GNU binutils
      tools handle grouping options better. For example, the -j option can be
      used with objdump in any of the following ways:
      
      $ objdump -d -j .text a.o
      $ objdump -d -j.text a.o
      $ objdump -dj .text a.o
      $ objdump -dj.text a.o
      
      Differential Revision: https://reviews.llvm.org/D58711
      
      llvm-svn: 355185
      a38432ce
  20. Feb 27, 2019
  21. Feb 07, 2019
    • Alexandre Ganea's avatar
      [CodeView] Fix cycles in debug info when merging Types with global hashes · 120366ed
      Alexandre Ganea authored
      When type streams with forward references were merged using GHashes, cycles 
      were introduced in the debug info. This was caused by 
      GlobalTypeTableBuilder::insertRecordAs() not inserting the record on the second
      pass, thus yielding an empty ArrayRef at that record slot. Later on, upon PDB 
      emission, TpiStreamBuilder::commit() would skip that empty record, thus 
      offseting all indices that came after in the stream. 
      
      This solution comes in two steps: 
      
      1. Fix the hash calculation, by doing a multiple-step resolution, iff there are
      forward references in the input stream.
      2. Fix merge by resolving with multiple passes, therefore moving records with
      forward references at the end of the stream. 
      
      This patch also adds support for llvm-readoj --codeview-ghash.
      Finally, fix dumpCodeViewMergedTypes() which previously could reference deleted
      memory. 
      
      Fixes PR40221 
      
      Differential Revision: https://reviews.llvm.org/D57790 
      
      llvm-svn: 353412
      120366ed
  22. Feb 01, 2019
    • Matt Davis's avatar
      [llvm-readobj] Add a flag to dump just the section-to-segment mapping. · 50ca8edb
      Matt Davis authored
      Summary:
      The following patch introduces a new function `printSectionMapping` which is responsible for dumping just the section-to-segment mapping.
      This patch also introduces a n option `-section-mapping` that outputs that mapping without the program headers.
      
      Previously, this functionality was controlled by `printProgramHeaders`, and the output from `-program-headers` has not been changed.  I am happy to change the option name, I copied  the name that was displayed when outputting the mapping table.
      
      Reviewers: khemant, jhenderson, grimar, rupprecht
      
      Reviewed By: jhenderson, grimar, rupprecht
      
      Subscribers: rupprecht, jhenderson, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D57365
      
      llvm-svn: 352896
      50ca8edb
  23. Jan 23, 2019
    • James Henderson's avatar
      [llvm-readelf] Don't suppress static symbol table with --dyn-symbols + --symbols · 21ed8683
      James Henderson authored
      In r287786, a bug was introduced into llvm-readelf where it didn't print
      the static symbol table if both --symbols and --dyn-symbols were
      specified, even if there was no dynamic symbol table. This is obviously
      incorrect.
      
      This patch fixes this issue, by delegating the decision of which symbol
      tables should be printed to the final dumper, rather than trying to
      decide in the command-line option handling layer. The decision was made
      to follow the approach taken in this patch because the LLVM style dumper
      uses a different order to the original GNU style behaviour (and GNU
      readelf) for ELF output. Other approaches resulted in behaviour changes
      for other dumpers which felt wrong. In particular, I wanted to avoid
      changing the order of the output for --symbols --dyn-symbols for LLVM
      style, keep what is emitted by --symbols unchanged for all dumpers, and
      avoid having different orders of .dynsym and .symtab dumping for GNU
      "--symbols" and "--symbols --dyn-symbols".
      
      Reviewed by: grimar, rupprecht
      
      Differential Revision: https://reviews.llvm.org/D57016
      
      llvm-svn: 351960
      21ed8683
  24. Jan 22, 2019
    • James Henderson's avatar
      [llvm-readelf]Revert --dyn-symbols behaviour to make it GNU compatible, and... · 5fc812f1
      James Henderson authored
      [llvm-readelf]Revert --dyn-symbols behaviour to make it GNU compatible, and add new --hash-symbols switch for old behaviour
      
      In r287786, the behaviour of --dyn-symbols in llvm-readelf (but not
      llvm-readobj) was changed to print the dynamic symbols as derived from
      the hash table, rather than to print the dynamic symbol table contents
      directly. The original change was initially submitted without review,
      and some comments were made on the commit mailing list implying that the
      new behavious is GNU compatible. I argue that it is not:
      
        1) It does not include a null symbol.
        2) It prints the symbols based on an order derived from the hash
           table.
        3) It prints an extra column indicating which bucket it came from.
           This could break parsers that expect a fixed number of columns,
           with the first column being the symbol index.
        4) If the input happens to have both .hash and .gnu.hash section, it
           prints interpretations of them both, resulting in most symbols
           being printed twice.
        5) There is no way of just printing the raw dynamic symbol table,
           because --symbols also prints the static symbol table.
      
      This patch reverts the --dyn-symbols behaviour back to its old behaviour
      of just printing the contents of the dynamic symbol table, similar to
      what is printed by --symbols. As the hashed interpretation is still
      desirable to validate the hash table, it puts it under a new switch
      "--hash-symbols". This is a no-op on all output forms except for GNU
      output style for ELF. If there is no hash table, it does nothing,
      unlike the previous behaviour which printed the raw dynamic symbol
      table, since the raw dynsym is available under --dyn-symbols.
      
      The yaml input for the test is based on that in
      test/tools/llvm-readobj/demangle.test, but stripped down to the bare
      minimum to provide a valid dynamic symbol.
      
      Note: some LLD tests needed updating. I will commit a separate patch for
      those.
      
      Reviewed by: grimar, rupprecht
      
      Differential Revision: https://reviews.llvm.org/D56910
      
      llvm-svn: 351789
      5fc812f1
  25. Jan 19, 2019
    • Chandler Carruth's avatar
      Update the file headers across all of the LLVM projects in the monorepo · 2946cd70
      Chandler Carruth authored
      to reflect the new license.
      
      We understand that people may be surprised that we're moving the header
      entirely to discuss the new license. We checked this carefully with the
      Foundation's lawyer and we believe this is the correct approach.
      
      Essentially, all code in the project is now made available by the LLVM
      project under our new license, so you will see that the license headers
      include that license only. Some of our contributors have contributed
      code under our old license, and accordingly, we have retained a copy of
      our old license notice in the top-level files in each project and
      repository.
      
      llvm-svn: 351636
      2946cd70
  26. Jan 17, 2019
    • James Henderson's avatar
      [llvm-readobj][ELF]Add demangling support · e50d9cb3
      James Henderson authored
      This change adds demangling support to the ELF side of llvm-readobj,
      under the switch --demangle/-C.
      
      The following places are demangled: symbol table dumps (static and
      dynamic), relocation dumps (static and dynamic), addrsig dumps, call
      graph profile dumps, and group section signature symbols.
      
      Although GNU readelf doesn't support demangling, it is still a useful
      feature to have, and brings it on a par with llvm-objdump's
      capabilities.
      
      This fixes https://bugs.llvm.org/show_bug.cgi?id=40054.
      
      Reviewed by: grimar, rupprecht
      
      Differential Revision: https://reviews.llvm.org/D56791
      
      llvm-svn: 351450
      e50d9cb3
  27. Jan 15, 2019
    • Jordan Rupprecht's avatar
      [llvm-readelf] Allow single-letter flags to be merged. · 58aac950
      Jordan Rupprecht authored
      Summary:
      This patch adds support for merged arguments (e.g. -SW == -S -W) for llvm-readelf.
      
      No changes are intended for llvm-readobj. There are a few short flags (-sd, -sr, -st, -dt) that would conflict with grouped single letter flags, and having only some grouped flags might be confusing. So, allow merged flags for readelf compatibility, but force separate args for llvm-readobj. From what I can tell, these two-letter flags are only used with llvm-readobj, not llvm-readelf.
      
      This fixes PR40064.
      
      Reviewers: jhenderson, kristina, echristo, phosek
      
      Reviewed By: jhenderson
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D56629
      
      llvm-svn: 351205
      58aac950
  28. Dec 20, 2018
  29. Dec 11, 2018
  30. Nov 12, 2018
    • Jordan Rupprecht's avatar
      [llvm-readelf] Make llvm-readelf more compatible with GNU readelf. · dbf552c4
      Jordan Rupprecht authored
      Summary:
      This change adds a bunch of options that GNU readelf supports. There is one breaking change when invoked as `llvm-readobj`, and three breaking changes when invoked as `llvm-readelf`:
       - Add --all (implies --file-header, --program-headers, etc.)
       - [Breaking] -a is --all instead of --arm-attributes
       - Add --file-header as an alias for --file-headers
       - Replace --sections with --sections-headers, keeping --sections as an alias for it
       - Add --relocs as an alias for --relocations
       - Add --dynamic as an alias for --dynamic-table
       - Add --segments as an alias for --program-headers
       - Add --section-groups as an alias for --elf-section-groups
       - Add --dyn-syms as an alias for --dyn-symbols
       - Add --syms as an alias for --symbols
       - Add --histogram as an alias for --elf-hash-histogram
       - [Breaking] When invoked as `llvm-readelf`, -s is --symbols instead of --sections
       - [Breaking] When invoked as `llvm-readelf`, -t is no longer an alias for --symbols
      
      Reviewers: MaskRay, phosek, mcgrathr, jhenderson
      
      Reviewed By: MaskRay, jhenderson
      
      Subscribers: sbc100, aheejin, edd, jhenderson, silvas, echristo, compnerd, kristina, javed.absar, kristof.beyls, llvm-commits, Bigcheese
      
      Differential Revision: https://reviews.llvm.org/D54124
      
      llvm-svn: 346685
      dbf552c4
  31. Sep 15, 2018
  32. Aug 23, 2018
  33. Jul 25, 2018
  34. Jul 18, 2018
  35. Jul 11, 2018
  36. Jun 28, 2018
Loading