ELF Relocatable Object Problems
Posted: Sat Aug 01, 2009 12:03 pm
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:
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)
Code: Select all
/* test.c */
void init()
{
}
void exit()
{
}
$ 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)