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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:16:43+00:00 2026-05-25T16:16:43+00:00

I have compiled a variety of .c source codes into their respective .o object

  • 0

I have compiled a variety of .c source codes into their respective .o object files and archived it as a .a archive file. Say in the main() function I use the function foo(). After compiling and linking, does the executable 1) only include the .text of the foo() function as well as all other functions recursively called by foo(), or 2) does it include the entire .o where the foo() resides in, or 3) the .text in the entire .a file?

It is desirable to go for option 1) as it will only include the bare minimum amount of instructions in a space constrained environment. How do I go about accomplishing this?

  • 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-25T16:16:44+00:00Added an answer on May 25, 2026 at 4:16 pm

    Normally, the loader will include all the material in all the object files (.o files on Unix/Linux) listed on the link line. If it processes any static libraries (.a files on Unix/Linux), then the object files that are needed from the library are included in toto (but any object files which do not define a symbol needed by the program are left out of the executable). If it processes any shared libraries (usually .so files on Unix/Linux), then it doesn’t load any of the material into the binary, but it does keep a record of all the symbols provided by the shared library, so that it does not try to satisfy any of those symbols from later files or libraries.

    The loader processes the argument list in left-to-right order. This means that you should list static libraries after object files. It isn’t quite so critical to list shared libraries after object files, though it is still best to do so anyway, just in case the program is ever linked with static libraries instead of shared libraries.

    If you end up with doubly defined symbols from the explicitly listed object files or object files extracted from static libraries, then the loader will fail. If you end up with doubly defined symbols in some of the shared libraries, the duplicates in the shared libraries are effectively ignored.

    I think that’s a reasonable summary written at high speed and not getting too lost in the details. There’s a lot of if’s and but’s that could be added to the discussion; whole books have been written on the subject of how executables are created from object files and libraries.

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

Sidebar

Related Questions

I am in a big problem ..i have compiled my c files using linux
I have a compiled swf file and a I can't edit it , but
I have a compiled .NET assembly with a specific resource file embedded (named 'Script.xml').
I have compiled FreeImage from source and installed it. When I run sudo make
Possible Duplicate: Way to have compiled python files in a separate folder? When python
I have compiled a matlab script into a standalone win app and also a
I have compiled a JNI dll that I would like to load into my
I have compiled the Linux kernel source for android. After building the source i
Ok let's say I have an ObservableCollection<string> object. Within this object I have a
I have compiled a .NET application using Any CPU option. This .NET application uses

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.