ELF Relocatable Object Problems

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
User avatar
arabasso
Member
Member
Posts: 27
Joined: Thu Jul 10, 2008 9:41 am

ELF Relocatable Object Problems

Post by arabasso »

Hi, i'm having trouble creating relocatable objects with gcc and ld. Simply does not generate the sessions. .rel* and .rela*. I did the following:

Code: Select all

/* test.c */

void init()
{
}

void exit()
{
}
And use the following commands:

$ gcc -c test.c -o test.o
$ ld -r test.o -o test.elf

Finally, note the sessions:

$ objdump -h test.elf

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00001000 00100000 00100000 00000034 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .data 00000000 00101000 00101000 00001034 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000000 00101000 00101000 00001034 2**2
ALLOC
3 .comment 00000025 00000000 00000000 00001034 2**0
CONTENTS, READONLY
4 .note.GNU-stack 00000000 00000000 00000000 00001059 2**0
CONTENTS, READONLY

What can be? Problems? Or missing something?

I'm using Ubuntu 8.10 intrepid (Binutils-2.18 and GCC-4.3)
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: ELF Relocatable Object Problems

Post by Combuster »

Is there actually anything in there to relocate? :wink:
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
arabasso
Member
Member
Posts: 27
Joined: Thu Jul 10, 2008 9:41 am

Re: ELF Relocatable Object Problems [SOLVED]

Post by arabasso »

Indeed, nothing. I'm sorry, gcc + ld only create the sessions of any need.
Post Reply