summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object/Inputs
Commit message (Collapse)AuthorAgeFilesLines
...
* [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
* Reverted r283740 [Object/ELF] - Do not crash on invalid Header->e_shoff value.George Rimar2016-10-111-0/+0
| | | | | | | | | | | | | | | | Bot does not like it: http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/17075 /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/test/Object/invalid.test:70:32: error: expected string not found in input INVALID-SEC-ADDRESS-ALIGNMENT: Invalid address alignment of section headers ^ <stdin>:1:1: note: scanning from here /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment ^ <stdin>:1:125: note: possible intended match here /mnt/b/sanitizer-buildbot3/sanitizer-x86_64-linux-fast/build/llvm/include/llvm/Object/ELF.h:412:7: runtime error: upcast of misaligned address 0x000002d8b899 for type 'llvm::object::Elf_Shdr_Impl<llvm::object::ELFType<llvm::support::endianness::little, true> >', which requires 2 byte alignment llvm-svn: 283858
* [Object/ELF] - Do not crash on invalid Header->e_shoff value.George Rimar2016-10-101-0/+0
| | | | | | | | | | | | | | | sections_begin() may return unalignment pointer when Header->e_shoff isinvalid. That may result in a crash in clients, for example we have one in LLD: assert((PtrWord & ~PointerBitMask) == 0 && "Pointer is not sufficiently aligned"); fails when trying to push_back Elf_Shdr* (unaligned) into TinyPtrVector. Patch forces check for alignment of Header->e_shoff. Differential revision: https://reviews.llvm.org/D25368 llvm-svn: 283740
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-10-045-0/+0
| | | | | | | | | | | load commands that uses the MachO::encryption_info_command and MachO::encryption_info_command types but not used in llvm libObject code but used in llvm tool code. This includes just LC_ENCRYPTION_INFO and LC_ENCRYPTION_INFO_64 load commands. llvm-svn: 283250
* [Object/ELF] - Do not crash on invalid sh_offset value of REL[A] section.George Rimar2016-10-042-0/+0
| | | | | | | | | Previously code would access invalid memory and may crash, patch fixes the issue. Differential revision: https://reviews.llvm.org/D25187 llvm-svn: 283204
* [Object/ELF] - Avoid possible crash in getExtendedSymbolTableIndex().George Rimar2016-10-041-0/+0
| | | | | | | | | | When using broken input object found using AFL, getExtendedSymbolTableIndex() crashed because ShndxTable was empty as object does not contain SHT_SYMTAB_SHNDX section. Differential revision: https://reviews.llvm.org/D25189 llvm-svn: 283196
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-292-0/+0
| | | | | | | | | load command that uses the MachO::entry_point_command type but not used in llvm libObject code but used in llvm tool code. This includes just the LC_MAIN load command. llvm-svn: 282766
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-292-0/+0
| | | | | | | | | load command that uses the Mach::source_version_command type but not used in llvm libObject code but used in llvm tool code. This includes just the LC_SOURCE_VERSION load command. llvm-svn: 282736
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-283-0/+0
| | | | | | | | | load command that uses the Mach::rpath_command type but not used in llvm libObject code but used in llvm tool code. This includes just the LC_RPATH load command. llvm-svn: 282649
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-282-0/+0
| | | | | | | | | | other load commands that use the Mach::version_min_command type but not used in llvm libObject code but used in llvm tool code. This includes LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS, LC_VERSION_MIN_TVOS and LC_VERSION_MIN_WATCHOS load commands. llvm-svn: 282635
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-273-0/+0
| | | | | | | | | | other load commands that use the MachO::dylinker_command type but not used in llvm libObject code but used in llvm tool code. This includes LC_ID_DYLINKER, LC_LOAD_DYLINKER and LC_DYLD_ENVIRONMENT load commands. llvm-svn: 282553
* Next set of additional error checks for invalid Mach-O files for theKevin Enderby2016-09-263-0/+0
| | | | | | | | | | other load commands that use the Mach::linkedit_data_command type but not used in llvm libObject code but used in llvm tool code. This includes LC_FUNCTION_STARTS, LC_SEGMENT_SPLIT_INFO and LC_DYLIB_CODE_SIGN_DRS load commands. llvm-svn: 282441
* Next set of additional error checks for invalid Mach-O files for bad LC_UUIDKevin Enderby2016-09-212-0/+0
| | | | | | | load commands. Added a missing check and made the check for more than one like other other “more than one” checks. And of course added test cases. llvm-svn: 282104
* Next set of additional error checks for invalid Mach-O files for bad load ↵Kevin Enderby2016-09-207-0/+0
| | | | | | | | | | | | | | | | commands that use the Mach::dylib_command type for the load commands that are currently used in the MachOObjectFile constructor. This contains the missing checks for LC_ID_DYLIB, LC_ID_DYLIB, etc. load commands and the fields for the Mach::dylib_command type. Also checks that only an MH_DYLIB or MH_STUB_DYLIB has an LC_ID_DYLIB load command (and others filetype don’t) and there is not more than one of these load commands. llvm-svn: 282008
* [Stackmap] Added callsite counts to emitted function information.Sanjoy Das2016-09-141-0/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: It was previously not possible for tools to use solely the stackmap information emitted to reconstruct the return addresses of callsites in the map, which is necessary to use the information to walk a stack. This patch adds per-function callsite counts when emitting the stackmap section in order to resolve the problem. Note that this slightly alters the stackmap format, so external tools parsing these maps will need to be updated. **Problem Details:** Records only store their offset from the beginning of the function they belong to. While these records and the functions are output in program order, it is not possible to determine where the end of one function's records are without the callsite count when processing the records to compute return addresses. Patch by Kavon Farvardin! Reviewers: atrick, ributzka, sanjoy Subscribers: nemanjai Differential Revision: https://reviews.llvm.org/D23487 llvm-svn: 281532
* Next set of additional error checks for invalid Mach-O files for bad load ↵Kevin Enderby2016-09-1313-0/+0
| | | | | | | | | | | | | commands that use the Mach::dyld_info_command type for the load commands that are currently use in the MachOObjectFile constructor. This contains the missing checks for LC_DYLD_INFO and LC_DYLD_INFO_ONLY load commands and the fields for the Mach::dyld_info_command type. llvm-svn: 281400
* Next set of additional error checks for invalid Mach-O files for bad load ↵Kevin Enderby2016-08-315-0/+0
| | | | | | | | | | | | | | | | | commands that use the Mach::linkedit_data_command type for the load commands that are currently used in the MachOObjectFile constructor. This contains the missing checks for LC_DATA_IN_CODE and LC_LINKER_OPTIMIZATION_HINT load commands and the fields for the Mach::linkedit_data_command type. Checking for other load commands that use this type will be added later. Also fixed a couple of places that was using sizeof(MachOObjectFile::LoadCommandInfo) that should have been using sizeof(MachO::load_command). llvm-svn: 280267
* Add a test file, macho-invalid-dysymtab-extreloff-nextrel,Kevin Enderby2016-08-301-0/+0
| | | | | | I forgot to do an svn add on. llvm-svn: 280167
* Next set of additional error checks for invalid Mach-O files for bad ↵Kevin Enderby2016-08-3014-0/+0
| | | | | | | | LC_DYSYMTAB’s. This contains the missing checks for LC_DYSYMTAB load command fields. llvm-svn: 280161
* Next set of additional error checks for invalid Mach-O files for bad ↵Kevin Enderby2016-08-267-0/+0
| | | | | | | | LC_SYMTAB’s. This contains the missing checks for LC_SYMTAB load command fields. llvm-svn: 279854
* Next set of additional error checks for invalid Mach-O files.Kevin Enderby2016-08-1210-0/+0
| | | | | | | | | | This contains the two missing checks for LC_SEGMENT load command fields. And checks for the Mach-O sections fields that would make them invalid. With the new checks, some of the existing malformed file checks now trips one of these instead of the issue it was having before so those tests were adjusted. llvm-svn: 278557
* Add the first of what will be a long line of additional error checks for ↵Kevin Enderby2016-08-051-0/+0
| | | | | | | | | | | | | invalid Mach-O files. This is where an LC_SEGMENT load command has a fileoff field that extends past the end of the file. Also fix llvm-nm and llvm-size to remove the errorToErrorCode() call so error messages are printed. And needed to update a few test cases now that they do print the error messages just a bit differently. llvm-svn: 277845
OpenPOWER on IntegriCloud