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 8391803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:21:25+00:00 2026-06-09T19:21:25+00:00

I created my bootloader before 2 years under debian squeeze/stable with gcc 4.5. Now

  • 0

I created my bootloader before 2 years under debian squeeze/stable with gcc 4.5. Now in debian wheezy/sid can’t be compiled with 4.6 and 4.7 because creates bigger sections from these i expecting to produce the final binary by hand. This is not problem for me now since in debian wheezy/sid the gcc 4.5 is still there but i ‘d like to make it possible to be compiled with gcc 4.6 and 4.7.

I produce the final binary like this:

the source files are compiled with:

gcc-4.5 -Wall -O3 -c -m32 -I. -o assemblybin-objects/vga_pm.S.o vga_pm.S

linked with:

ld -nostdlib -T binary.ld assemblybin-objects/vga_pm.S.o ... and other objects here ... -o bootloader.bin

the contents of the binary.ld is:

OUTPUT_FORMAT("binary","binary","binary")
OUTPUT_ARCH(i386)

SECTIONS
{
. = 0;
.bootloader : {
    . = 0x600;
    *(.bootstrap);
    . = 0x7fa;
    BYTE(0x11);
    BYTE(0x33);
    BYTE(0x55);
    BYTE(0x77);
    BYTE(0x55);
    BYTE(0xaa);
    _bootstrap_end = .;
    . = 0x800;
    *(.sysinit);
    _sysinit_end = .;
    . = 0x1000;
    *(.pages);
    _pages_end = .;
    . = 0x5000;
    *(.sysconf);
    *(.presystem);
    *(.system);
    *(.library);
    *(.text);
    *(.data);
    *(.bss);
    *(.rodata);
    *(.rodata.*);
    . = 0xeffc;
    BYTE(0x11);
    BYTE(0x33);
    BYTE(0x55);
    BYTE(0x77);
    _system_end = .;
}

. = ASSERT(_bootstrap_end <= 0x800,"Bootstrap section big!");
. = ASSERT(_sysinit_end <= 0x1000,"Sysinit section big!");
. = ASSERT(_pages_end <= 0x5000,"Pages section big!");
. = ASSERT(_system_end <= 0xf000,"System initialization section big!");
}

at last creating the final binary with dd.

I saw that when compiled with gcc 4.6 and 4.7 the linker adds some bytes (250-300) at the begin of the bootloader.bin.

I’m using the ld from binutils 2.22 and cook with my own recipes for the build process.

My actual questions are:

What are the differences between these versions of the gcc compiler and they produce bigger sections or instructing the linker through the elf object files to add these bytes at the begin of the bootloader.bin file?

Is there any command line argument for gcc 4.6 and/or 4.7 which will turn off a feature that may produce bigger sections than the gcc 4.5 or to remove the instructions those saying the linker to add these bytes at the begin of the bootloader.bin file?

edit 17-08-2012: I’m lil busy these days but soon i ‘ll update with the results of tests i did.

Answer to @strnk and @Dan Aloni: when i saw this problem the first i did is to exclude useless sections but the results are the same … i think because the bootloader.bin is a simple binary with the linked code of the needed sections at the right position as the linker instructed to do, without section names, relocation and debug informations and symbols … bootloader.bin file is not an elf object file.

Please consider the changes of the actual questions.
Thanks for everything … i ‘ll be back soon

edit 31-08-2012: Okay guys thanks for your help. The answer given by @Dan Aloni and accomplished with ldscript as @strnk shows

/DISCARD/ : {
    *(.eh_frame)
    *(.eh_frame_hdr)
}

after the asserts.

  • 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-06-09T19:21:26+00:00Added an answer on June 9, 2026 at 7:21 pm

    By compiling a trivial C file with the flags you provided, between gcc-4.5 and gcc-4.6, and using objdump -h to examine the output, it seems that the .eh_frame section is introduced in gcc-4.6.

    The ld script you provided does not take care of that section, and it probably should. You can use strip -R .eh_frame -R .eh_frame_hdr to remove that section and others from the object files prior to linking.

    Anyway, since the linker is the same for both gcc versions, objdump -h on the object files will hint at the difference that causes this problem.

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

Sidebar

Related Questions

I created a simple asm hello world x86 bootloader, I'd like to embed it
I installed Eclipse Helios and m2eclipse. Next I created a maven project. Now Eclipse
Created a button, now tried to add it to the screen and im getting
created a sqlce Db with VS2008 and save a copy in C:\ Temp08. can
occasionally several empty div tags are created under the comments block. They all have
I've been working through the tutorials on this webpage which progressively creates a bootloader
Created .NET WCF service, tested it - works. Generated schemas from Data and service
Created Private Key & Self signed certficate in a Key Store keytool -genkey -alias
Created an OpenGraph action and object. Trying to submit my action. When I click
I created a python server on port 8000 using python -m SimpleHTTPServer . When

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.