summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object/Inputs
Commit message (Collapse)AuthorAgeFilesLines
* [WebAsembly] Update default triple in test files to wasm32-unknown-unkown.Sam Clegg2018-05-101-1/+1
| | | | | | | | | | Summary: The final -wasm component has been the default for some time now. Subscribers: jfb, dschuff, jgravelle-google, eraman, aheejin, JDevlieghere, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46342 llvm-svn: 332007
* Add a test for r331746.Hans Wennborg2018-05-091-0/+252
| | | | | | Thanks to pcc for creating the test file! llvm-svn: 331854
* typoSam Clegg2018-04-271-0/+0
| | | | llvm-svn: 331006
* [WebAssembly] Section symbols must have local bindingSam Clegg2018-04-271-0/+0
| | | | | | | | | | Summary: Also test for symbols information in test/MC/WebAssembly/debug-info.ll. Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, JDevlieghere, llvm-commits Differential Revision: https://reviews.llvm.org/D46160 llvm-svn: 331005
* [WebAssembly] Add version to object file metadataSam Clegg2018-04-261-0/+0
| | | | | | | | | | Summary: See https://github.com/WebAssembly/tool-conventions/issues/54 Subscribers: jfb, dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46069 llvm-svn: 330969
* [WebAssembly] Use section index in relocation section headerSam Clegg2018-04-241-0/+0
| | | | | | | | | | | Rather than referring to sections my their code, use the absolute index of the target section within the module. See https://github.com/WebAssembly/tool-conventions/issues/52 Differential Revision: https://reviews.llvm.org/D45980 llvm-svn: 330749
* [WebAssembly] Reorder reloc sections to come between symtab and nameNicholas Wilson2018-03-051-0/+0
| | | | | | | | | | | This is required in order to enable relocs to be validated as they are read in. Also update tests with new section ordering. Differential Revision: https://reviews.llvm.org/D43940 llvm-svn: 326694
* [WebAssembly] Update pre-generated test files to match latest llc output. NFC.Nicholas Wilson2018-03-011-0/+0
| | | | | | | | The ordering of llc's output was changed in rL326334. Differential Revision: https://reviews.llvm.org/D43941 llvm-svn: 326445
* [WebAssembly] Add first claass symbol table to wasm objectsSam Clegg2018-02-231-0/+0
| | | | | | | | | | | | | | | | | | | | This is combination of two patches by Nicholas Wilson: 1. https://reviews.llvm.org/D41954 2. https://reviews.llvm.org/D42495 Along with a few local modifications: - One change I made was to add the UNDEFINED bit to the binary format to avoid the extra byte used when writing data symbols. Although this bit is redundant for other symbols types (i.e. undefined can be implied if a function or global is a wasm import) - I prefer to be explicit and consistent and not have derived flags. - Some field renaming. - Some reverting of unrelated minor changes. - No test output differences. Differential Revision: https://reviews.llvm.org/D43147 llvm-svn: 325860
* Allow unaligned access to ELF file data structures.Rui Ueyama2018-01-121-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ELF specification says that all ELF data structures are aligned to their natural alignments both in memory and file. That means when we access mmap'ed ELF files, we could assume that all data structures are aligned properly. However, in reality, we assume that the data structures are aligned only to two bytes because .a files only guarantee that their member files are aligned to two bytes in archive files. So the data access is already unaligned. This patch relaxes the alignment requirement even more, so that we accept unaligned access to all ELF data structures. This patch in particular makes lld bug-compatible with icc. Intel C compiler doesn't seem to care about data alignment and generates unaligned relocation sections (https://bugs.llvm.org/show_bug.cgi?id=35854). I also saw another instance of compatibility issues with our internal tool which creates unaligned section headers. Because GNU linkers are not picky about alignment, looks like it is not uncommon that ELF-generating tools create unaligned files. There is a performance penalty with this patch on host machines on which unaligned access is expensive. x86 and AArch64 are fine. ARMv6 is a problem, but I don't think using ARMv6 machines as hosts is common, so I believe it's not a real problem. Differential Revision: https://reviews.llvm.org/D41978 llvm-svn: 322407
* [test] Add test files that were missed from SVN r317459Martin Storsjo2017-11-062-0/+0
| | | | llvm-svn: 317461
* Fix buffer overflow.Rafael Espindola2017-10-191-0/+0
| | | | | | We were reading past the end of the buffer. llvm-svn: 316143
* Make the ELFFile constructor private.Rafael Espindola2017-10-101-0/+1
| | | | | | | | | With this all clients have to use the new create method which returns an Expected. Fixes a crash on invalid input. llvm-svn: 315376
* Added phdr upper bound checks to ElfObject.Rafael Espindola2017-10-051-0/+0
| | | | | | | | | Ensure the program_headers call will fail correctly if the program headers are larger than the underlying buffer. Patch by Parker Thompson! llvm-svn: 315012
* [MachO] Prevent heap overflow when load command extends past EOFJonas Devlieghere2017-09-131-0/+0
| | | | | | | | | | | This patch fixes a heap-buffer-overflow when a malformed Mach-O has a load command who's size extends past the end of the binary. Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3225 Differential revision: https://reviews.llvm.org/D37439 llvm-svn: 313145
* [WebAssembly] Fix overflow for input with missing versionJonas Devlieghere2017-08-231-0/+0
| | | | | | Differential revision: https://reviews.llvm.org/D37070 llvm-svn: 311605
* [WebAssembly] Be consistent in generating trivial test input filesSam Clegg2017-07-102-0/+3
| | | | | | | | | | | | | For each checked-in wasm file, make sure the there is corresponding .ll file that can be used to regenerate it if needed. Add test/Object/Inputs/trivial-object-test.wasm to match other formats and add some new wasm tests in test/Object. Differential Revision: https://reviews.llvm.org/D35213 llvm-svn: 307585
* [COFF] Gracefully handle empty .drectve sectionsShoaib Meenai2017-05-141-0/+14
| | | | | | | | | | | | | | | | | | Running `llvm-readobj -coff-directives msvcrt.lib` resulted in this error: Invalid data was encountered while parsing the file This happened because some of the object files in the archive have empty `.drectve` sections. These empty sections result in a `parse_failed` error being returned from `COFFObjectFile::getSectionContents()`, which in turn caused `llvm-readobj` to stop. With this change, `getSectionContents` now returns success, and like before the resulting array is empty. Patch by Dave Lee. Differential Revision: https://reviews.llvm.org/D32652 llvm-svn: 303014
* Archives require a symbol table on Solaris, even if empty.Rafael Espindola2017-03-141-0/+7
| | | | | | | | | | | | | | On Solaris ld (and some other tools that use the underlying utility libraries, such as elfdump) chokes on an archive library that has no symbol table. The Solaris tools always create one, even if it's empty. That bug has been fixed in the latest development line, and can probably be backported to a supported release, but it would be nice if LLVM's archiver could emit the empty symbol table, too. Patch by Danek Duvall! llvm-svn: 297773
* [obj2yaml] Produce correct output for invalid relocations.Davide Italiano2017-01-261-0/+0
| | | | | | | | | | | | R_X86_64_NONE can be emitted without a symbol associated (well, in theory it should never be emitted in an ABI-compliant relocatable object). So, if there's no symbol associated to a reloc, emit one with an empty name, instead of crashing. Ack'ed by Michael Spencer offline. PR: 31768 llvm-svn: 293224
* Add support for the new LC_NOTE load command.Kevin Enderby2017-01-191-0/+0
| | | | | | | | | | It describes a region of arbitrary data included in a Mach-O file. Its initial use is to record extra data in MH_CORE files. rdar://30001545 rdar://30001731 llvm-svn: 292500
* [Object] Fixup permissions of input files.Davide Italiano2017-01-162-0/+0
| | | | | | | They just need to be read/dumped, so no need to set the exec bit on any of them. NFCI, I guess. llvm-svn: 292171
* [llvm-objdump] Dump PT_NOTE as part of -p.Davide Italiano2017-01-161-0/+0
| | | | | PR: 31641 llvm-svn: 292170
* [llvm-objdump] Dump PT_GNU_RELRO as part of -p.Davide Italiano2017-01-161-0/+0
| | | | | PR: 31641 llvm-svn: 292169
* Object: Make IRObjectFile own multiple modules and enumerate symbols from ↵Peter Collingbourne2016-12-131-0/+3
| | | | | | | | | | all modules. This implements multi-module support in IRObjectFile. Differential Revision: https://reviews.llvm.org/D26951 llvm-svn: 289578
* [llvm-readobj] - Teach readobj to print PT_OPENBSD_BOOTDATA headerGeorge Rimar2016-12-061-0/+0
| | | | | | | | | | | | | These are OpenBSD specific program headers. OpenBSD commit: https://github.com/openbsd/src/commit/d39116912b9536bd77326260dc5c6e593fd4ee24 It is required for fixing PR31288. Differential revision: https://reviews.llvm.org/D27456 llvm-svn: 288831
* Add error checking for Mach-O universal files.Kevin Enderby2016-11-287-0/+0
| | | | | | | | | | | | Add the checking for both the MachO::fat_header and the MachO::fat_arch struct values in the constructor for MachOUniversalBinary. Such that when the constructor for ObjectForArch is called it can assume the values in the MachO::fat_arch for the offset and size are contained in the file after the MachOUniversalBinary constructor is called for the Parent. llvm-svn: 288084
* Add error handling to getEntry.Rafael Espindola2016-11-031-0/+0
| | | | | | Issue found by inspection. llvm-svn: 285951
* Add the rest of the additional error checks for invalid Mach-O files whenKevin Enderby2016-11-0215-0/+0
| | | | | | | | | | the offsets and sizes of an element of the Mach-O file overlaps with another element in the Mach-O file. Some other tests for malformed Mach-O files now run into these checks so their tests were also adjusted. llvm-svn: 285860
* Don't compute DotShstrtab eagerly.Rafael Espindola2016-11-011-0/+0
| | | | | | | This saves a field that is not always used. It also avoids failing a program that doesn't need the section names. llvm-svn: 285753
* More additional error checks for invalid Mach-O files whenKevin Enderby2016-10-312-0/+0
| | | | | | | | | | | the offsets and sizes of an element of the file overlaps with another element in the Mach-O file. This shows the approach to this testing for three elements and contains for tests for their overlap. Checking for all the remain elements will be added next. llvm-svn: 285632
* Recommit r285285 - [Object/ELF] - Fixed behavior when ↵George Rimar2016-10-312-0/+0
| | | | | | | | | | | | | | | | | | SectionHeaderTable->sh_size is too large. with fix: edited invalid-section-index2.elf input to pass the new check and fail on the same place it was intended to fail. Original commit message: Elf.h already has code checking that section table does not go past end of file. Problem is that this check may not work on values greater than UINT64_MAX / Header->e_shentsize because of calculation overflow. Parch fixes the issue. Differential revision: https://reviews.llvm.org/D25432 llvm-svn: 285586
* Another additional error check for invalid Mach-O files for theKevin Enderby2016-10-278-0/+0
| | | | | | | | | | | | | | | | | | | | | | obsolete load commands. Again the philosophy of the error checking in libObject for Mach-O files, the idea behind the checking is that we never will return a Mach-O file out of libObject that contains unknown things the library code can’t operate on. So known obsolete load commands will cause a hard error. Also to make things clear I have added comments to the values and structures in Support/Mach-O.h and Support/MachO.def as to what is obsolete. As noted in a TODO in the code, there may need to be a non-default mode to allow some unknown values for well structured Mach-O files with things like unknown load load commands. So things like using an old lldb on a newer Mach-O file could still provide some limited functionality. llvm-svn: 285342
* Revert r285285 "[Object/ELF] - Fixed behavior when ↵George Rimar2016-10-271-0/+0
| | | | | | | | SectionHeaderTable->sh_size is too large." It broke BB. llvm-svn: 285288
* [Object/ELF] - Fixed behavior when SectionHeaderTable->sh_size is too large.George Rimar2016-10-271-0/+0
| | | | | | | | | | | | Elf.h already has code checking that section table does not go past end of file. Problem is that this check may not work on values greater than UINT64_MAX / Header->e_shentsize because of calculation overflow. Parch fixes the issue. Differential revision: https://reviews.llvm.org/D25432 llvm-svn: 285285
* [Object/ELF] - Do not allow overflow when checking section size/offset.George Rimar2016-10-271-0/+0
| | | | | | | | | Overflow was the reason of incorrect passing the check, patch fixes the case. Differentail revision: https://reviews.llvm.org/D25514 llvm-svn: 285284
* [Object/ELF] - Do not crash if string table sh_size is equal to zero.George Rimar2016-10-271-0/+0
| | | | | | | | | Revealed using "id_000038,sig_11,src_000015,op_havoc,rep_16" from PR30540, when sh_size was 0, crash happened. Differential revision: https://reviews.llvm.org/D25091 llvm-svn: 285282
* nother additional error check for an invalid Mach-O fileKevin Enderby2016-10-241-0/+0
| | | | | | | when contained in a Mach-O universal file and the cputypes in both headers don’t match. llvm-svn: 285026
* Another additional error check for invalid Mach-O files for theKevin Enderby2016-10-204-0/+0
| | | | | | | | | | | | load commands that use the MachO::twolevel_hints_command type which includes only the LC_TWOLEVEL_HINTS load command. This is not used in llvm libObject code or in llvm tool code. But does appear in one of the binary test files. While this load command is obsolete it is easier to add code for it in libObject than edit or change the binary test case. llvm-svn: 284769
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-10-196-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | load commands that use the MachO::thread_command type but are not used in llvm libObject code but used in llvm tool code. This includes the LC_UNIXTHREAD and LC_THREAD load commands. A quick note about the philosophy of the error checking in libObject for Mach-O files, the idea behind the checking is that we never will return a Mach-O file out of libObject that contains unknown things in the load commands. To do this the 32-bit ARM and PPC general tread states needed to be defined as two test case binaries contained them. If other thread states for other CPUs need to be added we will do that as needed. Going forward the LC_MAIN load command is used to set the entry point in Mach-O executables these days instead of an LC_UNIXTHREAD as was done in the past. So today only in core files are LC_THREAD load commands and thread states usually found. Other thread states have not yet been defined in include/Support/MachO.h at this time. But that can be added as needed with their corresponding checking also added. llvm-svn: 284668
* One more additional error check for invalid Mach-O files for aKevin Enderby2016-10-181-0/+0
| | | | | | | | | load command that use the MachO:: linkedit_data_command type but is not used in llvm libObject code but used in llvm tool code. This is for the LC_CODE_SIGNATURE load command. llvm-svn: 284529
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-10-182-0/+0
| | | | | | | | | | | load commands that use the MachO::routines_command and and MachO::routines_command_64 types but are not used in llvm libObject code but used in llvm tool code. This includes the LC_ROUTINES and LC_ROUTINES_64 load commands. llvm-svn: 284504
* [llvm-readobj] - Teach readobj to print ↵George Rimar2016-10-181-0/+0
| | | | | | | | | | | | | | | | | | | | PT_OPENBSD_RANDOMIZE/PT_OPENBSD_WXNEEDED headers. These are OpenBSD specific program headers and currently we support them in LLD. Description of headers (just in case) available here: http://man.openbsd.org/OpenBSD-current/man5/elf.5 OpenBSD commits were: For PT_OPENBSD_RANDOMIZE: https://github.com/openbsd/src/commit/c494713c450d98da3f2e1451ee8c7fb675a7c461 For PT_OPENBSD_WXNEEDED: https://github.com/openbsd/src/commit/2a5a8fc7e30928c2cff57cfe5fb491c90d8478ad Differential revision: https://reviews.llvm.org/D25616 llvm-svn: 284471
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-10-174-0/+0
| | | | | | | | | | | | load commands that use the MachO::sub_framework_command, MachO::sub_umbrella_command, MachO::sub_library_command and MachO::sub_client_command types but are not used in llvm libObject code but used in llvm tool code. This includes the LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA, LC_SUB_LIBRARY and LC_SUB_CLIENT load commands. llvm-svn: 284431
* [Object/ELF] - Check Header->e_shoff value earlier and do not crash.George Rimar2016-10-171-0/+0
| | | | | | | | | Patch checks that section pointer is aligned properly. This should be done before getStringTable() call. Differential revision: https://reviews.llvm.org/D25462 llvm-svn: 284387
* Recommit r284371 "[Object/ELF] - Check that e_shnum is null when e_shoff is."George Rimar2016-10-173-0/+0
| | | | | | | | | | | | | | | | | | | | | With fix: hex edited the precompiled inputs from another testcases to pass new checks. Original commit message: [Object/ELF] - Check that e_shnum is null when e_shoff is. Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) : e_shnum This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero. Revealed using "id_000037,sig_11,src_000015,op_havoc,rep_8" from PR30540 That was the reason of crash in lld on incorrect input file. Binary reduced using afl-min. Differential revision: https://reviews.llvm.org/D25090 llvm-svn: 284374
* Revert r284371 "[Object/ELF] - Check that e_shnum is null when e_shoff is."George Rimar2016-10-171-0/+0
| | | | | | | It broke build bot: http://lab.llvm.org:8011/builders/clang-with-lto-ubuntu/builds/908/steps/test-stage1-compiler/logs/stdio llvm-svn: 284373
* [Object/ELF] - Check that e_shnum is null when e_shoff is.George Rimar2016-10-171-0/+0
| | | | | | | | | | | | | | | Spec says (http://www.sco.com/developers/gabi/1998-04-29/ch4.eheader.html) : e_shnum This member holds the number of entries in the section header table. Thus the product of e_shentsize and e_shnum gives the section header table's size in bytes. If a file has no section header table, e_shnum holds the value zero. Revealed using "id_000037,sig_11,src_000015,op_havoc,rep_8" from PR30540 That was the reason of crash in lld on incorrect input file. Binary reduced using afl-min. Differential revision: https://reviews.llvm.org/D25090 llvm-svn: 284371
* [Object/ELF] - Do not crash on invalid section index.George Rimar2016-10-171-0/+0
| | | | | | | | | | | | | | | | If object has wrong (large) string table index and also incorrect large value for amount of sections in total, then section index passes the check: if (Index >= getNumSections()) return object_error::invalid_section_index; But result pointer then is far after end of file data, what result in a crash. Differential revision: https://reviews.llvm.org/D25081 llvm-svn: 284369
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-10-112-0/+0
| | | | | | | | | load commands that uses the MachO::linker_option_command type but not used in llvm libObject code but used in llvm tool code. This includes just LC_LINKER_OPTION load command. llvm-svn: 283939
OpenPOWER on IntegriCloud