This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Specifying symbol names under which binary values are added


Hi!

Thanks for the suggestion. I am trying for now to make it compatible
data-wise with the output from before, only symbol names should be
different. I made:

.section images
.global _binary_image_jpg_start
.type _binary_image_jpg_start, @object
.align 4
_binary_image_jpg_start:
.incbin "/long/path/to/image.jpg"
.global _binary_image_jpg_end
.type _binary_image_jpg_end, @object
.align 4
_binary_image_jpg_end:
.global _binary_image_jpg_size
.type _binary_image_jpg_size, @object
.align 4
_binary_image_jpg_size:
.int _binary_image_jpg_end - _binary_image_jpg_start

And I assemble it with "as image.as -o image.o". But something does
not work. Resolving symbols in my other code and accessing data
returns me garbage now. Or at least something decoder fails to parse.
Is there anything more to do?


Mitar

On Sun, Mar 12, 2017 at 9:20 AM, Cary Coutant <ccoutant@gmail.com> wrote:
>> ld --relocatable --format==binary /long/path/to/image.jpg -o image.o
>>
>> To add the image.jpg to object. The issue is that symbols under which
>> the image is added are based on that filename provided. So for
>> /long/path/to/image.jpg this is something like
>> _long_path_to_image_jpg. Is there a way to specify the base symbol
>> name (to which then start, end, and size are appended) myself? The
>> issue is that by embedding paths, builds become harder to make
>> reproducible.
>
> Take a look at the .incbin assembler directive -- you can embed your
> file into an object using the assembler instead of the linker, and
> specify your own symbols.
>
> -cary



-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]