[llvm-dev] [lld] supporting binary-to-ELF conversion

Rui Ueyama via llvm-dev llvm-dev at lists.llvm.org
Mon Mar 14 15:52:06 PDT 2016


On Mon, Mar 14, 2016 at 3:46 PM, Ed Maste <emaste at freebsd.org> wrote:

> On 14 March 2016 at 21:32, Rui Ueyama <ruiu at google.com> wrote:
> > That command uses the linker to wrap a blob with an ELF header. This is
> an
> > interesting feature, but it seems to me that that is too specific to some
> > special use case. Linkers are, well, to link stuff, and in this case this
> > links nothing. If the linker hadn't supported "-b binary", they would
> have
> > done this in a different way.
>
> Ok, that was my thought as well. I only second-guessed it when I found
> gold supports it, since as far as I know the intent of gold's design
> was to support only ELF linking.
>
> > I think this use case should be done using objdump. You can create an
> empty
> > ELF file using as or something, and copy the blob to .text section using
> > objcopy, no?
>
> Yes, objcopy works much as ld -r for this use case, except that
> objcopy needs the output machine type to be specified explicitly. This
> is probably another argument against supporting it in lld, actually --
> we'd need the notion of a default output format.
>

I guess that's a shell script, so you can set output type by dispatching on
uname (or similar command) output, right?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160314/d9fad6e1/attachment.html>


More information about the llvm-dev mailing list