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

161 Commits

Author SHA1 Message Date
NAKAMURA Takumi
955efe24ce [CMake] Update LLVM_LINK_COMPONENTS for each CMakeLists.txt.
llvm-svn: 196908
2013-12-10 11:13:32 +00:00
Simon Atanasyan
620a19c0b4 Add support for DT_VERxxx and DT_MIPS_xxx .dynamic section entries to the
llvm-readobj.

The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D2113

llvm-svn: 194421
2013-11-11 20:51:48 +00:00
Simon Atanasyan
724835dff7 [Mips] Teach llvm-readobj to print MIPS-specific ELF program headers.
The patch reviewed by Michael Spencer.
http://llvm-reviews.chandlerc.com/D1846

llvm-svn: 192093
2013-10-07 08:58:27 +00:00
Rafael Espindola
a279462828 Remove several unused variables.
Patch by Alp Toker.

llvm-svn: 191757
2013-10-01 13:32:03 +00:00
Benjamin Kramer
e8d495c088 ELF: Add support for the exclude section bit for gas compat.
llvm-svn: 190769
2013-09-15 19:53:20 +00:00
Joerg Sonnenberger
930841271b Print string value for DT_RPATH and DT_RUNPATH.
llvm-svn: 189829
2013-09-03 17:13:53 +00:00
Charles Davis
5191e0b0d0 Move everything depending on Object/MachOFormat.h over to Support/MachO.h.
llvm-svn: 189728
2013-09-01 04:28:48 +00:00
Charles Davis
6e439dabdb Revert "Fix the build broken by r189315." and "Move everything depending on Object/MachOFormat.h over to Support/MachO.h."
This reverts commits r189319 and r189315. r189315 broke some tests on what I
believe are big-endian platforms.

llvm-svn: 189321
2013-08-27 05:38:30 +00:00
Charles Davis
cecfbfaf57 Move everything depending on Object/MachOFormat.h over to Support/MachO.h.
llvm-svn: 189315
2013-08-27 05:00:43 +00:00
Benjamin Kramer
9fc7b995f2 Remove byte order mark from source file.
llvm-svn: 188066
2013-08-09 10:31:14 +00:00
Michael J. Spencer
8cdf1cca41 [Object] Split the ELF interface into 3 parts.
* ELFTypes.h contains template magic for defining types based on endianess, size, and alignment.
* ELFFile.h defines the ELFFile class which provides low level ELF specific access.
* ELFObjectFile.h contains ELFObjectFile which uses ELFFile to implement the ObjectFile interface.

llvm-svn: 188022
2013-08-08 22:27:13 +00:00
Rafael Espindola
32f9d6abe2 Remove the mblaze backend from llvm.
Approval in here http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-July/064169.html

llvm-svn: 187145
2013-07-25 18:55:05 +00:00
Rui Ueyama
f2baef0d6e Retry submitting r186623: COFFDumper: Dump data directory entries.
The original change was rolled back in r186627 because of test
failures on the big endian machine. I believe I fixed the issue
so re-submitting.

llvm-svn: 186734
2013-07-19 23:23:29 +00:00
Rui Ueyama
a76fe75d32 Revert "COFFDumper: Dump data directory entries."
Because it broke s390x and ppc64-linux buildbots. This reverts commit r186623.

llvm-svn: 186627
2013-07-18 23:15:50 +00:00
Rui Ueyama
f7419da108 COFFDumper: Dump data directory entries.
Summary:
Dump optional data directory entries in the PE/COFF header, so that
we can test the output of LLD linker. This patch updates the test binary
file, but the source of the binary is the same. I just re-linked the file.
I don't know how the previous file was linked, but the previous file did
not have any data directory entries for some reason.

Reviewers: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D1148

llvm-svn: 186623
2013-07-18 22:44:20 +00:00
Benjamin Kramer
de21845555 COFFDumper: Print uint64_t with the right format string.
I wish we could typecheck llvm::format.

llvm-svn: 185766
2013-07-06 20:01:46 +00:00
Rafael Espindola
cf72593c14 Don't link with the archive library programs that don't use it.
llvm-svn: 184081
2013-06-17 15:29:46 +00:00
Rui Ueyama
9fac39d7e4 readobj: Dump PE/COFF optional records.
These records are mandatory for executables and are used by the loader.

