1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
Commit Graph

479 Commits

Author SHA1 Message Date
Zachary Turner
13dc004006 [codeview] Refactor symbol records to use same pattern as types.
This will pave the way to introduce a full fledged symbol visitor
similar to how we have a type visitor, thus allowing the same
dumping code to be used in llvm-readobj and llvm-pdbdump.

Differential Revision: http://reviews.llvm.org/D20384
Reviewed By: rnk

llvm-svn: 270475
2016-05-23 18:49:06 +00:00
George Rimar
8a63746f19 [llvm-readobj] - Teach readobj to recognize SHF_COMPRESSED flag.
Main problem here was that SHF_COMPRESSED has the same value with
XCORE_SHF_CP_SECTION, which was included as standart (common) flag.
As far I understand xCore is a family of controllers and it that
means it's constant should be processed separately,
only if e_machine == EM_XCORE, otherwise llvm-readobj would output
different constants twice for compressed section:

Flags [
..
SHF_COMPRESSED (0x800)
..
XCORE_SHF_CP_SECTION (0x800)
..
]

what probably does not make sence if you're not working with xcore file.

Differential revision: http://reviews.llvm.org/D20273

llvm-svn: 270320
2016-05-21 10:16:58 +00:00
Rafael Espindola
3751b71001 Delete default in fully covered switch.
llvm-svn: 269872
2016-05-18 00:31:06 +00:00
Zachary Turner
d4ae961cf6 [codeview] Some cleanup of Symbol Records.
* Reworks the CVSymbolTypes.def to work similarly to TypeRecords.def.
* Moves some enums from SymbolRecords.h to CodeView.h to maintain
  consistency with how we do type records.
* Generalize a few simple things like the record prefix
* Define the leaf enum and the kind enum similar to how we do with tyep
  records.

Differential Revision: http://reviews.llvm.org/D20342
Reviewed By: amccarth, rnk

llvm-svn: 269867
2016-05-17 23:50:21 +00:00
Kevin Enderby
9024f597c5 Change llvm-objdump, llvm-nm and llvm-size when reporting an object file error
when the object is in an archive to use something like libx.a(foo.o) as part of
the error message.

Also changed llvm-objdump and llvm-size to be like llvm-nm and ignore non-object
files in archives and not produce any error message.

To do this Archive::Child::getAsBinary() was changed from ErrorOr<...> to
Expected<...> then that was threaded up to its users.

Converting this interface to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now the use of
errorToErrorCode() is still used in one place yet to be fully converted.

Again there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comments for those.

llvm-svn: 269784
2016-05-17 17:10:12 +00:00
Michael Kuperstein
a338cd2790 Remove extra semicolon to fix warning. NFC.
llvm-svn: 269722
2016-05-16 23:09:32 +00:00
Reid Kleckner
79a13a2ef0 [codeview] Add type stream merging prototype
Summary:
This code is intended to be used as part of LLD's PDB writing. Until
that exists, this is exposed via llvm-readobj for testing purposes.

Type stream merging uses the following algorithm:

- Begin with a new empty stream, and a new empty hash table that maps
  from type record contents to new type index.
- For each new type stream, maintain a map from source type index to
  destination type index.
- For each record, copy it and rewrite its type indices to be valid in
  the destination type stream.
- If the new type record is not already present in the destination
  stream hash table, append it to the destination type stream, assign it
  the next type index, and update the two hash tables.
- If the type record already exists in the destination stream, discard
  it and update the type index map to forward the source type index to
  the existing destination type index.

Reviewers: zturner, ruiu

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D20122

llvm-svn: 269521
2016-05-14 00:02:53 +00:00
Hemant Kulkarni
8e06fdb590 llvm-readobj: Fix GNU style entry point print width
llvm-svn: 269376
2016-05-12 22:51:26 +00:00
Hemant Kulkarni
83b2bb885f llvm-readobj: Change Hex output for GNU style dynamic table print
Dynamic table when printed shows uppercase tag/values.
This changes it to lower case when printing in GNU style

llvm-svn: 269368
2016-05-12 22:16:53 +00:00
Hemant Kulkarni
3dd905c415 llvm-readobj: Fix the GNU section header flags for SHF_MASKPROC and SHF_MASKOS
llvm-svn: 269338
2016-05-12 19:58:52 +00:00
Zachary Turner
26fcd8455c Make CodeView record serialization more generic.
This introduces a variadic template and some helper macros to
safely and correctly deserialize many types of common record
fields while maintaining error checking.

