1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/tools
Georgii Rymar 04b897752e Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt.
This is recommit for D90903 with fixes for BB:
1) Used std::move<> when returning Expected<> (http://lab.llvm.org:8011/#/builders/112/builds/913)
2) Fixed the name of temporarily file in the file-headers.test (http://lab.llvm.org:8011/#/builders/36/builds/1269)
   (a local old temporarily file was used before)

For creating `ELFObjectFile` instances we have the factory method
`ELFObjectFile<ELFT>::create(MemoryBufferRef Object)`.

The problem of this method is that it scans the section header to locate some sections.
When a file is truncated or has broken fields in the ELF header, this approach does
not allow us to create the `ELFObjectFile` and dump the ELF header.

This is https://bugs.llvm.org/show_bug.cgi?id=40804

This patch suggests a solution - it allows to delay scaning sections in the
`ELFObjectFile<ELFT>::create`. It now allows user code to call an object
initialization (`initContent()`) later. With that it is possible,
for example, for dumpers just to dump the file header and exit.
By default initialization is still performed as before, what helps to keep
the logic of existent callers untouched.

I've experimented with different approaches when worked on this patch.
I think this approach is better than doing initialization of sections (i.e. scan of them)
on demand, because normally users of `ELFObjectFile` API expect to work with a valid object.
In most cases when a section header table can't be read (because of an error), we don't
have to continue to work with object. So we probably don't need to implement a more complex API.

Differential revision: https://reviews.llvm.org/D90903
2020-11-09 12:53:53 +03:00
..
bugpoint [bugpoint] Delete -safe-llc and make -run-llc work like -run-llc -safe-run-llc 2020-10-09 16:38:30 -07:00
bugpoint-passes
dsymutil Revert "[DWARFLinker] Capitalize type names (NFC)" 2020-10-22 15:09:45 +07:00
gold [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
llc [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
lli [ORC] Remove OrcV1 APIs. 2020-10-18 21:02:44 -07:00
llvm-ar Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-as [opt] Remove obsolete --quiet option 2020-07-08 13:21:20 -07:00
llvm-as-fuzzer
llvm-bcanalyzer
llvm-c-test C API: support scalable vectors 2020-10-28 18:19:34 -04:00
llvm-cat
llvm-cfi-verify Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-config [MinGW] Use lib prefix for libraries 2020-09-12 22:01:29 +03:00
llvm-cov [llvm-cov] Fix missing slash in -path-equivalence 2020-11-06 14:54:11 -08:00
llvm-cvtres Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-cxxdump
llvm-cxxfilt
llvm-cxxmap
llvm-diff
llvm-dis
llvm-dwarfdump llvm-dwarfdump: Exit non-zero on an error path 2020-10-14 22:10:43 -07:00
llvm-dwp Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-elfabi [elfabi] Move llvm-elfabi related code to InterfaceStub library 2020-08-13 11:51:44 -07:00
llvm-exegesis [llvm-exegesis] Fix rGaf658d920e2b 2020-11-04 13:23:34 +01:00
llvm-extract [opt] Remove obsolete --quiet option 2020-07-08 13:21:20 -07:00
llvm-go
llvm-gsymutil
llvm-ifs [llvm] Fix ODRViolations for VersionTuple YAML specializations NFC 2020-10-20 18:29:15 -07:00
llvm-isel-fuzzer [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
llvm-itanium-demangle-fuzzer
llvm-jitlink [ORC] Update Symbol Lookup / DefinitionGenerator system. 2020-10-19 01:59:03 -07:00
llvm-jitlistener
llvm-libtool-darwin Fix shared build. 2020-10-30 00:46:23 -04:00
llvm-link llvm-link: Add support for archive files as inputs 2020-07-14 15:30:59 -04:00
llvm-lipo [Object][MachO] Refine the interface of Slice 2020-09-25 16:27:45 -07:00
llvm-lto [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
llvm-lto2 [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
llvm-mc [llvm-mc] Drop unneeded dependency on CodeGen 2020-10-28 10:53:15 -07:00
llvm-mc-assemble-fuzzer
llvm-mc-disassemble-fuzzer
llvm-mca [MC] Make MCStreamer aware of AsmParser's StartTokLoc 2020-11-02 12:32:07 -08:00
llvm-microsoft-demangle-fuzzer
llvm-ml [ms] [llvm-ml] Lex MASM strings, including escaping 2020-11-04 15:28:43 -05:00
llvm-modextract
llvm-mt Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-nm [llvm-nm] Use aggregate initialization instead of memset zero 2020-09-16 10:27:12 -07:00
llvm-objcopy [llvm-objcopy][MachO] Minor refactoring of MachOLayoutBuilder 2020-11-07 20:25:49 -08:00
llvm-objdump [objdump][macho] Check arch before formating reloc name as arm64 addend 2020-10-16 14:30:22 -07:00
llvm-opt-fuzzer [NFC] Clean up PassBuilder 2020-10-30 10:03:59 -07:00
llvm-opt-report
llvm-pdbutil [COFF][ARM] Fix CodeView for Windows on 32bit ARM targets. 2020-10-19 22:16:16 -07:00
llvm-profdata [llvm-profdata]Fix llvm-profdata crash on compact binary profile 2020-09-20 16:58:34 -07:00
llvm-rc [llvm-rc] Lowercase the option definitions. NFC. 2020-09-16 09:34:26 +03:00
llvm-readobj Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt. 2020-11-09 12:53:53 +03:00
llvm-reduce [llvm-reduce] Add reduction for aliases. 2020-10-28 13:11:19 +00:00
llvm-rtdyld
llvm-shlib [Support] On Windows, add optional support for {rpmalloc|snmalloc|mimalloc} 2020-08-27 11:09:46 -04:00
llvm-size [llvm-size] Output REL, RELA and STRTAB sections when allocatable 2020-07-01 12:02:32 +01:00
llvm-special-case-list-fuzzer
llvm-split
llvm-stress [SVE] Remove calls to VectorType::getNumElements() from llvm-stress 2020-08-31 15:51:15 -07:00
llvm-strings
llvm-symbolizer Revert several changes related to llvm-symbolizer exiting non-zero on failure. 2020-10-21 15:21:44 -07:00
llvm-undname
llvm-xray Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
llvm-yaml-numeric-parser-fuzzer
lto [AIX] Turn -fdata-sections on by default in Clang 2020-10-14 15:58:31 +00:00
msbuild
obj2yaml Fix debug_abbrev emitter to only assign table id once 2020-11-08 18:11:50 -08:00
opt Reland [NewPM] Add OptimizationLevel param to registerPipelineStartEPCallback 2020-11-04 13:11:40 -08:00
opt-viewer
remarks-shlib [tools][remarks-shlib] Don't build libRemarks.so without PIC 2020-09-20 12:40:21 +02:00
sancov [Support] Use InitLLVM in llvm-stress, sancov and TableGen 2020-07-28 07:50:45 -04:00
sanstats Internalize functions from various tools. NFC 2020-09-26 15:57:13 -07:00
split-file [split-file] Fix sys::fs::remove() on Solaris after D83834 2020-08-11 08:05:10 -07:00
verify-uselistorder Handle value uses wrapped in metadata for the use-list order 2020-10-20 20:05:59 +02:00
vfabi-demangle-fuzzer
xcode-toolchain
yaml2obj [llvm] Make obj2yaml and yaml2obj LLVM utilities instead of tools 2020-10-19 10:21:21 -07:00
CMakeLists.txt
LLVMBuild.txt Revert "[IRSim] Adding basic implementation of llvm-sim." 2020-09-25 16:18:48 -05:00