Reviewers: rafael

CC: llvm-commits

Differential Revision: http://llvm-reviews.chandlerc.com/D939

llvm-svn: 183852
2013-06-12 19:10:33 +00:00
Rafael Espindola
6f41305fd8 Handle relocations that don't point to symbols.
In ELF (as in MachO), not all relocations point to symbols. Represent this
properly by using a symbol_iterator instead of a SymbolRef. Update llvm-readobj
ELF's dumper to handle relocatios without symbols.

llvm-svn: 183284
2013-06-05 01:33:53 +00:00
Rafael Espindola
8d7780bd2b Introduce convenience typedefs for the 4 ELF object types.
llvm-svn: 181509
2013-05-09 13:13:28 +00:00
Rafael Espindola
56fa3ce519 Change getRelocationAdditionalInfo to be ELF only.
It was only implemented for ELF where it collected the Addend, so this
patch also renames it to getRelocationAddend.

llvm-svn: 181502
2013-05-09 03:39:05 +00:00
Amara Emerson
036eb4649d Revert r181009.
llvm-svn: 181079
2013-05-03 23:57:17 +00:00
Amara Emerson
863672f436 Add support for reading ARM ELF build attributes.
Build attribute sections can now be read if they exist via ELFObjectFile, and
the llvm-readobj tool has been extended with an option to dump this information
if requested. Regression tests are also included which exercise these features.

Also update the docs with a fixed ARM ABI link and a new link to the Addenda
which provides the build attributes specification.

llvm-svn: 181009
2013-05-03 11:36:35 +00:00
Rafael Espindola
9541db893e Clarify getRelocationAddress x getRelocationOffset a bit.
getRelocationAddress is for dynamic libraries and executables,
getRelocationOffset for relocatable objects.

Mark the getRelocationAddress of COFF and MachO as not implemented yet. Add a
test of ELF's. llvm-readobj -r now prints the same values as readelf -r.

llvm-svn: 180259
2013-04-25 12:28:45 +00:00
Rafael Espindola
9e7ded9509 Use pointers to iterate over symbols.
While here, don't report a dummy symbol for relocations that don't have symbols.
We used to says such relocations were for the first defined symbol, but now we
return end_symbols(). The llvm-readobj output change agrees with otool.

llvm-svn: 180214
2013-04-24 19:47:55 +00:00
Nico Rieck
1a6cd3f7df llvm-readobj: Dump more COFF auxiliary records
llvm-svn: 180007
2013-04-22 08:35:11 +00:00
Nico Rieck
d2aff3295e llvm-readobj: Check for null section pointer
llvm-svn: 180006
2013-04-22 08:34:59 +00:00
Nico Rieck
bb000645f5 llvm-readobj: Do not print NULL StringRefs
llvm-svn: 180005
2013-04-22 08:34:46 +00:00
Rafael Espindola
c44b97c596 At Jim Grosbach's request detemplate Object/MachO.h.
We are still able to handle mixed endian objects by swapping one struct at a
time.

llvm-svn: 179778
2013-04-18 18:08:55 +00:00
Rafael Espindola
75e5e1335a Remove getters now that we can specialize structs on the host endianness.
llvm-svn: 179534
2013-04-15 16:08:02 +00:00
Rafael Espindola
7beab5afc5 Finish templating MachObjectFile over endianness.
We are now able to handle big endian macho files in llvm-readobject. Thanks to
David Fang for providing the object files.

llvm-svn: 179440
2013-04-13 01:45:40 +00:00
Nico Rieck
e4564483fb Teach llvm-readobj to print ELF program headers
llvm-svn: 179363
2013-04-12 04:07:39 +00:00
Nico Rieck
ba720923ae Add -expand-relocs to llvm-readobj
This option expands shown relocations from single line to a dictionary
format:

  Relocation {
    Offset: 0x4
    Type: R_386_32 (1)
    Symbol: sym
    Info: 0x0
  }

