1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/lib
Kevin Enderby 3bd0231fd8 Start to add real error messages for malformed Mach-O files.
And update the existing test cases in test/Object/macho-invalid.test
to use llvm-objdump with the -macho option to produce these
error messages and stop producing the generic "Invalid data
was encountered while parsing the file" message.

Working from the beginning of the file, if the mach header is too large for
the size of the file and then if the load commands that follow extend past
the end of the file these two errors now generate correct error messages.

Both of these have existing test cases in test/Object/macho-invalid.test .

But the first with macho-invalid-header it will never trigger the error message
"mach header extends past the end of the file" using any of the llvm tools as
they all use identify_magic() which rejects files with the correct magic number
that are too small in size.  So I tested this by hacking that code and seeing the
error message down in parseHeader() really does happen.  So in case there
is ever code in llvm that directly calls createMachOObjectFile() this error
message will be correctly produced.

The second error message of "load commands extends past the end of the file"
is triggered by a number of existing tests cases in test/Object/macho-invalid.test .
Also other tests trigger different error messages now like "ilocalsym plus
nlocalsym in LC_DYSYMTAB load command extends past the end of the
symbol table".

There are two existing test cases that still get the "Invalid data was encountered ..."
error messages that I will tackle next.  But they will involve a bit of pluming an
Expect<...> up through the call stack and I want to do those as separate changes.

FYI, for those test cases that were trying to test specific errors that now get
different errors I’ll fix those in follow on changes and create new test cases
for those so they test the error they were meant to test.

llvm-svn: 266248
2016-04-13 21:17:58 +00:00
..
Analysis Simplify strlen to a subtraction for certain cases. 2016-04-13 14:31:06 +00:00
AsmParser Add the allocsize attribute to LLVM. 2016-04-12 01:05:35 +00:00
Bitcode Revert "Make aliases explicit in the summary" 2016-04-13 17:20:07 +00:00
CodeGen Cleanup Store Merging in UseAA case 2016-04-13 17:27:26 +00:00
DebugInfo Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
ExecutionEngine Thread Expected<...> up from createMachOObjectFile() to allow llvm-objdump to produce a real error message 2016-04-06 22:14:09 +00:00
Fuzzer Remove redundant .c_str(), as suggested by PR25633 2016-04-11 20:35:17 +00:00
IR Revert "[IR/Verifier] Each DISubprogram with isDefinition: true must belong to a CU." 2016-04-13 18:08:07 +00:00
IRReader Remove autoconf support 2016-01-26 21:29:08 +00:00
LibDriver LibDriver: Silently do nothing when provided no inputs. 2016-04-13 19:36:04 +00:00
LineEditor Fix Clang-tidy modernize-deprecated-headers warnings in some files; other minor fixes. 2016-03-28 17:40:08 +00:00
Linker ValueMapper: Extract llvm::RemapFunction from IRMover.cpp, NFC 2016-04-08 19:26:32 +00:00
LTO Simplify LTOInternalize into UpdateLLVMCompilerUsed 2016-04-13 06:32:46 +00:00
MC AsmParser: record "# line file" context to calculate location for diag 2016-04-13 19:46:54 +00:00
Object Start to add real error messages for malformed Mach-O files. 2016-04-13 21:17:58 +00:00
ObjectYAML [lanai] Add Lanai backend. 2016-03-28 13:09:54 +00:00
Option Annotate dump() methods with LLVM_DUMP_METHOD, addressing Richard Smith r259192 post commit comment. 2016-01-29 20:50:44 +00:00
Passes [PM] Rename the CRTP mixin base classes for the new pass manager to 2016-03-11 10:33:22 +00:00
ProfileData Add code comment/NFC 2016-04-11 17:13:08 +00:00
Support Fix missing include on OpenBSD 2016-04-08 16:45:05 +00:00
TableGen [TableGen] Fix typos in comments. NFC 2016-02-26 06:50:27 +00:00
Target AMDGPU/SI: Add support for spilling VGPRs without having to scavenge registers 2016-04-13 20:44:16 +00:00
Transforms NFC mergefunc: const correctness 2016-04-13 21:12:21 +00:00
CMakeLists.txt Move ObjectYAML code to a new library. 2016-03-01 19:15:06 +00:00
LLVMBuild.txt Add LLVMBuild for ObjectYAML. 2016-03-01 21:29:33 +00:00