llvm-project/llvm/lib
Kevin Enderby 22fc007809 Add a checkSymbolTable() method to the MachOObjectFile class.
The philosophy of the error checking in libObject for Mach-O files
is that the constructor will check the load commands so for their
tables the offsets and sizes are properly contained in the file.
But there is no checking of the entries of any of the tables.

For the contents of the tables themselves the methods accessing
the contents of the entries return errors as needed.  In some
cases this however makes it difficult or cumbersome to produce
a good error message which would include the tool name, file name,
archive member, and name of the architecture of a slice of a universal file
the error occurred in.

So idea is that there will be a method to check a table which can
be called up front before using it allowing a good error message
to be produced before a table is used.  And if only verification of
the Mach-O file and its tables are wanted a new possible method
checkAllTables() could be added to call all of the methods to
check all the tables at some time when such methods exist.

The checkSymbolTable() is the first of such methods to check
one of the Mach-O file tables.  This method initially will used in
llvm-objdump’s DisassembleMachO() routine before it gets the
section and symbol information.  As if there are problems with
the symbol table currently the error is first encountered by the
bool operator() in the SymbolSorter() struct which passed to
std::sort().  In this case there is no context as to the file name
the symbol which results a poor error message:

LLVM ERROR: truncated or malformed object (bad string index: 22 for symbol at index 1)

with the added call to the checkSymbolTable() method the
error message includes the tool name and file name:

llvm-objdump: 'macho-invalid-symbol-strx': truncated or malformed object (bad string table index: 22 past the end of string table, for symbol at index 1)
llvm-svn: 286887
2016-11-14 20:57:04 +00:00
..
Analysis Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm" 2016-11-14 17:12:32 +00:00
AsmParser IR: Introduce inrange attribute on getelementptr indices. 2016-11-10 22:34:55 +00:00
Bitcode Restore "[ThinLTO] Prevent exporting of locals used/defined in module level asm" 2016-11-14 17:12:32 +00:00
CodeGen Remove redundant condition (PR28800) NFCI. 2016-11-14 10:40:23 +00:00
DebugInfo Remove extra semicolon. 2016-11-12 00:23:32 +00:00
Demangle Demangle: only demangle mangled symbols 2016-11-14 04:54:47 +00:00
ExecutionEngine [ORC] Re-apply 286620 with fixes for the ErrorSuccess class. 2016-11-11 21:42:09 +00:00
Fuzzer [libFuzzer] replace 'auto' with 'auto *' to better follow the LLVM style 2016-11-14 19:21:38 +00:00
IR [AVX-512] Remove and autoupgrade masked dword/qword variable shift intrinsics to the new unmasked versions and selects. 2016-11-14 01:53:22 +00:00
IRReader Bitcode: Change module reader functions to return an llvm::Expected. 2016-11-13 07:00:17 +00:00
LTO [ThinLTO] Only promote exported locals as marked in index 2016-11-14 19:21:41 +00:00
LibDriver Object: Replace NewArchiveIterator with a simpler NewArchiveMember class. NFCI. 2016-06-29 22:27:42 +00:00
LineEditor
Linker Typo 2016-11-14 17:26:32 +00:00
MC Fix 24560: assembler does not share constant pool for same constants 2016-11-04 19:17:32 +00:00
Object Add a checkSymbolTable() method to the MachOObjectFile class. 2016-11-14 20:57:04 +00:00
ObjectYAML Fix Clang-tidy readability-redundant-string-cstr warnings 2016-11-02 16:43:50 +00:00
Option Generalize ArgList::AddAllArgs more 2016-09-29 19:47:58 +00:00
Passes Conditionally eliminate library calls where the result value is not used 2016-10-18 21:36:27 +00:00
ProfileData Make the Error class constructor protected 2016-11-11 04:28:40 +00:00
Support Use _Unwind_Backtrace on Apple platforms. 2016-11-14 17:56:18 +00:00
TableGen Fix some Clang-tidy modernize-use-using and Include What You Use warnings; other minor fixes. 2016-08-23 17:14:32 +00:00
Target [Hexagon] Give a predicate function a more meaningful name 2016-11-14 20:53:09 +00:00
Transforms [ThinLTO] Only promote exported locals as marked in index 2016-11-14 19:21:41 +00:00
CMakeLists.txt Try to fix a circular dependency in the modules build. 2016-09-06 20:16:19 +00:00
LLVMBuild.txt Add an c++ itanium demangler to llvm. 2016-09-06 19:16:48 +00:00