1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

107 Commits

Author SHA1 Message Date
Rafael Espindola
98c3e8bc71 Add a test for obj2yaml in preparation for refactoring it.
llvm-svn: 178829
2013-04-05 02:02:05 +00:00
Rafael Espindola
5e796656b1 Add back parsing of header charactestics.
It had been dropped during the switch to yaml::IO. Also add a test going
from yaml2obj to llvm-readobj. It can be extended as we add more
fields/formats to yaml2obj.

llvm-svn: 178786
2013-04-04 20:30:52 +00:00
Rafael Espindola
af01832c73 Implement the "mips endian" for r_info.
Normally r_info is just a 32 of 64 bit number matching the endian of the rest
of the file. Unfortunately, mips 64 bit little endian is special: The top 32
bits are a little endian number and the following 32 are a big endian one.

llvm-svn: 178694
2013-04-03 21:02:51 +00:00
Eric Christopher
df46cef31b Implements low-level object file format specific output for COFF and
ELF with support for:

- File headers
- Section headers + data
- Relocations
- Symbols
- Unwind data (only COFF/Win64)

The output format follows a few rules:
- Values are almost always output one per line (as elf-dump/coff-dump already do). - Many values are translated to something readable (like enum names), with the raw value in parentheses.
- Hex numbers are output in uppercase, prefixed with "0x".
- Flags are sorted alphabetically.
- Lists and groups are always delimited.

Example output:
---------- snip ----------
Sections [
  Section {
    Index: 1
    Name: .text (5)
    Type: SHT_PROGBITS (0x1)
    Flags [ (0x6)
      SHF_ALLOC (0x2)
      SHF_EXECINSTR (0x4)
    ]
    Address: 0x0
    Offset: 0x40
    Size: 33
    Link: 0
    Info: 0
    AddressAlignment: 16
    EntrySize: 0
    Relocations [
      0x6 R_386_32 .rodata.str1.1 0x0
      0xB R_386_PC32 puts 0x0
      0x12 R_386_32 .rodata.str1.1 0x0
      0x17 R_386_PC32 puts 0x0
    ]
    SectionData (
      0000: 83EC04C7 04240000 0000E8FC FFFFFFC7  |.....$..........|
      0010: 04240600 0000E8FC FFFFFF31 C083C404  |.$.........1....|
      0020: C3                                   |.|
    )
  }
]
---------- snip ----------

Relocations and symbols can be output standalone or together with the section header as displayed in the example.
This feature set supports all tests in test/MC/COFF and test/MC/ELF (and I suspect all additional tests using elf-dump), making elf-dump and coff-dump deprecated.

Patch by Nico Rieck!

llvm-svn: 178679
2013-04-03 18:31:38 +00:00
Eric Christopher
99a330354d Implement sectionContainsSymbol for ELF.
Patch by Nico Rieck!

llvm-svn: 178677
2013-04-03 18:31:19 +00:00
Eric Christopher
8cfce53956 When dumping clear the arm/thumb flag for now.
Patch by Nico Rieck!

llvm-svn: 178676
2013-04-03 18:31:12 +00:00
Shankar Easwaran
74225248db [tools][llvm-readobj] print the name of the section when iterating the symbol table / dynamic symbol table
llvm-svn: 177873
2013-03-25 16:06:51 +00:00
Michael J. Spencer
6270bca74a [llvm-readobj] Add ELF .dynamic table dumping.
llvm-svn: 175592
2013-02-20 02:37:12 +00:00
Michael J. Spencer
d9e9c95c02 [Object][ELF] Fix crash on no dynamic section.
llvm-svn: 174639
2013-02-07 18:26:45 +00:00
Michael J. Spencer
6a1aee19b4 [llvm-objdump] Emit addresses with the correct number of leading 0's.
llvm-svn: 172130
2013-01-10 22:40:50 +00:00
Michael J. Spencer
44db267406 [Object][ELF] Fix incorrect size of members for the 64 version of Elf_Phdr_Impl.
llvm-svn: 171650
2013-01-06 03:57:11 +00:00
Michael J. Spencer
b8ff7ef369 [objdump] Add --private-headers, -p.
This currently prints the ELF program headers.

llvm-svn: 171649
2013-01-06 03:56:49 +00:00
Michael J. Spencer
641cf62d29 [Object][ELF] Add a maximum alignment. This is used by createELFObjectFile to create a properly aligned reader.
llvm-svn: 171520
2013-01-04 20:36:28 +00:00
Michael J. Spencer
8246b2fd6b [Object] Temporarily disable these tests.
They are failing because archives create unaligned ELF files. The recent
Endian change added a __builtin_unreachable() when this happens. I will be
committing a fix for this soon.

llvm-svn: 171438
2013-01-03 01:24:32 +00:00
Rafael Espindola
3e79a98c7f Fix bits check in ELFObjectFile::isSectionZeroInit().
Fixes PR14723.

Patch by Sami Liedes!

