[llvm-dev] [lld] supporting binary-to-ELF conversion
Justin Hibbits via llvm-dev
llvm-dev at lists.llvm.org
Mon Mar 14 14:46:36 PDT 2016
I've used objcopy to create an ELF from a bin for linking at $PREVJOB.
I think this makes more sense than using ld for the task.
- Justin
On Mon, Mar 14, 2016 at 1:24 PM, Ed Maste via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> One of the issues I reported in using lld as the FreeBSD base system
> linker is that the base system currently uses ld -r to convert a
> binary file (device firmware image) into an ELF object:
>
>> A tool for loading firmware into a wireless USB device includes a
>> built-in copy of the firmware image, and the image is converted to an
>> ELF file using ld -r.
>
> The invocation is:
> ld -b binary -d -warn-common -r -d -o ar5523.o ar5523.bin
> which produces an object with a .data section containing the binary
> data, and symbols for the start, end, and size.
>
> I think the -d here has no effect and could be dropped, but we do not
> support "-b binary" in lld. Originally I thought this is somewhat
> strange functionality for a linker to support, and assumed there'd be
> no interest in adding support to lld.
>
> It could be addressed in FreeBSD by using objcopy or just converting
> the binary blob to a C array and treating it as another source file.
>
> That said, I was surprised to find that gold also supports this use,
> so perhaps it's less strange than I thought. Before I go and make a
> change in FreeBSD I want to see what others think about supporting "-b
> binary" in lld.
> _______________________________________________
> 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