llvm-project/llvm/tools/llvm-objdump
Alvin Wong bb94611d65 [COFF] Check table ptr more thoroughly and ignore empty sections
When loading split debug files for PE/COFF executables (produced with
`objcopy --only-keep-debug`), the tables or directories in such files
may point to data inside sections that may have been stripped.
COFFObjectFile shall detect and gracefully handle this, to allow the
object file be loaded without considering these tables or directories.
This is required for LLDB to load these files for use as debug symbols.

COFFObjectFile shall also check these pointers more carefully to account
for cases in which the section contains less raw data than the size
given by VirtualSize, to prevent going out of bounds.

This commit also changes COFFDump in llvm-objdump to reuse the pointers
that are already range-checked in COFFObjectFile. This fixes a crash
when trying to dump the TLS directory from a stripped file.

Fixes https://github.com/mstorsjo/llvm-mingw/issues/284

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D126898
2022-06-03 18:31:01 +03:00
..
CMakeLists.txt Install symlink "otool" if LLVM_INSTALL_CCTOOLS_SYMLINKS is set 2022-03-23 16:22:24 -04:00
COFFDump.cpp [COFF] Check table ptr more thoroughly and ignore empty sections 2022-06-03 18:31:01 +03:00
COFFDump.h [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00
ELFDump.cpp [llvm-objdump] --private-headers: change errors to warnings for dynamic section dumping 2022-03-28 01:00:43 -07:00
ELFDump.h
MachODump.cpp [MCDisassembler] Disambiguate Size parameter in tryAddingSymbolicOperand() 2022-05-25 13:44:32 -07:00
MachODump.h Add a (nonfunctional) -dyld_info flag to llvm-objdump. 2022-02-22 11:06:27 -08:00
ObjdumpOptID.h [llvm-objdump] Add an llvm-otool tool 2021-04-20 08:24:58 -04:00
ObjdumpOpts.td Add a (nonfunctional) -dyld_info flag to llvm-objdump. 2022-02-22 11:06:27 -08:00
OtoolOpts.td Add a (nonfunctional) -dyld_info flag to llvm-objdump. 2022-02-22 11:06:27 -08:00
SourcePrinter.cpp Cleanup include: DebugInfo/Symbolize 2022-02-24 13:25:11 +01:00
SourcePrinter.h Cleanup LLVMObject headers 2022-02-10 21:13:44 +01:00
WasmDump.cpp [llvm-objdump] Use cast<> instead of dyn_cast<> to avoid dereference of nullptr 2022-01-23 12:50:12 +00:00
WasmDump.h
XCOFFDump.cpp [AIX]implement the --syms and using "symbol index and qualname" for --sym --symbol--description for llvm-objdump for xcoff 2021-10-01 12:37:51 -04:00
XCOFFDump.h [AIX]implement the --syms and using "symbol index and qualname" for --sym --symbol--description for llvm-objdump for xcoff 2021-10-01 12:37:51 -04:00
llvm-objdump.cpp [llvm-objdump] Let --symbolize-operands symbolize basic block addresses based on the SHT_LLVM_BB_ADDR_MAP section. 2022-05-16 10:11:11 -07:00
llvm-objdump.h [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00