[llvm-dev] llvm-objcopy round-table summary

James Henderson via llvm-dev llvm-dev at lists.llvm.org
Mon Oct 22 04:34:53 PDT 2018


> **Action**: James Henderson to provide results of feature comparison
versus GNU objcopy.

A couple of weeks ago, I did an analysis of the GNU objcopy command-line
switches versus the llvm-objcopy ones. I did not go into depth to compare
behaviour of the individual switches - I only verified that such switches
exist. Following are my results. It's worth noting that a number of missing
features are for file formats that llvm-objcopy does not currently support
(especially COFF).

GNU feature/option         | llvm-objcopy feature/      | Notes
                           | option                     |
===========================+============================+=========
=============
objcopy <filename>         | llvm-objcopy <filename>    |
objcopy <infile> <outfile> | llvm-objcopy               |
                           |   <infile> <outfile>       |
-I/--input-target          | -I--input-target           | "binary" only
-O/--output-target         | -O/--output-target         | "binary"/ELF only
-B/--binary-architecture   | -B/--binary-architecture   |
-F/--target                | -F/--target                |
--debugging                | *None available*           |
-p/--preserve-dates        | -p/--preserve-dates        |
-j/--only-section          | -j/--only-section          |
--add-gnu-debuglink        | --add-gnu-debuglink        |
-R/--remove-section        | -R/--remove-section        |
-S/--strip-all             | -S/--strip-all             | --strip-all-gnu is
                           |                            | closer to GNU
objcopy
-g/--strip-debug           | --strip-debug              | '-g' not supported
--strip-unneeded           | --strip-unneeded           |
-N/--strip-symbol          | -N/--strip-symbol          |
--strip-unneeded-symbol    | *None available*           |
--only-keep-debug          | --only-keep-debug          |
--extract-symbol           | *None available*           |
-K/--keep-symbol           | -K/--keep-symbol           |
--keep-file-symbols        | --keep-file-symbols        |
--localize-hidden          | --localize-hidden          |
-L/--localize-symbol       | -L/--localize-symbol       |
--globalize-symbol         | --globalize-symbol         |
-G/--keep-global-symbol    | -G/--keep-global-symbol    |
-W/--weaken-symbol         | -W/--weaken-symbol         |
--weaken                   | --weaken                   |
-w/--wildcard              | *None available*           |
-x/--discard-all           | -x/--discard-all           |
-X/--discard-locals        | *None available*           |
-i/--interleave            | *None available*           |
--interleave-width         | *None available*           |
-b/--byte                  | *None available*           |
--gap-fill                 | *None available*           |
--pad-to                   | *None available*           |
--set-start                | *None available*           |
--change-start             | *None available*           |
--adjust-start             | *None available*           |
--change-addresses         | *None available*           |
--adjust-vma               | *None available*           |
--change-section-address   | *None available*           |
--adjust-section-vma       | *None available*           |
--change-section-lma       | *None available*           |
--change-section-vma       | *None available*           |
--[no-]change-warnings     | *None available*           |
--[no-]adjust-warnings     | *None available*           |
--set-section-flags        | *None available*           | Use
--rename-section
--add-section              | --add-section              |
--rename-section           | --rename-section           |
--long-section-names       | *None available*           | COFF only
--change-leading-char      | *None available*           |
--remove-leading-char      | *None available*           |
--reverse-bytes            | *None available*           |
--redefine-sym             | --redefine-sym             |
--redefine-syms            | *None available*           |
--srec-len                 | *None available*           |
--srec-forceS3             | *None available*           |
--strip-symbols            | *None available*           |
--strip-unneeded-symbols   | *None available*           |
--keep-symbols             | *None available*           |
--localize-symbols         | *None available*           |
--globalize-symbols        | *None available*           |
--keep-global-symbols      | --keep-global-symbols      |
--weaken-symbols           | *None available*           |
--alt-machine-code         | *None available*           |
--writable-text            | *None available*           |
--readonly-text            | *None available*           |
--pure                     | *None available*           |
--impure                   | *None available*           |
--prefix-symbols           | --prefix-symbols           |
--prefix-sections          | *None available*           |
--prefix-alloc-sections    | *None available*           |
--file-alignment           | *None available*           |
--heap                     | *None available*           |
--image-base               | *None available*           |
--section-alignment        | *None available*           |
--stack                    | *None available*           |
--subsystem                | *None available*           |
--compress-debug-sections  | --compress-debug-sections  |
--decompress-debug-sections| --decompress-debug-sections|
--verbose                  | *None available*           |
objcopy @<file>            | *None available*           |


On Mon, 22 Oct 2018 at 11:00, James Henderson <jh7370.2008 at my.bristol.ac.uk>
wrote:

> Hi,
>
> On Thursday of the recent developers meeting, we had a round-table
> discussing llvm-objcopy. Below are some notes I took from that
> meeting. The discussion was fairly free-flowing, so the notes are not
> particularly in depth. If anybody has any other comments relating to
> this meeting, feel free to add to this!
>
> Feature request: converting from 32-bit ELF to 64-bit ELF:
> -- Size in sections broken, needs updating to not just be a public
> member variable.
>
> Making llvm-objcopy into a library:
> -- Errors need to be non-fatal (return llvm::Error).
> -- Would be nice to provide this as a writable portion of libObject.
>
> **Action**: James Henderson to provide results of feature comparison
> versus GNU objcopy.
>
> Multiple file formats:
> -- Don't try to use a common intermediate representation for all
> object file formats!
> -- Separate backends for different file formats.
> ---- Would like to avoid people "forgetting" to implement some
> switches when implementing a new backend, leading to silent ignoring
> of switches (maybe use subclasses etc).
> ---- Shouldn't need to implement each option, beyond an "unsupported"
> message or similar.
>
> Output should be stable:
> -- Currently not the case for section header table (is deterministic,
> but might be unnecessarily different to input).
> -- No need to go to heroic efforts, if not realistic, or a better
> alternative is possible.
>
> Discussion on being able to modify the program header table:
> -- Jake reluctant to.
> -- But if real use case presents itself, should be okay.
> -- Some requirements to add segments post-link.
> -- Embedded use-cases may well break the immutable program header
> table requirement.
>
> File bugs upstream for visibility:
> -- **Action**: Jake Ehrlich to request himself, James Henderson,
> Jordan Rupprecht, and Alexander Shaposhnikov (four current main
> upstream developers/reviewers of llvm-objcopy) added as default-CC for
> llvm-objcopy bugs.
>
> Compatibility with GNU objcopy is a top concern:
> -- Where diverged, believed that GNU behaviour doesn't make sense, but
> open to alternative.
> -- File bugs/propose changes if issues encountered.
>
> Regards,
>
> James
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181022/4116bee6/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ObjcopyFeatureAnalysis.xlsx
Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Size: 11227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20181022/4116bee6/attachment.xlsx>


More information about the llvm-dev mailing list