Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7077755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:27:45+00:00 2026-05-28T06:27:45+00:00

There have been a number of posts on stackoverflow and other places detailing how

  • 0

There have been a number of posts on stackoverflow and other places detailing how to embed binary blobs into elf binaries.

Embedding binary blobs using gcc mingw

and

C/C++ with GCC: Statically add resource files to executable/library

being the most complete answers.

But there’s a possible issue which noone mentions. Here’s a quicky foo.txt coverted to foo.o:

$ objdump -x foo.o 
foo.o:     file format elf32-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .data         0000000d  00000000  00000000  00000034  2**0
                  CONTENTS, ALLOC, LOAD, DATA
SYMBOL TABLE:
00000000 l    d  .data  00000000 .data
0000000d g       .data  00000000 _binary_foo_txt_end
0000000d g       *ABS*  00000000 _binary_foo_txt_size
00000000 g       .data  00000000 _binary_foo_txt_start

Now, I don’t really grok all this output – is there documentation for this stuff??? I guess most of it is obvious enough “g” is global and “l” is local etc etc…

What stands out is the alignment for the .data segment set at 0. Does that mean what I think it means? ie: When it comes to linking, the linker will go “ah yeah, wherever…”

If you embed char data or are working on an x86 then you’ll never notice. But if you embed int data or, as I’m doing, 16 and 32 bit data on an ARM, then you could get an alignment trap at any point.

My gut feeling is that this means that either objcopy needs another option to specify alignment of the binary blob, or it’s broken and you shouldn’t use this method at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T06:27:46+00:00Added an answer on May 28, 2026 at 6:27 am

    To answer my own question, I’d assert that objcopy is broken in this instance. I believe that using assembly is likely the best way to go here using Gnu as. Unfortunately I’m now linux machine-less so can’t test this properly but I’ll put this answer here in case someone finds it or wants to check:

    .section ".rodata"
    .align 4 # which either means 4 or 2**4 depending on arch!
    
    .global _binary_file_bin_start
    .type _binary_file_bin_start, @object
    _binary_file_bin_start:
    .incbin file.bin
    
    .align 4
    .global _binary_file_bin_end
    _binary_file_bin_end:
    

    The underscores are the traditional way to annoy yourself with C/asm interoperability. In other words they vanish with MS/Borland compilers under Windows.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there have been a number of posts regarding the height:100% declaration
I realize there have already been a number of posts on n-tier design and
So I know there have been a number of similar posts, but I think
There have been a number of problems related to IE8 breaking Visual Studio 2005/2008.
Been looking through a number of other related posts relating to flowchart software. I
Although I have been through a number of posts that discuss Linq to SQL
There have been several questions on SO regarding getting Contacts numbers using the Contacts
There have been some questions about whether or not JavaScript is an object-oriented language.
There have been several questions already posted with specific questions about dependency injection ,
There have been a couple of questions that sort of dealt with this but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.