Differential Revision: http://reviews.llvm.org/D20183
Reviewed By: rnk, amccarth

llvm-svn: 269315
2016-05-12 17:45:44 +00:00
Reid Kleckner
9edec15443 [codeview] Move dumper into lib/DebugInfo/CodeView
So that we can call it from llvm-pdbdump.

llvm-svn: 268580
2016-05-05 00:34:33 +00:00
Reid Kleckner
362bf61d20 [codeview] Add a type visitor to help abstract away type stream handling
Summary:
Port the dumper in llvm-readobj over to it.

I'm planning to use this visitor to power type stream merging.

While we're at it, try to switch from StringRef to ArrayRef<uint8_t> in some
places.

Reviewers: zturner, amccarth

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D19899

llvm-svn: 268535
2016-05-04 19:39:28 +00:00
Simon Atanasyan
eba22b7e3c [llvm-readobj] Print MIPS .MIPS.options section content
.MIPS.options section specifies miscellaneous options to be applied
to an object file. LLVM as well as modern versions of GNU tools emit
the only type of the options - ODK_REGINFO. The patch teaches llvm-readobj
to print details of the ODK_REGINFO and skip contents of other options.

llvm-svn: 268478
2016-05-04 05:58:57 +00:00
Zachary Turner
a5e9c530d6 Move CodeViewTypeStream to DebugInfo/CodeView
Ability to parse codeview type streams is also needed by
DebugInfoPDB for parsing PDBs, so moving this into a library
gives us this option.  Since DebugInfoPDB had already hand
rolled some code to do this, that code is now convereted over
to using this common abstraction.

Differential Revision: http://reviews.llvm.org/D19887
Reviewed By: dblaikie, amccarth

llvm-svn: 268454
2016-05-03 22:18:17 +00:00
Reid Kleckner
a6cfc92d4d [codeview] Maintain the type enum-to-classname mapping in the .def file
This way it will be easy to stamp out something like a type visitor.

llvm-svn: 268347
2016-05-03 00:45:14 +00:00
Zachary Turner
6491f0eb80 Move llvm-readobj/StreamWriter to Support.
We wish to re-use this from llvm-pdbdump, and it provides a nice
way to print structured data in scoped format that could prove
useful for many other dumping tools as well.  Moving to support
and changing name to ScopedPrinter to better reflect its purpose.

llvm-svn: 268342
2016-05-03 00:28:04 +00:00
Adrian McCarthy
9b867bb7ee NFC: An iterator for stepping through CodeView type stream in llvm-readobj
This is a small refactoring step toward moving CodeView type stream logic from llvm-readobj to a library. It abstracts the logic of stepping through the stream into an iterator class and updates llvm-readobj to use that iterator. This has no functional change; llvm-readobj produces identical output.

The next step is to abstract the parsing of the different leaf types and then move that and the iterator into a library.

Since this is my first contrib outside LLDB, please let me know if I'm messing up on any of the LLVM style guidelines, idioms, or patterns.

Differential Revision: http://reviews.llvm.org/D19746

llvm-svn: 268334
2016-05-02 23:45:03 +00:00
Reid Kleckner
b62457c5eb [codeview] Isolate type dumping from object file state
This isolates the state we use for type dumping from the knowledge of
object files. We can use CVTypeDumper to dump types from anywhere in
memory now.

NFC

Reviewers: zturner

Differential Revision: http://reviews.llvm.org/D19824

llvm-svn: 268300
2016-05-02 20:30:47 +00:00
Kevin Enderby
f7223e444c Thread Expected<...> up from libObject’s getType() for symbols to allow llvm-objdump to produce a good error message.
Produce another specific error message for a malformed Mach-O file when a symbol’s
section index is more than the number of sections.  The existing test case in test/Object/macho-invalid.test
for macho-invalid-section-index-getSectionRawName now reports the error with the message indicating
that a symbol at a specific index has a bad section index and that bad section index value.