llvm-svn: 171309
2012-12-31 18:20:51 +00:00
Rafael Espindola
4224ad9911 Dump sections. Extracted from a patch by Sami Liedes.
llvm-svn: 171304
2012-12-31 16:29:44 +00:00
Rafael Espindola
812bc66ae6 Print a header above the symbols. Extracted from a patch by Sami Liedes.
llvm-svn: 171302
2012-12-31 16:05:21 +00:00
Tim Northover
5f7dc099cf Teach MachO which sections contain code
llvm-svn: 170349
2012-12-17 17:59:32 +00:00
Shankar Easwaran
eb6f136f28 numerically sort the symbols, so that the testcase result is uniform
llvm-svn: 167872
2012-11-13 21:01:11 +00:00
Daniel Dunbar
6579221af6 llvm-nm: Make sort more stable when symbol names are equal.
llvm-svn: 167866
2012-11-13 19:39:55 +00:00
Shankar Easwaran
f934185b04 Adding changes to support GNU style archive library reading
llvm-svn: 167853
2012-11-13 18:38:42 +00:00
Alexey Samsonov
ad52a8844e Fix SymbolRef::getAddress implementation for ELF. The 'value' field in symbol table entry should be treated differently for relocatable and relocated files. This patch fixes symbol addresses printed by llvm-nm for executables and shared objects.
llvm-svn: 164365
2012-09-21 07:08:08 +00:00
Nick Lewycky
6e3f6cb8d7 Add missing file for test.
llvm-svn: 163272
2012-09-05 23:52:20 +00:00
Nick Lewycky
6e821e0321 Teach libObject about some more ELF relocations. llvm-objdump -r now knows
every relocation in C++ hello world built with debug info.

llvm-svn: 163271
2012-09-05 23:48:54 +00:00
NAKAMURA Takumi
46ead41fe9 Create llvm/test/Object/Mips/lit.local.cfg to check Mips in targets_to_build.
llvm-svn: 162819
2012-08-29 01:37:57 +00:00
Jack Carter
e48124ec30 Moved input for objdump test from Mips to Inputs.
llvm-svn: 162808
2012-08-29 00:10:48 +00:00
Jack Carter
c0c7230823 Some of the instructions in the Mips instruction set are revision
delimited. llvm-mc -disassemble access these through the -mattr
option.

llvm-objdump -disassemble had no such way to set the attribute so
some instructions were just not recognized for disassembly.

This patch accepts llvm-mc mechanism for specifying the attributes.

llvm-svn: 162781
2012-08-28 19:24:49 +00:00
Matt Beaumont-Gay
c2514fd0f4 Move test yaml files under Inputs until they are converted to be the actual
test files.

llvm-svn: 161219
2012-08-02 21:52:49 +00:00
Michael J. Spencer
9f255feb3f Add yaml2obj. A utility to convert YAML to binaries.
yaml2obj takes a textual description of an object file in YAML format
and outputs the binary equivalent. This greatly simplifies writing
tests that take binary object files as input.

llvm-svn: 161205
2012-08-02 19:16:56 +00:00
Marshall Clow
b34fa3efd3 Add relocation types for Hexagon processor; patch by Sidney Manning <sidneym@codeaurora.org>
llvm-svn: 159081
2012-06-23 14:46:18 +00:00
Eli Bendersky
3ef88c1833 Continue cleanup of LIT, getting rid of the remaining artifacts from dejagnu
* Removed test/lib/llvm.exp - it is no longer needed 
* Deleted the dg.exp reading code from test/lit.cfg. There are no dg.exp files
  left in the test suite so this code is no longer required. test/lit.cfg is
  now much shorter and clearer 
* Removed a lot of duplicate code in lit.local.cfg files that need access to
  the root configuration, by adding a "root" attribute to the TestingConfig
  object. This attribute is dynamically computed to provide the same
  information as was previously provided by the custom getRoot functions. 
* Documented the config.root attribute in docs/CommandGuide/lit.pod

llvm-svn: 153408
2012-03-25 09:02:19 +00:00
David Meyer
d29d7cfe60 Support reading GNU symbol versions in ELFObjectFile
* Add enums and structures for GNU version information.
* Implement extraction of that information on a per-symbol basis (ELFObjectFile::getSymbolVersion).
* Implement a generic interface, GetELFSymbolVersion(), for getting the symbol version from the ObjectFile (hides the templating).
* Have llvm-readobj print out the version, when available.
* Add a test for the new feature: readobj-elf-versioning.test

llvm-svn: 152436
2012-03-09 20:59:52 +00:00
David Meyer
7f21ecb667 [Object]
Add ObjectFile::getLoadName() for retrieving the soname/installname of a shared object.

llvm-svn: 151845
2012-03-01 22:19:54 +00:00
David Meyer
44201a2d17 [Object]
* Add begin_dynamic_table() / end_dynamic_table() private interface to ELFObjectFile.
* Add begin_libraries_needed() / end_libraries_needed() interface to ObjectFile, for grabbing the list of needed libraries for a shared object or dynamic executable.
* Implement this new interface completely for ELF, leave stubs for COFF and MachO.
* Add 'llvm-readobj' tool for dumping ObjectFile information.

