summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object/Inputs
Commit message (Collapse)AuthorAgeFilesLines
...
* Factor out the checking of string tables.Rafael Espindola2015-06-291-0/+0
| | | | | | | | | | This moves the error checking for string tables to getStringTable which returns an ErrorOr<StringRef>. This improves error checking, makes it uniform across all string tables and makes it possible to check them once instead of once per name. llvm-svn: 240950
* Add a testcase for an invalid file.Rafael Espindola2015-06-291-0/+0
| | | | | | We were already checking this, but had no tests. llvm-svn: 240945
* Convert an assert that can fail into error checking.Rafael Espindola2015-06-291-0/+0
| | | | llvm-svn: 240944
* [Stackmap] Pre-assemble the stackmap parser test case. (Fix builders).Lang Hames2015-06-272-50/+0
| | | | | | | | This case had been failing on testers that didn't have x86 support. Rather than XFAIL it on testers without x86 support, I've just assembled it and used the raw object as the test input. llvm-svn: 240875
* [StackMaps] Add a lightweight parser for stackmap version 1 sections.Lang Hames2015-06-261-0/+50
| | | | | | | | | | The parser provides a convenient interface for reading llvm stackmap v1 sections in object files. This patch also includes a new option for llvm-readobj, '-stackmap', which uses the parser to pretty-print stackmap sections for debugging/testing purposes. llvm-svn: 240860
* Improve error handling of getRelocationAddend.Rafael Espindola2015-06-191-0/+0
| | | | | | | | | | | | | | | | | | This patch changes getRelocationAddend to use ErrorOr and considers it an error to try to get the addend of a REL section. If, for example, a x86_64 file has a REL section, that file is corrupted and we should reject it. Using ErrorOr is not ideal since we check the section type once per relocation instead of once per section. Checking once per section would involve getRelocationAddend just asserting and callers checking the section before iterating over the relocations. In any case, this is an improvement and includes a test. llvm-svn: 240176
* [Object, MachO] Don't crash on incomplete MachO segment load commands.Alexey Samsonov2015-06-041-0/+0
| | | | | | | | 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] Don't crash on parsing invalid MachO header.Alexey Samsonov2015-06-041-0/+0
| | | | | | | | | | | Summary: Instead, properly report this error from MachOObjectFile constructor. Test Plan: regression test suite Reviewers: rafael Subscribers: llvm-commits llvm-svn: 239078
* Disassemble the start of sections even if there is no symbol there.Rafael Espindola2015-06-041-0/+0
| | | | | | | We already handled a section with no symbols, extend that to also handle a section with symbols that don't include the section start. llvm-svn: 239039
* Stop inventing symbol sizes.Rafael Espindola2015-05-222-0/+0
| | | | | | | | | | | | | | | | | | | | | 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-0/+0
| | | | | | We still detect the same errors, but now we do it earlier. llvm-svn: 238024
* [llvm-readobj] Teach llvm-readobj to print PT_MIPS_ABIFLAGS program headerSimon Atanasyan2015-05-151-0/+0
| | | | llvm-svn: 237451
* [opaque pointer type] Add textual IR support for explicit type parameter to ↵David Blaikie2015-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gep operator Similar to gep (r230786) and load (r230794) changes. Similar migration script can be used to update test cases, which successfully migrated all of LLVM and Polly, but about 4 test cases needed manually changes in Clang. (this script will read the contents of stdin and massage it into stdout - wrap it in the 'apply.sh' script shown in previous commits + xargs to apply it over a large set of test cases) import fileinput import sys import re rep = re.compile(r"(getelementptr(?:\s+inbounds)?\s*\()((<\d*\s+x\s+)?([^@]*?)(|\s*addrspace\(\d+\))\s*\*(?(3)>)\s*)(?=$|%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|zeroinitializer|<|\[\[[a-zA-Z]|\{\{)", re.MULTILINE | re.DOTALL) def conv(match): line = match.group(1) line += match.group(4) line += ", " line += match.group(2) return line line = sys.stdin.read() off = 0 for match in re.finditer(rep, line): sys.stdout.write(line[off:match.start()]) sys.stdout.write(conv(match)) off = match.end() sys.stdout.write(line[off:]) llvm-svn: 232184
* Object: Test for reading kext bundlesJustin Bogner2015-02-271-0/+0
| | | | | | | In the review for r230567, it was pointed out we should really test the lib/Object part of that change. This does so using llvm-readobj. llvm-svn: 230779
* [obj2yaml/yaml2obj] Add SHT_GROUP support.Shankar Easwaran2015-02-211-0/+0
| | | | | | This adds section group support to the tools obj2yaml and yaml2obj. llvm-svn: 230124
* [Object] Support reading 64-bit MIPS ELF archivesSimon Atanasyan2015-02-171-0/+0
| | | | | | | | | | | | | | | | | | | 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
* Report fatal errors instead of segfaulting/asserting on a few invalid ↵Filipe Cabecinhas2015-01-1514-0/+0
| | | | | | | | | | | | | | | | | 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
* Don't loop endlessly for MachO files with 0 ncmdsFilipe Cabecinhas2015-01-061-0/+0
| | | | llvm-svn: 225271
* [Object] Don't crash on empty export lists.Juergen Ributzka2014-12-191-0/+0
| | | | | | | | | | | | Summary: This fixes the exports iterator if the export list is empty. Reviewers: Bigcheese, kledzik Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6732 llvm-svn: 224563
* Start adding thin archive support.Rafael Espindola2014-12-161-0/+0
| | | | | | This is just sufficient for 'ar t' to work. llvm-svn: 224307
* Add missing test fileJean-Daniel Dupas2014-12-041-0/+0
| | | | llvm-svn: 223346
* [Object][Mips] Return address of MIPS symbol with cleared microMIPS ↵Simon Atanasyan2014-11-251-0/+0
| | | | | | indicator bit llvm-svn: 222726
* Object, support both mach-o archive t.o.c file namesNick Kledzik2014-11-121-0/+0
| | | | | | | | | | For historical reasons archives on mach-o have two possible names for the file containing the table of contents for the archive: "__.SYMDEF SORTED" and "__.SYMDEF". But the libObject archive reader only supported the former. This patch fixes llvm::object::Archive to support both names. llvm-svn: 221747
* Add CRLF support to LineIterator.Rafael Espindola2014-11-031-0/+2
| | | | | | | The MRI scripts have to work with CRLF, and in general it is probably a good idea to support this in a core utility like LineIterator. llvm-svn: 221153
* Add tests for r219479.David Majnemer2014-10-101-0/+167
| | | | llvm-svn: 219480
* obj2yaml, COFF: Handle long section namesDavid Majnemer2014-10-101-0/+11
| | | | | | | | | | | | | Long section names are represented as a slash followed by a numeric ASCII string. This number is an offset into a string table. Print the appropriate entry in the string table instead of the less enlightening /4. N.B. yaml2obj already does the right thing, this test exercises both sides of the (de-)serialization. llvm-svn: 219458
* Fix an off-by-one bug in the target independent llvm-objdump.Rafael Espindola2014-08-171-0/+0
| | | | | | | | It would prevent the display of a single byte instruction before a label. Patch by Steve King! llvm-svn: 215837
* Add printing of Mach-O stabs in llvm-nm.Kevin Enderby2014-07-171-0/+0
| | | | llvm-svn: 213327
* [Mips] Support SHT_MIPS_ABIFLAGS section type flag in the llvm-readobj,Simon Atanasyan2014-07-131-0/+0
| | | | | | obj2yaml and yaml2obj tools. llvm-svn: 212908
* [ELFYAML] Group ELF section type flags to target specific blocks.Simon Atanasyan2014-07-121-0/+0
| | | | | | Recognize only flags which correspond to the current target. llvm-svn: 212880
* Ignore llvm.* globals.Rafael Espindola2014-07-041-0/+1
| | | | | | | It is not clear if llvm.global_ctors should or should not be in llvm.metadata, but in practice it is not and we need to ignore it for LTO. llvm-svn: 212351
* Don't include llvm.metadata variables in archive symbol tables.Rafael Espindola2014-07-041-0/+3
| | | | llvm-svn: 212344
* objdump: Add test for ELF file with no section tableEd Maste2014-06-301-0/+0
| | | | | | | | This is a test for the fix in r211904. Differential Revision: http://reviews.llvm.org/D4349 llvm-svn: 212059
* [ELF][Mips] Fix recognition of MIPS 64-bit arch in the ↵Simon Atanasyan2014-06-271-0/+0
| | | | | | ELFObjectFile:getArch() method. llvm-svn: 211891
* Add "-format darwin" to llvm-size to be like darwin's size(1) -m output, andKevin Enderby2014-06-172-0/+0
| | | | | | | | | | | | | | | and the -l option for the long format. Also when the object is a Mach-O file and the format is berkeley produce output like darwin’s default size(1) summary berkeley derived output. Like System V format, there are also some small changes in how and where the file names and archive member names are printed for darwin and Mach-O. Like the changes to llvm-nm these are the first steps in seeing if it is possible to make llvm-size produce the same output as darwin's size(1). llvm-svn: 211117
* Fix pr17056.Rafael Espindola2014-06-161-0/+0
| | | | | | | | | | | | | This makes llvm-nm ignore members that are not sufficiently aligned for lib/Object to handle. These archives are invalid. GNU AR is able to handle this, but in general just warns about broken archive members. We should probably start warning too, but for now just make sure llvm-nm exits with an 0. llvm-svn: 211036
* Add "-format darwin" to llvm-nm to be like darwin's nm(1) -m output.Kevin Enderby2014-06-053-0/+0
| | | | | | | | | | | | | | | This is a first step in seeing if it is possible to make llvm-nm produce the same output as darwin's nm(1). Darwin's default format is bsd but its -m output prints the longer Mach-O specific details. For now I added the "-format darwin" to do this (whos name may need to change in the future). As there are other Mach-O specific flags to nm(1) which I'm hoping to add some how in the future. But I wanted to see if I could get the correct output for -m flag using llvm-nm and the libObject interfaces. I got this working but would love to hear what others think about this approach to getting object/format specific details printed with llvm-nm. llvm-svn: 210285
* Implement MachOObjectFile::isSectionData() and MachOObjectFile::isSectionBSSKevin Enderby2014-05-191-0/+0
| | | | | | | | so that llvm-size will total up all the sections in the Berkeley format. This allows for rough categorizations for Mach-O sections. And allows the total of llvm-size’s Berkeley and System V formats to be the same. llvm-svn: 209158
* Teach llvm-nm to know about fat archives (aka MachOUniversal filesKevin Enderby2014-05-141-0/+0
| | | | | | containing archives). First step as other tools will be updated next. llvm-svn: 208812
* obj2yaml: Don't crash if the characteristics field is zeroDavid Majnemer2014-04-091-0/+43
| | | | | | | | | obj2yaml would fail when seeing a Weak External auxiliary record with a characteristics field holding zero instead of one of IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY, IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY, or IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY. llvm-svn: 205911
* obj2yaml: Use the correct relocation type for different machine typesDavid Majnemer2014-04-072-0/+17
| | | | | | | | | | | | | The IO normalizer would essentially lump I386 and AMD64 relocations together. Relocation types with the same numeric value would then get mapped in appropriately. For example: IMAGE_REL_AMD64_ADDR64 and IMAGE_REL_I386_DIR16 both have a numeric value of one. We would see IMAGE_REL_I386_DIR16 in obj2yaml conversions of object files with a machine type of IMAGE_FILE_MACHINE_AMD64. llvm-svn: 205746
* Implement getRelocationAddress for MachO and ET_REL elf files.Rafael Espindola2014-04-032-0/+0
| | | | | | With that, fix the symbolizer to work with any ELF file. llvm-svn: 205588
* Only clear the thumb bit from function addresses.Rafael Espindola2014-04-031-0/+0
| | | | llvm-svn: 205500
* Revert "Fix a nomenclature error in llvm-nm."Rafael Espindola2014-04-031-0/+0
| | | | | | | | | | | | | | | | This reverts commit r205479. It turns out that nm does use addresses, it is just that every reasonable relocatable ELF object has sections with address 0. I have no idea if those exist in reality, but it at least it shows that llvm-nm should use the name address. The added test was includes an unusual .o file with non 0 section addresses. I created it by hacking ELFObjectWriter.cpp. Really sorry for the churn. llvm-svn: 205493
* Object: Output .file symbols properlyDavid Majnemer2014-03-201-0/+14
| | | | | | | obj2yaml would emit the NUL bytes padding the auxiliary file symbol records. Trimming them looks nicer. llvm-svn: 204314
* Object: Provide a richer means of describing auxiliary symbolsDavid Majnemer2014-03-192-8/+24
| | | | | | | | | | | | | | | | The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 llvm-svn: 204214
* Add a test for printing absolute symbols in ELF.Rafael Espindola2014-02-051-0/+0
| | | | llvm-svn: 200818
* Small fix for llvm-nm handling of weak symbols on ELF (print 'v').Rafael Espindola2014-02-041-0/+0
| | | | llvm-svn: 200808
* Add a test for common symbols in coff.Rafael Espindola2014-02-041-0/+0
| | | | llvm-svn: 200803
* [Object][ELF][Mips] Print symbol name for MIPS ELF relocations.Simon Atanasyan2014-01-231-0/+0
| | | | llvm-svn: 199898
OpenPOWER on IntegriCloud