<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 14, 2016 at 3:46 PM, Ed Maste <span dir="ltr"><<a href="mailto:emaste@freebsd.org" target="_blank">emaste@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 14 March 2016 at 21:32, Rui Ueyama <<a href="mailto:ruiu@google.com">ruiu@google.com</a>> wrote:<br>
> That command uses the linker to wrap a blob with an ELF header. This is an<br>
> interesting feature, but it seems to me that that is too specific to some<br>
> special use case. Linkers are, well, to link stuff, and in this case this<br>
> links nothing. If the linker hadn't supported "-b binary", they would have<br>
> done this in a different way.<br>
<br>
</span>Ok, that was my thought as well. I only second-guessed it when I found<br>
gold supports it, since as far as I know the intent of gold's design<br>
was to support only ELF linking.<br>
<span class=""><br>
> I think this use case should be done using objdump. You can create an empty<br>
> ELF file using as or something, and copy the blob to .text section using<br>
> objcopy, no?<br>
<br>
</span>Yes, objcopy works much as ld -r for this use case, except that<br>
objcopy needs the output machine type to be specified explicitly. This<br>
is probably another argument against supporting it in lld, actually --<br>
we'd need the notion of a default output format.<br>
</blockquote></div><br></div><div class="gmail_extra">I guess that's a shell script, so you can set output type by dispatching on uname (or similar command) output, right?</div></div>