This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
I don't know how to link the object files under uclinux
- From: "Yun-Gu Lee" <yglee at issserver dot kaist dot ac dot kr>
- To: <gcc at gcc dot gnu dot org>
- Date: Thu, 21 Mar 2002 12:55:30 +0900
- Subject: I don't know how to link the object files under uclinux
hi, all.
I have a question about linking the objects.
I installed the toolchain on http://www.uclinux.org//pub/uClinux/ports/arm7tdmi/ - egcs, binutils...
I made a simple test code 'Hello World', but it didn't work.
So, I traced on it and I found the problem.
My code is following:
------------------ test1.c ---------------------------------
#include "test.h"
int main()
{
void (*tests)();
tests = test_program;
tests();
}
------------------ test2.c ---------------------------------
#include "test.h"
void test_program()
{
printf("test\n");
}
--------------------- test.h ------------------------------------
#ifndef __TEST_H_
#define __TEST_H_
#include <stdio.h>
void test_program();
#endif
-------------------------------------------------------------
I compiled these code.
arm-uclinux-gcc -mdisable-got -mcpu=arm7tdmi -c test1.c -o test1.o
arm-uclinux-gcc -mdisable-got -mcpu=arm7tdmi -c test2.c -o test2.o
arm-uclinux-gcc -nostartfiles -Wl,-m -Wl,armelf_uclinux /usr/local/arm/arm-uclinux/lib/crt0.o test1.o test2.o -o test.elf -mcpu=arm7tdmi
arm-uclinux-objdump -d test.elf
................
00000098 <main>:
98: e1a0c00d mov r12, sp
9c: e92dd800 stmdb sp!, {r11, r12, lr, pc}
a0: e24cb004 sub r11, r12, #4 ; 0x4
a4: e24dd004 sub sp, sp, #4 ; 0x4
a8: e59f3014 ldr r3, [pc, #14] ; c4 <main+0x2c>
ac: e08f3003 add r3, pc, r3 <---------------- r3 is not address:c8 !!!!!
b0: e50b3010 str r3, [r11, -#16]
b4: e51b3010 ldr r3, [r11, -#16]
b8: e1a0e00f mov lr, pc
bc: e1a0f003 mov pc, r3
c0: e91ba800 ldmdb r11, {r11, sp, pc}
c4: 00000040 andeq r0, r0, r0, asr #32 <--------------- I think it's wrong value
000000c8 <good>:
c8: e1a0c00d mov r12, sp
.............
As you can know, 0x40 of address c4 is wrong.
I think it's a liking option problem. is it right?
How can I fix this problem?