1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/lib/Object
Alexey Lapshin c75c8e75b3 [llvm-objcopy][NFC] replace class Buffer/MemBuffer/FileBuffer with streams.
During D88827 it was requested to remove the local implementation
of Memory/File Buffers:

// TODO: refactor the buffer classes in LLVM to enable us to use them here
// directly.

This patch uses raw_ostream instead of Buffers. Generally, using streams
could allow us to reduce memory usages. No need to load all data into the
memory - the data could be streamed through a smaller buffer.
Thus, this patch uses raw_ostream as an interface for output data:

Error executeObjcopyOnBinary(CopyConfig &Config,
                             object::Binary &In,
                             raw_ostream &Out);

Note 1. This patch does not change the implementation of Writers
so that data would be directly stored into raw_ostream.
This is assumed to be done later.

Note 2. It would be better if Writers would be implemented in a such way
that data could be streamed without seeking/updating. If that would be
inconvenient then raw_ostream could be replaced with raw_pwrite_stream
to have a possibility to seek back and update file headers.
This is assumed to be done later if necessary.

Note 3. Current FileOutputBuffer allows using a memory-mapped file.
The raw_fd_ostream (which could be used if data should be stored in the file)
does not allow us to use a memory-mapped file. Memory map functionality
could be implemented for raw_fd_ostream:

It is possible to add resize() method into raw_ostream.

class raw_ostream {
  void resize(uint64_t size);
}

That method, implemented for raw_fd_ostream, could create a memory-mapped file.
The streamed data would be written into that memory file then.
Thus we would be able to use memory-mapped files with raw_fd_ostream.
This is assumed to be done later if necessary.

Differential Revision: https://reviews.llvm.org/D91028
2021-03-10 23:50:04 +03:00
..
Archive.cpp static const char *const foo => const char foo[] 2020-12-01 10:33:18 -08:00
ArchiveWriter.cpp
Binary.cpp Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt. 2020-11-09 12:53:53 +03:00
CMakeLists.txt [FaultsMaps][llvm-objdump] Move FaultMapParser to Object/. Remove CodeGen dependency from llvm-objdump 2021-01-27 10:39:59 -08:00
COFFImportFile.cpp
COFFModuleDefinition.cpp
COFFObjectFile.cpp [llvm] Use llvm::sort (NFC) 2021-01-17 10:39:45 -08:00
Decompressor.cpp
ELF.cpp [llvm-readelf] Support dumping the BB address map section with --bb-addr-map. 2021-03-08 16:20:11 -08:00
ELFObjectFile.cpp [AMDGPU] gfx90a support 2021-02-17 16:01:32 -08:00
Error.cpp
FaultMapParser.cpp [FaultsMaps][llvm-objdump] Move FaultMapParser to Object/. Remove CodeGen dependency from llvm-objdump 2021-01-27 10:39:59 -08:00
IRObjectFile.cpp
IRSymtab.cpp [IRSymTab] Set FB_used on llvm.compiler.used symbols 2021-03-03 16:22:30 -08:00
MachOObjectFile.cpp [MCA, ExecutionEngine, Object] Use llvm::is_contained (NFC) 2020-12-18 09:09:04 -08:00
MachOUniversal.cpp
MachOUniversalWriter.cpp [llvm-objcopy][NFC] replace class Buffer/MemBuffer/FileBuffer with streams. 2021-03-10 23:50:04 +03:00
Minidump.cpp
ModuleSymbolTable.cpp
Object.cpp
ObjectFile.cpp Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt. 2020-11-09 12:53:53 +03:00
RecordStreamer.cpp [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
RecordStreamer.h [MC] Support .symver *, *, remove 2021-03-06 15:23:02 -08:00
RelocationResolver.cpp [WebAssembly] Add new relocation for location relative data 2021-03-08 11:34:10 -08:00
SymbolicFile.cpp Recommit: [llvm-readelf/obj] - Allow dumping of ELF header even if some elements are corrupt. 2020-11-09 12:53:53 +03:00
SymbolSize.cpp [llvm] Use *::empty (NFC) 2021-01-16 09:40:55 -08:00
TapiFile.cpp
TapiUniversal.cpp
WasmObjectFile.cpp [WebAssembly] Add new relocation for location relative data 2021-03-08 11:34:10 -08:00
WindowsMachineFlag.cpp
WindowsResource.cpp
XCOFFObjectFile.cpp [llvm] Use static_assert instead of assert (NFC) 2021-01-22 23:25:05 -08:00