llvm-svn: 151785
2012-03-01 01:36:50 +00:00
Michael J. Spencer
0aef1b9f18 [Object] Add {begin,end}_dynamic_symbols stubs and implementation for ELF.
Add -D option to llvm-nm to dump dynamic symbols.

Patch by David Meyer.

llvm-svn: 151600
2012-02-28 00:40:37 +00:00
Eli Bendersky
4afdeeb682 Replace all instances of dg.exp file with lit.local.cfg, since all tests are run with LIT now and now Dejagnu. dg.exp is no longer needed.
Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches.

llvm-svn: 150664
2012-02-16 06:28:33 +00:00
Danil Malyshev
5ce4e1a9d3 Fixed ObjectFile functions:
- getSymbolOffset() renamed as getSymbolFileOffset()
- getSymbolFileOffset(), getSymbolAddress(), getRelocationAddress() returns same result for ELFObjectFile, MachOObjectFile and COFFObjectFile.
- added getRelocationOffset()
- fixed MachOObjectFile::getSymbolSize()
- fixed MachOObjectFile::getSymbolSection()
- fixed MachOObjectFile::getSymbolOffset() for symbols without section data.

llvm-svn: 145408
2011-11-29 17:40:10 +00:00
Eli Friedman
172ff3d328 Move x86-specific tests into X86 folder.
llvm-svn: 143424
2011-11-01 03:21:48 +00:00
Matt Beaumont-Gay
6f16a87ae3 Change the actual tests to match the input directory rename (duh)
llvm-svn: 143404
2011-10-31 23:56:52 +00:00
Matt Beaumont-Gay
a5dfba561b Rename "TestObjectFiles" to "Inputs" (like the pattern for Clang tests)
llvm-svn: 143400
2011-10-31 23:46:38 +00:00
Michael J. Spencer
c59705a3bc Object: change test to create archive.
llvm-svn: 142982
2011-10-25 22:30:58 +00:00
Michael J. Spencer
f21a701890 llvm-objdump: Add static symbol table dumping.
llvm-svn: 142404
2011-10-18 19:32:17 +00:00
Michael J. Spencer
00c39291ef Revert "llvm-objdump: Add static symbol table dumping."
This reverts commit 0c30d4e4f5f9110c5a67bd0ca84444dc58697596.

llvm-svn: 142320
2011-10-18 00:17:04 +00:00
Michael J. Spencer
8c590fd08d llvm-objdump: Add static symbol table dumping.
llvm-svn: 142319
2011-10-17 23:55:22 +00:00
Michael J. Spencer
277eaf9f19 llvm-objdump: Add -s, which prints the contents of each section.
llvm-svn: 142199
2011-10-17 17:13:22 +00:00
Michael J. Spencer
689903addb llvm-objdump: Add tests.
llvm-svn: 142198
2011-10-17 17:13:05 +00:00
Michael J. Spencer
10caa055b0 ELF: Fix the section that relocations apply to. Add test to verify. Patch by Danil Malyshev!
llvm-svn: 141901
2011-10-13 22:30:10 +00:00
Michael J. Spencer
4ee36e15ad llvm-object: Add inline relocation information to disassembly.
llvm-svn: 141897
2011-10-13 22:17:18 +00:00
Nick Lewycky
73e4d372d0 Add support for dumping section headers to llvm-objdump. This uses the same
flags as binutils objdump but the output is different, not just in format but
also showing different sections. Compare its results against readelf, not
objdump.

llvm-svn: 141579
2011-10-10 21:21:34 +00:00
Michael J. Spencer
e497728e76 llvm-objdump: Add relocation and archive support.
llvm-svn: 141451
2011-10-08 00:18:30 +00:00
Michael J. Spencer
89e83b38cd Add binary archive support to llvm-nm.
llvm-svn: 140627
2011-09-27 19:37:18 +00:00
Michael J. Spencer
6510b463d3 Unbreak tests.
llvm-svn: 140622
2011-09-27 19:06:37 +00:00
Michael J. Spencer
08bf1dbce4 Revert "Object: Renable the tests now that none of the build bots complain about aliasing."
This reverts commit 281f3901b7b0869929caf8946c1ad1228bc38922.

llvm-svn: 123972
2011-01-21 06:27:04 +00:00
Michael J. Spencer
3089c44b26 Object: Renable the tests now that none of the build bots complain about aliasing.
llvm-svn: 123964
2011-01-21 05:07:13 +00:00
Devang Patel
e3e6201a2f Disable objdump-trivial-object.test. It is broken on powerpc-darwin9.
llvm-svn: 123928
2011-01-20 18:08:44 +00:00
Michael J. Spencer
d74f931baa Disable this test until I can figure out why it's broken. Not xfailed because it
usese 100% CPU and times out, so it's annoying to run it.

llvm-svn: 123915
2011-01-20 16:24:07 +00:00
Michael J. Spencer
c3f075e648 Object: Add some tests!
llvm-svn: 123899
2011-01-20 06:39:15 +00:00