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

The Archive Base Latest Questions

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

I have 2 obj files assembled with GNU as , they are: a.o :

  • 0

I have 2 obj files assembled with GNU as, they are:

  • a.o : my major program
  • b.o : some utility functions

a.o doesn’t have an entry point. The final linked file will be loaded into memory and the execution will jump to its very beginning loaded address, where is the first instrucion of a.o.

Now I want to link them together with GNU ld. And I want to make a.o appear before b.o in the final file. How could I control this? Do I have to make a custom section and write in the linker script like this:

SECTIONS
{
  . = 0x7c00;
  .text : { *(.text) }
  .my_custom_section : { *(.my_custom_section) }
  .data : { *(.data) }
  .bss  : { *(.bss) }
}

OUTPUT_FORMAT(binary)

Update

Is there something wrong with this question? Did I post it wrong? If so, please let me know, guys. Many thanks.

Currently, I found that the command line sequence of the input files seems to be relevant.

If I do like this:

ld a.o b.o -o final.bin

Content from a.o will appear before b.o.

If I do like this:

ld b.o a.o -o final.bin

It will be otherwise.

Is it meant to be controlled like this?

  • 1 1 Answer
  • 1 View
  • 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-16T16:02:41+00:00Added an answer on May 16, 2026 at 4:02 pm

    According to the manual:

    options which refer to files … cause the file to be read at the point at which the option appears in the command line, relative to the object files and other file options

    So the order of files in the binary is the order in which they appear on the command line.

    Therefore, it is meant to be controlled as you mention in your update.

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

Sidebar

Related Questions

I have a couple functions like this: object obj.getChild(childIndex) int obj.numChildren() So I am
I have .obj files each with several texture files. Does three.js comes out of
I have data from *.obj file. I know how draw with GL_TRIANGLES . How
I have an enum in a file: goog.provide('animals.Fish'); animals.Fish = function(obj) { this.name_ =
I have an Application Object. In Global.asax file i use this: Application[obj] = test;
I have several obj-c classes, each of which require a number of constants that
I have an variable obj defined as follows: {user: {username: AzureDiamond, password: hunter2}} I
I have an object obj that is passed into a helper method. public static
suppose I have a object: obj:{ child:{ x:12, y:50 }, key1:value1, key2:value2 } if
I have this code: var obj = function (i) { this.a = i; this.init

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.