summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Object
Commit message (Collapse)AuthorAgeFilesLines
...
* [Object, MachO] Fixup for r239075: use union to store mach_header and ↵Alexey Samsonov2015-06-041-8/+2
| | | | | | mach_header_64. llvm-svn: 239110
* [Object, MachO] Don't crash on incomplete MachO segment load commands.Alexey Samsonov2015-06-041-1/+4
| | | | | | | | Report proper error code from MachOObjectFile constructor if we can't parse another segment load command (we already return a proper error if segment load command contents is suspicious). llvm-svn: 239109
* [Object, MachO] Simplify load segment parsing code. NFC.Alexey Samsonov2015-06-041-52/+30
| | | | llvm-svn: 239106
* [Object, MachO] Don't crash on invalid MachO segment load commands.Alexey Samsonov2015-06-042-11/+19
| | | | | | | | | | | | | | | Summary: Properly report the error in segment load commands from MachOObjectFile constructor instead of crashing the program. Adjust the test case accordingly. Test Plan: regression test suite Reviewers: rafael, filcab Subscribers: llvm-commits llvm-svn: 239081
* [Object, MachO] Don't crash on invalid MachO load commands.Alexey Samsonov2015-06-042-9/+25
| | | | | | | | | | | | | | | Summary: Currently all load commands are parsed in MachOObjectFile constructor. If the next load command cannot be parsed, or if command size is too small, properly report it through the error code and fail to construct the object, instead of crashing the program. Test Plan: regression test suite Reviewers: rafael, filcab Subscribers: llvm-commits llvm-svn: 239080
* [Object, MachO] Don't crash on parsing invalid MachO header.Alexey Samsonov2015-06-041-4/+29
| | | | | | | | | | | Summary: Instead, properly report this error from MachOObjectFile constructor. Test Plan: regression test suite Reviewers: rafael Subscribers: llvm-commits llvm-svn: 239078
* [Object, MachO] Remove some code duplication. NFC.Alexey Samsonov2015-06-041-25/+25
| | | | llvm-svn: 239077
* [Object, MachO] Cache parsed MachO header in MachOObjectFile. NFC.Alexey Samsonov2015-06-041-20/+20
| | | | | | | | | | | | | | | Summary: Avoid parsing object file each time MachOObjectFile::getHeader() is called. Instead, cache the header in MachOObjectFile constructor, where it's parsed anyway. In future, we must avoid constructing the object at all if the header can't be parsed. Test Plan: regression test suite. Reviewers: rafael Subscribers: llvm-commits llvm-svn: 239075
* [Object, MachO] Introduce MachOObjectFile::load_commands() range iterator.Alexey Samsonov2015-06-031-6/+21
| | | | | | | | | | | | | | | | | | Summary: Now users don't have to manually deal with getFirstLoadCommandInfo() / getNextLoadCommandInfo(), calculate the number of load segments, etc. No functionality change. Test Plan: regression test suite Reviewers: rafael, lhames, loladiro Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D10144 llvm-svn: 238983
* Move to llvm-objdump a large amount of code to that is only used there.Rafael Espindola2015-06-033-263/+1
| | | | llvm-svn: 238898
* Simplify now that we always use an alignment of 2 for ELF files.Rafael Espindola2015-06-021-42/+18
| | | | | | This saves 123144 bytes out of llvm-nm on powerpc64le. llvm-svn: 238824
* Simplify another function that doesn't fail.Rafael Espindola2015-06-013-17/+7
| | | | llvm-svn: 238703
* Simplify interface of function that doesn't fail.Rafael Espindola2015-05-312-11/+4
| | | | llvm-svn: 238700
* Add RelocVisitor support for MachOKeno Fischer2015-05-301-0/+5
| | | | | | | | | | | | This commit adds partial support for MachO relocations to RelocVisitor. A simple test case is added to show that relocations are indeed being applied and that using llvm-dwarfdump on MachO files no longer errors. Correctness is not yet tested, due to an unrelated bug in DebugInfo, which will be fixed with appropriate testcase in a followup commit. Differential Revision: http://reviews.llvm.org/D8148 llvm-svn: 238663
* Object: Add Archive::getNumberOfSymbols().Rui Ueyama2015-05-261-14/+13
| | | | | | Add a function that returns number of symbols in archive headers. llvm-svn: 238213
* Stop inventing symbol sizes.Rafael Espindola2015-05-222-98/+9
| | | | | | | | | | | | | | | | | | | | | MachO and COFF quite reasonably only define the size for common symbols. We used to try to figure out the "size" by computing the gap from one symbol to the next. This would not be correct in general, since a part of a section can belong to no visible symbol (padding, private globals). It was also really expensive, since we would walk every symbol to find the size of one. If a caller really wants this, it can sort all the symbols once and get all the gaps ("size") in O(n log n) instead of O(n^2). On MachO this also has the advantage of centralizing all the checks for an invalid n_sect. llvm-svn: 238028
* Detect invalid section indexes when we first read them.Rafael Espindola2015-05-221-4/+4
| | | | | | We still detect the same errors, but now we do it earlier. llvm-svn: 238024
* Make it easier to use DwarfContext with MCJITKeno Fischer2015-05-212-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: This supersedes http://reviews.llvm.org/D4010, hopefully properly dealing with the JIT case and also adds an actual test case. DwarfContext was basically already usable for the JIT (and back when we were overwriting ELF files it actually worked out of the box by accident), but in order to resolve relocations correctly it needs to know the load address of the section. Rather than trying to get this out of the ObjectFile or requiring the user to create a new ObjectFile just to get some debug info, this adds the capability to pass in that info directly. As part of this I separated out part of the LoadedObjectInfo struct from RuntimeDyld, since it is now required at a higher layer. Reviewers: lhames, echristo Reviewed By: echristo Subscribers: vtjnash, friss, rafael, llvm-commits Differential Revision: http://reviews.llvm.org/D6961 llvm-svn: 237961
* Move alignment from MCSectionData to MCSection.Rafael Espindola2015-05-212-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This starts merging MCSection and MCSectionData. There are a few issues with the current split between MCSection and MCSectionData. * It optimizes the the not as important case. We want the production of .o files to be really fast, but the split puts the information used for .o emission in a separate data structure. * The ELF/COFF/MachO hierarchy is not represented in MCSectionData, leading to some ad-hoc ways to represent the various flags. * It makes it harder to remember where each item is. The attached patch starts merging the two by moving the alignment from MCSectionData to MCSection. Most of the patch is actually just dropping 'const', since MCSectionData is mutable, but MCSection was not. llvm-svn: 237936
* Remove MCAssembler.h include from MCStreamer.h and fix users of MCStreamer.hPete Cooper2015-05-151-0/+1
| | | | llvm-svn: 237483
* [llvm-readobj/obj2yaml/yaml2obj] Support MIPS machine ELF header flagsSimon Atanasyan2015-05-081-0/+18
| | | | llvm-svn: 236807
* [obj2yaml/yaml2obj] Add SHT_MIPS_ABIFLAGS section supportSimon Atanasyan2015-05-071-0/+119
| | | | | | | This change adds support for the SHT_MIPS_ABIFLAGS section reading/writing to the obj2yaml and yaml2obj tools. llvm-svn: 236738
* [llvm-readobj/obj2yaml/yaml2obj] Support more MIPS ELF header flagsSimon Atanasyan2015-05-071-1/+6
| | | | llvm-svn: 236728
* Change range-based for-loops to be -Wrange-loop-analysis clean.Richard Trieu2015-04-151-1/+1
| | | | | | No functionality change. llvm-svn: 234963
* Remove more superfluous .str() and replace std::string concatenation with Twine.Yaron Keren2015-03-301-2/+2
| | | | | | Following r233392, http://llvm.org/viewvc/llvm-project?rev=233392&view=rev. llvm-svn: 233555
* Be lazy about loading metadata in IRObjectFile.Rafael Espindola2015-03-131-1/+3
| | | | | | | This speeds up llvm-ar building lib64/libclangSema.a with debug IR files from 8.658015807 seconds to just 0.351036519 seconds :-) llvm-svn: 232221
* Add support for Nuxi CloudABI.Ed Schouten2015-03-091-0/+1
| | | | | | | | | | | | | | CloudABI is a POSIX-like runtime environment built around the concept of capability-based security. More details: https://github.com/NuxiNL/cloudlibc CloudABI uses its own ELFOSABI number. This number has been allocated by the maintainers of ELF a couple of days ago. Reviewed by: echristo llvm-svn: 231681
* ExecutionEngine: Preliminary support for dynamically loadable coff objectsDavid Majnemer2015-03-071-3/+10
| | | | | | | | | | Provide basic support for dynamically loadable coff objects. Only handles a subset of x64 currently. Patch by Andy Ayers! Differential Revision: http://reviews.llvm.org/D7793 llvm-svn: 231574
* Make DataLayout Non-Optional in the ModuleMehdi Amini2015-03-041-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: DataLayout keeps the string used for its creation. As a side effect it is no longer needed in the Module. This is "almost" NFC, the string is no longer canonicalized, you can't rely on two "equals" DataLayout having the same string returned by getStringRepresentation(). Get rid of DataLayoutPass: the DataLayout is in the Module The DataLayout is "per-module", let's enforce this by not duplicating it more than necessary. One more step toward non-optionality of the DataLayout in the module. Make DataLayout Non-Optional in the Module Module->getDataLayout() will never returns nullptr anymore. Reviewers: echristo Subscribers: resistor, llvm-commits, jholewinski Differential Revision: http://reviews.llvm.org/D7992 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 231270
* Use read{16,32,64}{le,be}() instead of ↵Rui Ueyama2015-03-021-37/+24
| | | | | | *reinterpret_cast<u{little,big}{16,32,64}_t>(). llvm-svn: 231016
* Add missing includes. make_unique proliferated everywhere.Benjamin Kramer2015-03-011-0/+1
| | | | llvm-svn: 230909
* Object: Handle Mach-O kext bundle filesJustin Bogner2015-02-253-0/+3
| | | | | | This particular subtype of Mach-O was missing. Add it. llvm-svn: 230567
* [obj2yaml/yaml2obj] Add SHT_GROUP support.Shankar Easwaran2015-02-211-1/+16
| | | | | | This adds section group support to the tools obj2yaml and yaml2obj. llvm-svn: 230124
* Introduce Target::createNullTargetStreamer and use it from IRObjectFile.Peter Collingbourne2015-02-191-0/+1
| | | | | | | | | A null MCTargetStreamer allows IRObjectFile to ignore target-specific directives. Previously we were crashing. Differential Revision: http://reviews.llvm.org/D7711 llvm-svn: 229797
* [Object] Support reading 64-bit MIPS ELF archivesSimon Atanasyan2015-02-171-5/+25
| | | | | | | | | | | | | | | | | | | The 64-bit MIPS ELF archive file format is used by MIPS64 targets. The main difference from a regular archive file is the symbol table format: 1. ar_name is equal to "/SYM64/" 2. number of symbols and offsets are 64-bit integers http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf Page 96 The patch allows reading of such archive files by llvm-nm, llvm-objdump and other tools. But it does not support archive files with number of symbols and/or offsets exceed 2^32. I think it is a rather rare case requires more significant modification of `Archive` class code. http://reviews.llvm.org/D7546 llvm-svn: 229520
* Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects.Zachary Turner2015-02-111-0/+3
| | | | | | | | | | This allows IDEs to recognize the entire set of header files for each of the core LLVM projects. Differential Revision: http://reviews.llvm.org/D7526 Reviewed By: Chris Bieneman llvm-svn: 228798
* [Object] Reformat the code with clang-formatSimon Atanasyan2015-02-101-6/+5
| | | | | | No functional changes. llvm-svn: 228751
* [ELFYAML] Provide default value 0 for YAML relocation addendum fieldSimon Atanasyan2015-01-291-1/+1
| | | | | | Follow up to r227318. llvm-svn: 227422
* dd the option, -link-opt-hints to llvm-objdump used with -macho to print theKevin Enderby2015-01-271-2/+25
| | | | | | Mach-O AArch64 linker optimization hints for ADRP code optimization. llvm-svn: 227246
* [ELFYAML] Support mips64 relocation record format in yaml2obj/obj2yamlSimon Atanasyan2015-01-251-1/+48
| | | | | | | | | | | | | | | | | | | MIPS64 ELF file has a very specific relocation record format. Each record might specify up to three relocation operations. So the `r_info` field in fact consists of three relocation type sub-fields and optional code of "special" symbols. http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf page 40 The patch implements support of the MIPS64 relocation record format in yaml2obj/obj2yaml tools by introducing new optional Relocation fields: Type2, Type3, and SpecSym. These fields are recognized only if the object/YAML file relates to the MIPS64 target. Differential Revision: http://reviews.llvm.org/D7136 llvm-svn: 227044
* [Object][ELF] Test unknown type.Michael J. Spencer2015-01-231-0/+1
| | | | llvm-svn: 226943
* Fix the Archive::Child::getRawSize() method used by llvm-objdump’s ↵Kevin Enderby2015-01-161-1/+1
| | | | | | | | -archive-headers option and tweak its use in llvm-objdump. Add back the test case for the -archive-headers option. llvm-svn: 226332
* This should fix the build bot clang-cmake-armv7-a15-full failing onKevin Enderby2015-01-161-2/+0
| | | | | | the macho-archive-headers.test added with r226228. llvm-svn: 226232
* Fix edge case when Start overflowed in 32 bit modeFilipe Cabecinhas2015-01-151-2/+3
| | | | llvm-svn: 226229
* Add the option, -archive-headers, used with -macho to print the Mach-O ↵Kevin Enderby2015-01-151-0/+13
| | | | | | archive headers to llvm-objdump. llvm-svn: 226228
* Report fatal errors instead of segfaulting/asserting on a few invalid ↵Filipe Cabecinhas2015-01-151-8/+46
| | | | | | | | | | | | | | | | | accesses while reading MachO files. Summary: Shift an older “invalid file” test to get a consistent naming for these tests. Bugs found by afl-fuzz Reviewers: rafael Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6945 llvm-svn: 226219
* [Object] Add SF_Exported flag. This flag will be set on all symbols that wouldLang Hames2015-01-151-0/+3
| | | | | | | | | be exported from a dylib if their containing object file were linked into one. No test case: No command line tools query this flag, and there are no Object unit tests. llvm-svn: 226217
* [cleanup] Re-sort all the #include lines in LLVM usingChandler Carruth2015-01-142-4/+4
| | | | | | | | | | | utils/sort_includes.py. I clearly haven't done this in a while, so more changed than usual. This even uncovered a missing include from the InstrProf library that I've added. No functionality changed here, just mechanical cleanup of the include order. llvm-svn: 225974
* Don't loop endlessly for MachO files with 0 ncmdsFilipe Cabecinhas2015-01-061-0/+3
| | | | llvm-svn: 225271
* Add printing the LC_THREAD load commands with llvm-objdump’s -private-headers.Kevin Enderby2014-12-231-0/+5
| | | | llvm-svn: 224792
OpenPOWER on IntegriCloud