1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/tools/llvm-objcopy/CMakeLists.txt
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

62 lines
1.6 KiB
CMake

set(LLVM_LINK_COMPONENTS
Object
Option
Support
MC
)
set(LLVM_TARGET_DEFINITIONS ObjcopyOpts.td)
tablegen(LLVM ObjcopyOpts.inc -gen-opt-parser-defs)
add_public_tablegen_target(ObjcopyOptsTableGen)
set(LLVM_TARGET_DEFINITIONS InstallNameToolOpts.td)
tablegen(LLVM InstallNameToolOpts.inc -gen-opt-parser-defs)
add_public_tablegen_target(InstallNameToolOptsTableGen)
set(LLVM_TARGET_DEFINITIONS BitcodeStripOpts.td)
tablegen(LLVM BitcodeStripOpts.inc -gen-opt-parser-defs)
add_public_tablegen_target(BitcodeStripOptsTableGen)
set(LLVM_TARGET_DEFINITIONS StripOpts.td)
tablegen(LLVM StripOpts.inc -gen-opt-parser-defs)
add_public_tablegen_target(StripOptsTableGen)
add_llvm_tool(llvm-objcopy
CopyConfig.cpp
llvm-objcopy.cpp
COFF/COFFObjcopy.cpp
COFF/Object.cpp
COFF/Reader.cpp
COFF/Writer.cpp
ELF/ELFConfig.cpp
ELF/ELFObjcopy.cpp
ELF/Object.cpp
MachO/MachOObjcopy.cpp
MachO/MachOReader.cpp
MachO/MachOWriter.cpp
MachO/MachOLayoutBuilder.cpp
MachO/Object.cpp
wasm/Object.cpp
wasm/Reader.cpp
wasm/Writer.cpp
wasm/WasmObjcopy.cpp
DEPENDS
ObjcopyOptsTableGen
InstallNameToolOptsTableGen
StripOptsTableGen
)
add_llvm_tool_symlink(llvm-install-name-tool llvm-objcopy)
add_llvm_tool_symlink(llvm-bitcode-strip llvm-objcopy)
add_llvm_tool_symlink(llvm-strip llvm-objcopy)
if(LLVM_INSTALL_BINUTILS_SYMLINKS)
add_llvm_tool_symlink(objcopy llvm-objcopy)
add_llvm_tool_symlink(strip llvm-objcopy)
endif()
if(LLVM_INSTALL_CCTOOLS_SYMLINKS)
add_llvm_tool_symlink(install_name_tool llvm-install-name-tool)
add_llvm_tool_symlink(bitcode_strip llvm-bitcode-strip)
endif()