llvm-svn: 179359
2013-04-12 04:01:52 +00:00
Rafael Espindola
af3cfcbc9f Add 179294 back, but don't use bit fields so that it works on big endian hosts.
Original message:

Print more information about relocations.

With this patch llvm-readobj now prints if a relocation is pcrel, its length,
if it is extern and if it is scattered.

It also refactors the code a bit to use bit fields instead of shifts and
masks all over the place.

llvm-svn: 179345
2013-04-12 00:17:33 +00:00
Rafael Espindola
6c9d485a40 Revert my last two commits while I debug what is wrong in a big endian host.
llvm-svn: 179303
2013-04-11 17:46:10 +00:00
Rafael Espindola
857bda0e10 Print more information about relocations.
With this patch llvm-readobj now prints if a relocation is pcrel, its length,
if it is extern and if it is scattered.

It also refactors the code a bit to use bit fields instead of shifts and
masks all over the place.

llvm-svn: 179294
2013-04-11 16:31:37 +00:00
Rafael Espindola
ce67523fcc Template MachOObjectFile over endianness too.
llvm-svn: 179179
2013-04-10 15:33:44 +00:00
Rafael Espindola
8c4963712f Convert MachOObjectFile to a template.
For now it is templated only on being 64 or 32 bits. I will add little/big
endian next.

llvm-svn: 179097
2013-04-09 14:49:08 +00:00
Rafael Espindola
ad3e40ef0b Template the MachO types over the word size.
llvm-svn: 179051
2013-04-08 20:45:01 +00:00
Rafael Espindola
04cc447824 Remove two uses of getObject.
llvm-svn: 178985
2013-04-07 15:46:05 +00:00
Rafael Espindola
4af23ca748 Remove usage of InMemoryStruct in getSymbol.
llvm-svn: 178984
2013-04-07 15:35:18 +00:00
Rafael Espindola
4330c97157 Remove a use of InMemoryStruct in llvm-readobj.
llvm-svn: 178981
2013-04-07 15:05:12 +00:00
Rafael Espindola
ac8e6c6147 Make getObject const. Remove a const_cast.
llvm-svn: 178980
2013-04-07 14:50:40 +00:00
Rafael Espindola
79787bd764 Don't fetch pointers from a InMemoryStruct.
InMemoryStruct is extremely dangerous as it returns data from an internal
buffer when the endiannes doesn't match. This should fix the tests on big
endian hosts.

llvm-svn: 178875
2013-04-05 15:15:22 +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
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
a0c14567a5 [readobj] Fix memory leak.
llvm-svn: 174687
2013-02-08 01:05:48 +00:00
Michael J. Spencer
09867f6b42 [objdump,readobj] Document the purpose and goals of each tool.
llvm-svn: 174439
2013-02-05 20:27:22 +00:00
Rafael Espindola
42165fc6a9 Use the generic dump template. Extracted from a patch by Sami Liedes.
llvm-svn: 171305
2012-12-31 16:53:01 +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
Rafael Espindola
53162bceaa Check for errors. Extracted from a patch by Sami Liedes.
llvm-svn: 171301
2012-12-31 15:45:31 +00:00
Rafael Espindola
a68235f961 Fix indentation. Extracted from a patch by Sami Liedes!
llvm-svn: 171300
2012-12-31 15:30:58 +00:00
Rafael Espindola
1f878f2041 Style fixes in llvm-readobj.cpp. Extracted from a patch by Sami Liedes!
llvm-svn: 171299
2012-12-31 15:27:42 +00:00
Chandler Carruth
800daa7d3d Sort the #include lines for tools/...
Again, tools are trickier to pick the main module header for than
library source files. I've started to follow the pattern of using
LLVMContext.h when it is included as a stub for program source files.

llvm-svn: 169252
2012-12-04 10:44:52 +00:00
Benjamin Kramer
4e38a34add Fix uses of the C99 PRI format macros not to conflict with C++11 UDLs.
llvm-svn: 152474
2012-03-10 02:04:38 +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
f62e531352 Fix comments for llvm-readobj, remove extraneous headers
llvm-svn: 151957
2012-03-02 23:43:51 +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