[llvm-dev] llvm-objcopy proposal

Dmitry Golovin via llvm-dev llvm-dev at lists.llvm.org
Fri Jun 2 11:46:14 PDT 2017


Having llvm-objcopy would be great! A really small version of it was already implemented:

https://github.com/RodAtDISA/llvm-objcopy
https://github.com/tpimh/llvm-objcopy (this fork can be compiled with LLVM master)

The functions of this implementation of objcopy are very, uhm... limited.

I think this topic appeared already several times on this mailing list, so probably we get some information from the previous discussions.

It would be great to have all the binutils in LLVM, so no external toolchain is needed.

Regards,
Dmitry

02.06.2017, 21:35, "Ed Maste via llvm-dev" <llvm-dev at lists.llvm.org>:
> On 1 June 2017 at 20:21, Jake Ehrlich via llvm-dev
> <llvm-dev at lists.llvm.org> wrote:
>>  LLVM already implements its own version of almost all of binutils. The
>>  exceptions to this rule are objcopy and strip. This is a proposal to
>>  implement
>>  an llvm version of objcopy/strip to complete llvm’s binutils.
>
> A bit of info from the FreeBSD perspective. In FreeBSD we use ELF Tool
> Chain versions of most binutils (addr2line, c++filt, objcopy, nm,
> size, strings, strip, readelf) and bespoke versions of other tools
> (ar, elfdump, ranlib). The exceptions are as (for which we have no
> replacement), ld.bfd (we've switched to LLD for arm64 and are working
> on other architectures), and objdump (investigating llvm-objdump,
> although it still has some limitations).
>
> That said, I would very much like to see LLVM equivalents for all of
> the tools so that we can compare and benchmark against other
> implementations, and so that we have an alternative available if it
> becomes necessary. I would be happy for llvm-objcopy to exist.
>
>>  1. Use Case: Stripping debug information of an executable to a file
>>  6. Use Case: DWARF fission
>>  8. Use Case: Adding a gdb index
>
> It seems like these ought to just be done by the linker. We don't yet
> use (6) in FreeBSD because our toolchain is still using some ancient
> components on most architectures but it is something I very much wish
> to start doing.
>
>>  2. Use Case: Stripping debug information of a relocatable object to a file
>>     Who uses it: None of the 4 projects considered
>>  5. Use Case: “Complete stripping” an executable
>>     Who uses it: None of the 4 projects
>>     ```sh
>>     eu-strip --strip-sections foo
>>     ```
>
> I'd be surprised to find this being used.
>
>>  3. Use Case: Stripping debug information of a shared library to a file
>>  4. Use Case: Stripping an executable
>>  7. Use Case: Converting an executable to binary
>>  9. Use Case: Converting between formats [ELF->PE]
>>  12. Use Case: Removing a specific unwanted section
>
> We use these cases in FreeBSD.
>
> One additional use case for you: converting from a binary to an ELF object file
> ```
> objcopy -I binary -O elf64-x86-64 foo.bin foo.o
> ```
> This is sometimes used for embedding binary files for use by drivers and such.
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list