This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: Linking arm thumb code
Phil Blundell wrote:
> I just did a quick experiment here and ".thumb_set" does seem to be working
> OK. Can you show me the complete set of steps you use to generate your binary?
uclibc part:
===
[avbidder@atlas internals]$ touch __uClibc_main.c
[avbidder@atlas internals]$ make
arm-uclinux-gcc -Wall -O3 -fno-builtin -nostdinc -membedded-pic
-mcpu=arm7tdmi -fno-exceptions -symbolic -shared -nostartfiles -mthumb
-I../../../include
-I/home/avbidder/gcc-3/lib/gcc-lib/arm-uclinux/3.0.2/include -I.
-D_LIBC -DNDEBUG -c __uClibc_main.c -o __uClibc_main.o
arm-uclinux-strip -x -R .note -R .comment __uClibc_main.o
arm-uclinux-ar r ../../../libc/libc.a ultostr.o ltostr.o __uClibc_main.o
tempname.o ulltostr.o lltostr.o
===
then, my trivial hello world:
===
[avbidder@atlas hello]$ touch hello.c
[avbidder@atlas hello]$ make
arm-uclinux-gcc -membedded-pic -O2 -mcpu=arm7tdmi -fno-exceptions
-fno-rtti -symbolic -shared -nostartfiles -I../uclibc/include -I.
-DUCLINUX -mthumb -c hello.c
arm-uclinux-gcc -membedded-pic -O2 -mcpu=arm7tdmi -fno-exceptions
-fno-rtti -mthumb -symbolic -shared -nostartfiles -L../uclibc/lib
../uclibc/lib/crt0.o -Wl,-m -Wl,armelf_uclinux -o hello.elf hello.o -lc
-lnet -lcrypt -lutil
/home/avbidder/gcc-3/lib/gcc-lib/arm-uclinux/3.0.2/../../../../arm-uclinux/bin/ld:
Warning: type of symbol `__uClibc_main' changed from 2 to 13 in
__uClibc_main.o
elf2flt -o hello.flat hello.elf
SECTION: .hash at: 00000094 size: 0x00000174(372) till: 00000208
SECTION: .dynsym at: 00000208 size: 0x00000360(864) till: 00000568
SECTION: .dynstr at: 00000568 size: 0x000001e1(481) till: 00000749
SECTION: .rel.text at: 0000074c size: 0x00000048(72) till: 00000794
SECTION: .rel.rodata at: 00000794 size: 0x00000018(24) till: 000007ac
SECTION: .rel.data at: 000007ac size: 0x00000010(16) till: 000007bc
SECTION: .text at: 000007bc size: 0x00000130(304) till: 000008ec
SECTION: .data at: 000018ec size: 0x00000034(52) till: 00001920
SECTION: .got at: 00001920 size: 0x0000000c(12) till: 0000192c
SECTION: .dynamic at: 0000192c size: 0x00000058(88) till: 00001984
SECTION: .sbss at: 00001984 size: 0x00000000(0) till: 00001984
SECTION: .bss at: 00001984 size: 0x00000000(0) till: 00001984
SECTION: .comment at: 00000000 size: 0x00000012(18) till: 00000012
WARNING: Illegal RELATIVE reloc(s) in text segment -- ignored.
cp hello.flat hello
chmod 755 hello
===
The warning from elf2flt is, because we're compiling with -shared
-symbolic. elf2flt seems to do the right thing and creates the
relocation entries the flat loader needs.
The armelf_uclinux linker target is a small change from the usual
armelf_linux target - it loads all .rodata input sections at the start
of the .data section of the output.
If you need more data, just yell.
greets from Zürich
-- vbi