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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:55:31+00:00 2026-06-09T20:55:31+00:00

I’m using GCC 4.7 to compile a large app that consists of only one

  • 0

I’m using GCC 4.7 to compile a large app that consists of only one C++ source file, so there’s only one compilation unit, but it includes many long headers. The final optimized executable, myapp, is 40MB, but the optimized object file, myapp.o, is 101MB. How is it possible that the object file is bigger than the binary?

I ran “nm -AC myapp” and “nm -AC myapp.o” to see if one had dramatically more symbols than the other — there’s about 1000 symbols difference but they’re mostly things you would expect like the binary adding the symbols for standard exception handling and static init.

I then ran ‘readelf -a’ on both and got this for myapp.o:

Number of section headers:         29186
Section header string table index: 29183

But this for myapp:

Number of section headers:         40
Section header string table index: 37

So I’m guessing that accounts for the size difference, but I don’t actually know what this means, or how to get the size down. Am I barking up the wrong tree? My goal is to get the compile time for myapp down, but first I need to understand what’s wrong. If symbols were the problem I could look into using GCC’s -fvisibility=hidden option, but I’d expect more differences in nm if that were the problem.

Edit: Additional info, everything not defined in my source file is from dynamically linked libs.

  • 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-09T20:55:33+00:00Added an answer on June 9, 2026 at 8:55 pm

    Object files contain lots of extra info to allow the seperate files to be linked together. In addition much code may be optimized out once all object files in the project are linked together. (example, uncalled library routines may be included in the object file, but are not needed once the compiler knows which routines wil actually be used in the final binary.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am reading a book about Javascript and jQuery and using one of the
I want use html5's new tag to play a wav file (currently only supported
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I know there's a lot of other questions out there that deal with this
I am using Paperclip to handle profile photo uploads in my app. They upload
I'm making a simple page using Google Maps API 3. My first. One marker
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.