Again converting interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. Where the existing code reported the error with a
string message or an error code it was converted to do the same.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
"// TODO: Actually report errors helpfully" and a call something like
consumeError(NameOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

llvm-svn: 268298
2016-05-02 20:28:12 +00:00
Reid Kleckner
fc799ce0a8 [codeview] Don't dump type stream bytes unless asked to
llvm-svn: 268271
2016-05-02 18:10:00 +00:00
Davide Italiano
92ff603010 [llvm-readobj] Dump hash as part of -version-info.
llvm-svn: 268210
2016-05-02 02:30:18 +00:00
Kevin Enderby
92582f2b18 Thread Expected<...> up from libObject’s getName() for symbols to allow llvm-objdump to produce a good error message.
Produce another specific error message for a malformed Mach-O file when a symbol’s
string index is past the end of the string table.  The existing test case in test/Object/macho-invalid.test
for macho-invalid-symbol-name-past-eof now reports the error with the message indicating
that a symbol at a specific index has a bad sting index and that bad string index value.
 
Again converting interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. Where the existing code reported the error with a
string message or an error code it was converted to do the same.  There is some
code for this that could be factored into a routine but I would like to leave that for
the code owners post-commit to do as they want for handling an llvm::Error.  An
example of how this could be done is shown in the diff in
lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h which had a Check() routine
already for std::error_code so I added one like it for llvm::Error .

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(NameOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there fixes needed to lld that goes along with this that I will commit right after this.
So expect lld not to built after this commit and before the next one.

llvm-svn: 266919
2016-04-20 21:24:34 +00:00
Mehdi Amini
9ff867f98c [NFC] Header cleanup
Removed some unused headers, replaced some headers with forward class declarations.

Found using simple scripts like this one:
clear && ack --cpp -l '#include "llvm/ADT/IndexedMap.h"' | xargs grep -L 'IndexedMap[<]' | xargs grep -n --color=auto 'IndexedMap'

Patch by Eugene Kosov <claprix@yandex.ru>

Differential Revision: http://reviews.llvm.org/D19219

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 266595
2016-04-18 09:17:29 +00:00
Reid Kleckner
2dac2c60ff [codeview] Dump char16_t and char32_t simple types
llvm-svn: 266465
2016-04-15 18:26:45 +00:00
Hemant Kulkarni
6e8f9c1c5f [llvm-readobj] Add ELF hash histogram printing
Differential Revision: http://reviews.llvm.org/D18907

llvm-svn: 265967
2016-04-11 17:15:30 +00:00
Kevin Enderby
a6534d0295 Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message
Produce the first specific error message for a malformed Mach-O file describing
the problem instead of the generic message for object_error::parse_failed of
"Invalid data was encountered while parsing the file”.  Many more good error
messages will follow after this first one.

This is built on Lang Hames’ great work of adding the ’Error' class for
structured error handling and threading Error through MachOObjectFile
construction.  And making createMachOObjectFile return Expected<...> .

So to to get the error to the llvm-obdump tool, I changed the stack of
these methods to also return Expected<...> :

  object::ObjectFile::createObjectFile()
  object::SymbolicFile::createSymbolicFile()
  object::createBinary()

Then finally in ParseInputMachO() in MachODump.cpp the error can
be reported and the specific error message can be printed in llvm-objdump
and can be seen in the existing test case for the existing malformed binary
but with the updated error message.

Converting these interfaces to Expected<> from ErrorOr<> does involve
touching a number of places. To contain the changes for now use of
errorToErrorCode() and errorOrToExpected() are used where the callers
are yet to be converted.

Also there some were bugs in the existing code that did not deal with the
old ErrorOr<> return values.  So now with Expected<> since they must be
checked and the error handled, I added a TODO and a comment:
“// TODO: Actually report errors helpfully” and a call something like
consumeError(ObjOrErr.takeError()) so the buggy code will not crash
since needed to deal with the Error.

Note there is one fix also needed to lld/COFF/InputFiles.cpp that goes along
with this that I will commit right after this.  So expect lld not to built
after this commit and before the next one.

llvm-svn: 265606
2016-04-06 22:14:09 +00:00
Duncan P. N. Exon Smith
5f366e4aa0 Revert "Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes."
This reverts commit r265454 since it broke the build.  E.g.:

  http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_build/22413/

llvm-svn: 265459
2016-04-05 20:45:04 +00:00
Eugene Zelenko
a612bac11f Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.

Use anonymous namespaces in source files.

Differential revision: http://reviews.llvm.org/D18778

llvm-svn: 265454
2016-04-05 20:19:49 +00:00
Rafael Espindola
109cdd5b5d Use ArrayRef for contiguous areas in ELF. NFC.
This just simplifies the code a bit. More so in lld.

llvm-svn: 265403
2016-04-05 14:47:22 +00:00
Aaron Ballman
32225c3c15 Silencing warnings from MSVC 2015 Update 2. All of these changes silence "C4334 '<<': result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)". NFC.
llvm-svn: 264929
2016-03-30 21:30:00 +00:00
Hemant Kulkarni
1e7498594c [llvm-readobj] NFC: Remove unneeded parenthesis
llvm-svn: 264731
2016-03-29 14:20:20 +00:00
Hemant Kulkarni
4060c036e8 [llvm-readobj] Support GNU style dyn-relocations
http://reviews.llvm.org/D18534

llvm-svn: 264693
2016-03-29 02:41:49 +00:00
Hemant Kulkarni
34d53f682b [llvm-readobj] NFC Replace case by macros for PT_* enums
llvm-svn: 264595
2016-03-28 17:20:23 +00:00
Hemant Kulkarni
f8edcd154f Fix Narrowing conversion warning introduced by r264415
llvm-svn: 264419
2016-03-25 16:37:03 +00:00
Hemant Kulkarni
8b63e79e81 [llvm-readobj] Impl GNU style program headers print
readelf -lW

Differential Revision: http://reviews.llvm.org/D18372

llvm-svn: 264415
2016-03-25 16:04:48 +00:00
Simon Atanasyan
a5a68b8d26 [llvm-readobj] Decode st_other symbol's flags
The patch supports common STV_xxx visibility flags and MIPS specific
STO_MIPS_xxx flags.

Differential Revision: http://reviews.llvm.org/D18447

llvm-svn: 264300
2016-03-24 16:10:37 +00:00
Kevin Enderby
1a15e5c9c5 Fix a crash in running llvm-objdump -t with an invalid Mach-O file already
in the test suite. While this is not really an interesting tool and option to run
on a Mach-O file to show the symbol table in a generic libObject format
it shouldn’t crash.

The reason for the crash was in MachOObjectFile::getSymbolType() when it was
calling MachOObjectFile::getSymbolSection() without checking its return value
for the error case.

What makes this fix require a fair bit of diffs is that the method getSymbolType() is
in the class ObjectFile defined without an ErrorOr<> so I needed to add that all
the sub classes.  And all of the uses needed to be updated and the return value
needed to be checked for the error case.

The MachOObjectFile version of getSymbolType() “can” get an error in trying to
come up with the libObject’s internal SymbolRef::Type when the Mach-O symbol
symbol type is an N_SECT type because the code is trying to select from the
SymbolRef::ST_Data or SymbolRef::ST_Function values for the SymbolRef::Type.
And it needs the Mach-O section to use isData() and isBSS to determine if
it will return SymbolRef::ST_Data.

One other possible fix I considered is to simply return SymbolRef::ST_Other
when MachOObjectFile::getSymbolSection() returned an error.  But since in
the past when I did such changes that “ate an error in the libObject code” I
was asked instead to push the error out of the libObject code I chose not
to implement the fix this way.

As currently written both the COFF and ELF versions of getSymbolType()
can’t get an error.  But if isReservedSectionNumber() wanted to check for
the two known negative values rather than allowing all negative values or
the code wanted to add the same check as in getSymbolAddress() to use
getSection() and check for the error then these versions of getSymbolType()
could return errors.

At the end of the day the error printed now is the generic “Invalid data was
encountered while parsing the file” for object_error::parse_failed.  In the
future when we thread Lang’s new TypedError for recoverable error handling
though libObject this will improve.  And where the added // Diagnostic(…
comment is, it would be changed to produce and error message
like “bad section index (42) for symbol at index 8” for this case.

llvm-svn: 264187
2016-03-23 20:27:00 +00:00
Hemant Kulkarni
863937f139 [llvm-readobj] Impl GNU style symbols printing
Implements "readelf -sW and readelf -DsW"

Differential Revision: http://reviews.llvm.org/D18224

llvm-svn: 263952
2016-03-21 17:18:23 +00:00
Hemant Kulkarni
46e5dcc160 [llvm-readobj] Impl GNU style printing of sections and relocations
Differential Revision: http://reviews.llvm.org/D17523

llvm-svn: 263561
2016-03-15 17:25:31 +00:00
Lang Hames
e025323d29 [MachO] Add MachO alt-entry directive support.
This patch adds support for the MachO .alt_entry assembly directive, and uses
it for global aliases with non-zero GEP offsets. The alt_entry flag indicates
that a symbol should be layed out immediately after the preceding symbol.
Conceptually it introduces an alternate entry point for a function or data
structure. E.g.:

safe_foo:
  // check preconditions for foo
.alt_entry fast_foo
fast_foo:
  // body of foo, can assume preconditions.

The .alt_entry flag is also implicitly set on assembly aliases of the form:

a = b + C

where C is a non-zero constant, since these have the same effect as an
alt_entry symbol: they introduce a label that cannot be moved relative to the
preceding one. Setting the alt_entry flag on aliases of this form fixes
http://llvm.org/PR25381.

llvm-svn: 263521
2016-03-15 01:43:05 +00:00
Hemant Kulkarni
d5ee8e8e81 [llvm-readobj] Enable GNU style section group print
Differential Revision: http://reviews.llvm.org/D17822

llvm-svn: 263050
2016-03-09 19:16:13 +00:00
Tim Northover
352af6b0a6 Fix typo. NFC.
llvm-svn: 262405
2016-03-01 21:45:22 +00:00
Jacques Pienaar
ea54ef2b77 [lanai] Add ELF enum value and relocations.
Add ELF enum value and relocations for Lanai backed.

General Lanai backend discussion on llvm-dev thread "[RFC] Lanai backend" (http://lists.llvm.org/pipermail/llvm-dev/2016-February/095118.html).

Differential Revision: http://reviews.llvm.org/D17008

llvm-svn: 262394
2016-03-01 21:21:42 +00:00
Hemant Kulkarni
4d7cb7c1de Reverts change r261907 and r261918
llvm-svn: 261927
2016-02-25 20:47:07 +00:00
Hemant Kulkarni
afbfbdc65e Fix endianness issue on BE machines introduced by r261907
llvm-svn: 261918
2016-02-25 18:56:01 +00:00
Hemant Kulkarni
616aef8e81 [llvm-readobj] Enable GNU style sections and relocations printing
http://reviews.llvm.org/D17523

llvm-svn: 261907
2016-02-25 18:02:00 +00:00
Richard Trieu
5a759985de Remove uses of builtin comma operator.
Cleanup for upcoming Clang warning -Wcomma.  No functionality change intended.

llvm-svn: 261270
2016-02-18 22:09:30 +00:00
Michael J. Spencer
0b378f1883 [readobj] Remove uneeded braces in case statement.
llvm-svn: 261170
2016-02-17 22:30:41 +00:00
Rafael Espindola
b74768f2e2 Represent the dynamic table itself with a DynRegionInfo.
The dynamic table is also an array of a fixed structure, so it can be
represented with a DynReginoInfo.

No major functionality change. The extra error checking is covered by
existing tests with a broken dynamic program header.

Idea extracted from r260488. I did the extra cleanups.

llvm-svn: 261107
2016-02-17 16:48:00 +00:00
Rafael Espindola
d1106791d2 Add a unwrapOrError utility and use it to simplify ELFDumper.cpp.
Utility extracted from r260488.

llvm-svn: 261103
2016-02-17 16:21:49 +00:00
Rafael Espindola
6da20ee54a Change how readobj stores info about dynamic symbols.
We used to keep both a section and a pointer to the first symbol.

The oddity of keeping a section for dynamic symbols is because there is
a DT_SYMTAB but no DT_SYMTABZ, so to print the table we have to find the
size via a section table.

The reason for still keeping a pointer to the first symbol is because we
want to be able to print relocation tables even if the section table is
missing (it is mandatory only for files used in linking).

With this patch we keep just a DynRegionInfo. This then requires
changing a few places that were asking for a Elf_Shdr but actually just
needed the first symbol.

The test change is to delete the program header pointer.
Now that we use the information of both DT_SYMTAB and .dynsym, we don't
depend on the sh_entsize of .dynsym if we see DT_SYMTAB.

Note: It is questionable if it is worth it putting the effort to report
broken sh_entsize given that in files with no section table we have to
assume it is sizeof(Elf_Sym), but that is for another change.

Extracted from r260488.

llvm-svn: 261099
2016-02-17 15:38:21 +00:00
Rafael Espindola
5bff063f80 Reapply r260489.
Original commit message:

[readobj] Dump DT_JMPREL relocations when outputting dynamic relocations.

The bits of r260488 it depends on have been committed.

llvm-svn: 260970
2016-02-16 15:16:00 +00:00
Rafael Espindola
7f9a56c892 Introduce a getAsRange helper.
This requires making an error message a bit more generic, but that seems
a reasonable tradeoff.

Extracted from r260488 but simplified a bit.

llvm-svn: 260967
2016-02-16 14:50:39 +00:00
Rafael Espindola
784b0296aa Move DynRegionInfo out of the ELFDumper.
This reduces indentation in preparation to adding a bit more code to it.

Extracted from r260488.

llvm-svn: 260963
2016-02-16 14:27:33 +00:00
Rafael Espindola
5c95668155 This reverts commit r260488 and r260489.
Original messages:
    Revert "[readobj] Handle ELF files with no section table or with no program headers."
    Revert "[readobj] Dump DT_JMPREL relocations when outputting dynamic relocations."

r260489 depends on r260488 and among other issues r260488 deleted error
handling code.

llvm-svn: 260962
2016-02-16 14:17:48 +00:00
Reid Kleckner
9e7cb55466 [codeview] Dump def range lengths in hex
It makes it easier to correlate with assembly dumps, which are typically
given with hex offsets.

llvm-svn: 260619
2016-02-11 23:40:14 +00:00
Michael J. Spencer
e7d9c3a84d [readobj] Dump DT_JMPREL relocations when outputting dynamic relocations.
llvm-svn: 260489
2016-02-11 04:59:53 +00:00
Michael J. Spencer
4b64c43150 [readobj] Handle ELF files with no section table or with no program headers.
This adds support for finding the dynamic table and dynamic symbol table via
the section table or the program header table. If there's no section table an
attempt is made to figure out the length of the dynamic symbol table.

llvm-svn: 260488
2016-02-11 04:59:45 +00:00
Michael J. Spencer
73a3cc2d7b [readobj] Move dynamic table parsing to a new function. NFC.
llvm-svn: 260487
2016-02-11 04:59:37 +00:00
Michael J. Spencer
d1aa7af498 [readobj] Sort switch by enum value.
Sort by enum value, but keep related entries adjacent. This makes it
easier to compare against documentation.

llvm-svn: 260486
2016-02-11 04:59:32 +00:00
Michael J. Spencer
b431964b1b [readobj] Parse sections before dynamic table.
NFC. This code will be expanded to handle dynamic tables that don't have a
PT_DYNAMIC.

llvm-svn: 260485
2016-02-11 04:59:26 +00:00
Hemant Kulkarni
a10309f126 Fix const confusion while lambda function usage
llvm-svn: 260484
2016-02-11 03:41:34 +00:00
Hemant Kulkarni
90ba322b26 Fix build failure caused in r260430
llvm-svn: 260471
2016-02-11 00:01:47 +00:00
Hemant Kulkarni
2e703c67d0 [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260430
2016-02-10 20:40:55 +00:00
Hemant Kulkarni
7bee7c2cd0 Revert "[llvm-readobj] Option to emit readelf like output"
This reverts commit a58765909660a7195b32e0cc8c7476168b913750.

llvm-svn: 260397
2016-02-10 18:21:01 +00:00
Hemant Kulkarni
212037f7cf [llvm-readobj] Option to emit readelf like output
New option --elf-output-style=LLVM or GNU
Enables -file-headers in readelf style when elf-output-style=GNU

Differential revision: http://reviews.llvm.org/D14128

llvm-svn: 260391
2016-02-10 17:51:28 +00:00
Simon Atanasyan
9bb8f93c03 [llvm-readobj][ELF] Show MIPS GOT content when there is another zero-sized section at the same address
It is possible to have .got section and one or more zero-sized section
at the same address. This patch first checks that GOT (or GOT PLT)
section should have non-zero size using corresponding dynamic tags. Then
it looks up not empty section at the specified address.

Differential Revision: http://reviews.llvm.org/D16968

llvm-svn: 260245
2016-02-09 18:45:35 +00:00
Reid Kleckner
212c354887 [codeview] Dump a missing field and change its signedness
llvm-svn: 259904
2016-02-05 19:15:45 +00:00
David Majnemer
85fe175353 Correctly handle {Always,Never}StepIntoLine
llvm-svn: 259806
2016-02-04 17:57:12 +00:00
David Majnemer
2b3e2654f3 Add support for S_DEFRANGE and S_DEFRANGE_SUBFIELD
llvm-svn: 259805
2016-02-04 17:37:30 +00:00
David Majnemer
582e75c661 Make the dumper's output for variable ranges easier to read
llvm-svn: 259804
2016-02-04 17:29:13 +00:00
David Majnemer
7643865fe5 Print the OffsetStart field's relocation
llvm-svn: 259723
2016-02-03 22:45:21 +00:00
David Majnemer
06715d7c34 [llvm-readobj] Add support for dumping S_DEFRANGE symbols
llvm-svn: 259719
2016-02-03 22:36:46 +00:00
Reid Kleckner
ac609ef508 [codeview] Wire up the .cv_inline_linetable directive
This directive emits the binary annotations that describe line and code
deltas in inlined call sites. Single-stepping through inlined frames in
windbg now works.

llvm-svn: 259535
2016-02-02 17:41:18 +00:00
Reid Kleckner
884e80edd3 [CodeView] Fix dumping the is_stmt bit from the line table
Bug pointed out by George Rimar.

llvm-svn: 259205
2016-01-29 16:39:04 +00:00
Reid Kleckner
52a5e5edf7 Reland "[CodeView] Use assembler directives for line tables"
This reverts commit r259126 and relands r259117.

This time with updated library dependencies.

llvm-svn: 259130
2016-01-29 00:49:42 +00:00
Reid Kleckner
5bd9b33ade Revert "[CodeView] Use assembler directives for line tables"
This reverts commit r259117.

The LineInfo constructor is defined in the codeview library and we have
to link against it now. Doing that isn't trivial, so reverting for now.

llvm-svn: 259126
2016-01-29 00:13:28 +00:00
Reid Kleckner
152804f593 Silence gcc warning about ternary and enumerations
llvm-svn: 259123
2016-01-28 23:59:35 +00:00
Reid Kleckner
7cc33b4fa4 [CodeView] Use assembler directives for line tables
Adds a new family of .cv_* directives to LLVM's variant of GAS syntax:

- .cv_file: Similar to DWARF .file directives

- .cv_loc: Similar to the DWARF .loc directive, but starts with a
  function id. CodeView line tables are emitted by function instead of
  by compilation unit, so we needed an extra field to communicate this.
  Rather than overloading the .loc direction further, we decided it was
  better to have our own directive.

- .cv_stringtable: Emits the codeview string table at the current
  position. Currently this just contains the filenames as
  null-terminated strings.

- .cv_filechecksums: Emits the file checksum table for all files used
  with .cv_file so far. There is currently no support for emitting
  actual checksums, just filenames.

This moves the line table emission code down into the assembler.  This
is in preparation for implementing the inlined call site line table
format. The inline line table format encoding algorithm requires knowing
the absolute code offsets, so it must run after the assembler has laid
out the code.

David Majnemer collaborated on this patch.

llvm-svn: 259117
2016-01-28 23:31:52 +00:00
Benjamin Kramer
7bb55f0a55 One more batch of self-containing headers.
llvm-svn: 258974
2016-01-27 19:29:56 +00:00
Benjamin Kramer
60da2d6edb Remove superfluous call to std::to_string that's breaking the cygwin build.
llvm-svn: 258928
2016-01-27 13:22:39 +00:00
Chris Bieneman
1b8d4f74aa Remove autoconf support
Summary:
This patch is provided in preparation for removing autoconf on 1/26. The proposal to remove autoconf on 1/26 was discussed on the llvm-dev thread here: http://lists.llvm.org/pipermail/llvm-dev/2016-January/093875.html

"I felt a great disturbance in the [build system], as if millions of [makefiles] suddenly cried out in terror and were suddenly silenced. I fear something [amazing] has happened."
- Obi Wan Kenobi

Reviewers: chandlerc, grosbach, bob.wilson, tstellarAMD, echristo, whitequark

Subscribers: chfast, simoncook, emaste, jholewinski, tberghammer, jfb, danalbert, srhines, arsenm, dschuff, jyknight, dsanders, joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D16471

llvm-svn: 258861
2016-01-26 21:29:08 +00:00
Hemant Kulkarni
cf95660c3e Fix comparison warning (r258845)
llvm-svn: 258856
2016-01-26 20:38:15 +00:00
Hemant Kulkarni
01d2899e13 Fixes build break introduced by r258845
llvm-svn: 258854
2016-01-26 20:28:15 +00:00
Hemant Kulkarni
e89fec8eee [llvm-readobj] Add -elf-section-groups option
Adds a way to inspect SHT_GROUP sections in ELF objects.
Displays signature, member sections of these sections.

Differential revision: http://reviews.llvm.org/D16555

llvm-svn: 258845
2016-01-26 19:46:39 +00:00
Bradley Smith
849b958836 [ARM] Add DSP build attribute and extension targeting
This patch was originally committed as r257885, but was reverted due to windows
failures. The cause of these failures has been fixed under r258677, hence
re-committing the original patch.

llvm-svn: 258683
2016-01-25 11:26:11 +00:00
Reid Kleckner
13f2abc913 [readobj] Print CodeOffset first, it's easier to read
llvm-svn: 258368
2016-01-20 23:21:14 +00:00
Simon Atanasyan
65cb28f51e [llvm-readobj][ELF] Teach llvm-readobj to show arch specific ELF section's flags
Some architecture specific ELF section flags might have the same value
(for example SHF_X86_64_LARGE and SHF_HEX_GPREL) and we have to check
machine architectures to select an appropriate set of possible flags.

The patch selects architecture specific flags into separate arrays
`ElfxxxSectionFlags` and combines `ElfSectionFlags` and `ElfxxxSectionFlags`
before pass to the `StreamWriter::printFlags()` method.

Differential Revision: http://reviews.llvm.org/D16269

llvm-svn: 258334
2016-01-20 19:15:18 +00:00
Rafael Espindola
392af636a2 Use new function name. NFC.
llvm-svn: 258079
2016-01-18 20:55:24 +00:00
Simon Atanasyan
d7e809052f [llvm-readobj][ELF] s/dyn_rela_/dyn_rel_/ No functional changes.
Follow up to r258001. These template functions might return both REL and RELA
relocations. The 'rel' noun looks less ambiguous.

llvm-svn: 258060
2016-01-18 18:52:04 +00:00
Simon Atanasyan
8a2e38211d [llvm-readobj][ELF] Teach llvm-readobj to show dynamic relocation in REL format
MIPS 32-bit ABI uses REL relocation record format to save dynamic
relocations. The patch teaches llvm-readobj to show dynamic relocations
in this format.

Differential Revision: http://reviews.llvm.org/D16114

llvm-svn: 258001
2016-01-16 22:40:09 +00:00
George Rimar
2c81d923b3 Fixed CRLF->LF line endings from r257914. NFC.
llvm-svn: 257990
2016-01-16 10:38:32 +00:00
Davide Italiano
2af46a6b49 [llvm-readobj] Dump DT_RELACOUNT correctly.
llvm-svn: 257988
2016-01-16 06:06:36 +00:00
George Rimar
69e98e04dd Revert of 57967
Initial commit message:
CRLF -> LF. NFC

llvm-svn: 257973
2016-01-16 00:49:19 +00:00
George Rimar
50785f88d1 CRLF -> LF. NFC
llvm-svn: 257967
2016-01-16 00:14:21 +00:00
Reid Kleckner
1df6da7658 [codeview] Handle multiple frame descriptions in readobj
llvm-svn: 257943
2016-01-15 22:09:13 +00:00
Reid Kleckner
3937bf8e5a # This is a combination of 2 commits.
# The first commit's message is:

Revert "[ARM] Add DSP build attribute and extension targeting"

This reverts commit b11cc50c0b4a7c8cdb628abc50b7dc226ff583dc.

# This is the 2nd commit message:

Revert "[ARM] Add new system registers to ARMv8-M Baseline/Mainline"

This reverts commit 837d08454e3e5beb8581951ac26b22fa07df3cd5.

llvm-svn: 257916
2016-01-15 18:31:29 +00:00
George Rimar
4f2e6d2b92 Recommit r257912
Added forgotten ELFDumper.cpp to commit.

Initial commit message:
[llvm-readobj] Add support for TLSDESC_PLT and TLSDESC_GOT dynamic section tags to the llvm-readobj.

If module uses uses lazy TLSDESC relocations it should define DT_TLSDESC_PLT and DT_TLSDESC_GOT entries.
They were unknown for llvm-readobj before this patch.

Differential revision: http://reviews.llvm.org/D16224

llvm-svn: 257914
2016-01-15 18:21:34 +00:00
Reid Kleckner
94ce0c4f6b [codeview] Dump the file checksum substream
llvm-svn: 257910
2016-01-15 18:06:25 +00:00