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

  • Home
  • SEARCH
  • 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 8920367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:15:07+00:00 2026-06-15T06:15:07+00:00

I have linked some texts files with this command: ld -r -b binary -o

  • 0

I have linked some texts files with this command:

ld -r -b binary -o resources1.o *.txt

And I get a file resources.o with this content:

nm resources1.o

00000018 D _binary_texto4_txt_end
00000018 A _binary_texto4_txt_size
00000000 D _binary_texto4_txt_start
00000031 D _binary_texto5_txt_end
00000019 A _binary_texto5_txt_size
00000018 D _binary_texto5_txt_start
0000004a D _binary_texto6_txt_end
00000019 A _binary_texto6_txt_size
00000031 D _binary_texto6_txt_start

I have other resources2.o file comming from another ld command, but it has diferent content:

00000018 D _binary___textos1_texto1_txt_end
00000018 A _binary___textos1_texto1_txt_size
00000000 D _binary___textos1_texto1_txt_start
00000031 D _binary___textos1_texto2_txt_end
00000019 A _binary___textos1_texto2_txt_size
00000018 D _binary___textos1_texto2_txt_start
0000004a D _binary___textos1_texto3_txt_end
00000019 A _binary___textos1_texto3_txt_size
00000031 D _binary___textos1_texto3_txt_start

I would like to combine the two resources.o files in one libSum.a file. So I use this command:

ar rvs libSum.a resources1.o resources2.o

When I link libSum.a to my C program and try to use those texts, I can’t beacuse they share the same memory offsets. So binary__textos1_texto1_txt_start have the same direction that _binary_texto4_txt_start (0X00000000).

How could I combine both resource files in one .a lib avoiding memory offset overlapping?
Thanks

  • 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-15T06:15:09+00:00Added an answer on June 15, 2026 at 6:15 am

    There was a silly error with file contents. They was the same file with diferent names (a copy&paste error), so when showing its content it seemed to be a memory offset error.

    By now, I’m using the next script to compile all my resources in a “libResources.a” library:

    rm libResources.a
    rm names.txt
    
    basedir=$1
    for dir in "$basedir"/*; do
        if test -d "$dir"; then
        rm "$dir"/*.o
        ld -r -b binary -o "$dir"/resources.o "$dir"/*
        nm "$dir"/resources.o >> names.txt
        fi
    done
    
    for dir in "$basedir"/*; do
        if test -d "$dir"; then
        ar q libResources.a "$dir"/*.o
        fi
    done
    

    To test my hardcoded resources I use the following C code:

    /*
     ============================================================================
     Name        : linkerTest.c
     ============================================================================
     */
    
    #include <stdio.h>
    #include <stdlib.h>
    
    extern char _binary___textos1_texto1_txt_start[];
    extern char _binary___textos1_texto1_txt_end[];
    
    extern char _binary___textos2_texto4_txt_start[];
    extern char _binary___textos2_texto4_txt_end[];
    
    int main(void) {
        int i;
        int sizeTexto1 = _binary___textos1_texto1_txt_end - _binary___textos1_texto1_txt_start;
        int sizeTexto4 = _binary___textos2_texto4_txt_end - _binary___textos2_texto4_txt_start;
    
    
        for (i=0;i<sizeTexto1;i++){
            putchar(_binary___textos1_texto1_txt_start[i]);
        }
    
        for (i=0;i<sizeTexto4;i++){
            putchar(_binary___textos2_texto4_txt_start[i]);
        }
    
        return EXIT_SUCCESS;
    }
    

    If you want to test my example, don’t forget to link the file “libResources.a” in your project.

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

Sidebar

Related Questions

I have a DataSet with some DataTables that are linked together with DataRelations (classic
I have some stored proc.s that get data from DB. I made some data
I have a log file in which some test commands and their status (Pass/Fail)
I have linked a form from campaign monitor to a mobile site and I
Given a set of questions that have linked survey and category id: > db.questions.find().toArray();
I want to change a label that is on my design I have linked
http://www.koolfree.com/ImageUpload/uploads/1340729929.jpg (Table Image) Hello, I have linked to an Image (because stackoverflow was not
I have a linked Firebird database on my SQL Server 2008 via ODBC. I
I have a Linked List and I want to implement a function: Random_Shuffle_List (struct
I have a linked list, which stores groups of settings for my application: typedef

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.