Commit Graph

4 Commits

Author SHA1 Message Date
Alexey Lapshin dedf006fa9 Fix for buildbot failure: https://lab.llvm.org/buildbot#builders/110/builds/11051
after https://reviews.llvm.org/D121005
2022-03-09 14:26:46 +03:00
Alexey Lapshin 2dc4a80ec0 [objcopy][NFC] Move NameOrPattern::create() into CommonConfig.h
While moving objcopy into separate library(D88827), NameOrPattern::create()
was mistakenly placed into ObjcopyOptions.cpp. This patch moves
the NameOrPattern::create() into CommonConfig.h. Additionally it adds
test for using NameOrPattern.

Differential Revision: https://reviews.llvm.org/D121005
2022-03-09 13:03:28 +03:00
Alexey Lapshin a6f3fedc3f [objcopy] Refactor CommonConfig to add posibility to specify added/updated sections as MemoryBuffer.
Current objcopy implementation has a possibility to add or update sections.
The incoming section is specified as a pair: section name and name of the file
containing section data. The interface does not allow to specify incoming
section as a memory buffer. This patch adds possibility to specify incoming
section as a memory buffer.

Differential Revision: https://reviews.llvm.org/D120486
2022-03-01 14:49:41 +03:00
Alexey Lapshin f75da0c8e6 [llvm-objcopy][NFC] Move core implementation of llvm-objcopy into separate library.
This patch moves core implementation of llvm-objcopy into Object library
(http://lists.llvm.org/pipermail/llvm-dev/2020-September/145075.html).
The functionality for parsing input options is left inside tools/llvm-objcopy.
The interface of ObjCopy library:

ObjCopy/ELF/ELFObjcopy.h

```
Error executeObjcopyOnIHex(const CopyConfig &Config, MemoryBuffer &In,
                           Buffer &Out);
Error executeObjcopyOnRawBinary(const CopyConfig &Config, MemoryBuffer &In,
                                Buffer &Out);
Error executeObjcopyOnBinary(const CopyConfig &Config,
                             object::ELFObjectFileBase &In, Buffer &Out);

```
ObjCopy/COFF/COFFObjcopy.h

```
Error executeObjcopyOnBinary(const CopyConfig &Config,
                             object::COFFObjectFile &In, Buffer &Out);

```
ObjCopy/MachO/MachOObjcopy.h

```
Error executeObjcopyOnBinary(const CopyConfig &Config,
                             object::MachOObjectFile &In, Buffer &Out);

```
ObjCopy/wasm/WasmObjcopy.h

```
Error executeObjcopyOnBinary(const CopyConfig &Config,
                             object::WasmObjectFile &In, Buffer &Out);

```

Differential Revision: https://reviews.llvm.org/D88827
2022-02-17 13:11:42 +03:00