linker script for building hello_world.c on arm
PATCH 1/1 linker script for building hello_world.c on arm
Hello
I was unable to build the hello_world.c example for my arm target without adding a linker script. The attached patch fixes this.
Please apply.
CHANGELOG
* Patch by Lars Munch, 02 Sep 2004:
- Added linker script for building hello_world.c on arm
Best regards
Lars Munch
-------------- next part --------------
examples/arm.lds +48 -0
@@ -0,0 +1,48 @@ +/* + * (C) Copyright 2002 + * Gary Jennejohn, DENX Software Engineering, <[email protected]> + * + * Modified for u-boot examples by Lars Munch, <[email protected]> + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) +SECTIONS +{ + .text : + { + *(.text) + } + + . = ALIGN(4); + .rodata : { *(.rodata) } + + . = ALIGN(4); + .data : { *(.data) } + + . = ALIGN(4); + .got : { *(.got) } + + . = ALIGN(4); + __bss_start = .; + .bss : { *(.bss) } + _end = .; +}
examples/Makefile +1 -1
@@ -30,7 +30,7 @@ endif ifeq ($(ARCH),arm) -LOAD_ADDR = 0xc100000 +LOAD_ADDR = 0xc100000 -T arm.lds endif ifeq ($(ARCH),mips)
PATCH 1/1 linker script for building hello_world.c on arm
Quoted 3 lines · In message <[email protected]> you wrote:
I was unable to build the
hello_world.cexample for my arm target without adding a linker script. The attached patch fixes this.
Why do you need such a script, when all the existing ARM (and MIPS, and PowerPC, and ...) systems don't need one?
Quoted 1 line
Please apply.
Sorry, but I won't. At least not before I understand the reason why it should be necessary.
Best regards,
Wolfgang Denk
Signature · 5 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de Administration: An ingenious abstraction in politics, designed to receive the kicks and cuffs due to the premier or president. - Ambrose Bierce
PATCH 1/1 linker script for building hello_world.c on arm
Quoted 7 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:
I was unable to build the
hello_world.cexample for my arm target without adding a linker script. The attached patch fixes this.Why do you need such a script, when all the existing ARM (and MIPS, and PowerPC, and ...) systems don't need one?
The mips and nios systems uses a linker script for building hello_world, so I thought this was a common problem.
This is the linker error I get when building examples using 91rm9200dk_config:
arm-linux-gcc -g -Os -fno-strict-aliasing -fno-common -ffixed-r8
-D__KERNEL__ -DTEXT_BASE=0x21f80000 -I/home/lmc/u-boot-orig/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/arm-linux/lib/gcc/arm-linux/3.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -mtune=arm7tdmi -Wall
-Wstrict-prototypes -g -Os -fno-strict-aliasing -fno-common
-ffixed-r8 -D__KERNEL__ -DTEXT_BASE=0x21f80000 -I/home/lmc/u-boot-orig/include -fno-builtin -ffreestanding -nostdinc -isystem /opt/arm-linux/lib/gcc/arm-linux/3.4.1/include -pipe -DCONFIG_ARM -D__ARM__ -mapcs-32 -march=armv4 -mtune=arm7tdmi -I.. -Bstatic -T /home/lmc/u-boot-orig/board/at91rm9200dk/u-boot.lds -Ttext0x21f80000 hello_world.c -o hello_world/opt/arm-linux/lib/gcc/arm-linux/3.4.1/../../../../arm-linux/bin/ld:
crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
make[1]: *** [hello_world] Error 1
make[1]: Leaving directory `/home/lmc/u-boot-orig/examples'
make: *** [examples] Error 2
I am using binutils-2.15 and gcc-3.4.1. I have builded gcc with:
../gcc-3.4.1/configure --target=arm-linux --with-gnu-as \
--with-gnu-ld --enable-languages="c" --verbose \
--disable-threads --without-headers --disable-shared --disable-nls
Am I missing something?
Best regards
Lars Munch
PATCH 1/1 linker script for building hello_world.c on arm
Quoted 2 lines · In message <[email protected]> you wrote:
This is the linker error I get when building examples using 91rm9200dk_config:
...
Quoted 2 lines
crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
This is a bug in your toolchain.
Quoted 1 line
I am using binutils-2.15 and gcc-3.4.1. I have builded gcc with:
Argh... Please refer to the archives of the linux-arm-toolchain mailing list.
Best regards,
Wolfgang Denk
Signature · 4 lines
Software Engineering: Embedded and Realtime Systems, Embedded Linux Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: wd at denx.de The more we disagree, the more chance there is that at least one of us is right.
PATCH 1/1 linker script for building hello_world.c on arm
Quoted 7 lines · Wolfgang Denk
Quoted 2 lines · In message <[email protected]> you wrote:
This is the linker error I get when building examples using 91rm9200dk_config:
...
Quoted 2 lines
crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status
Quoted 7 lines
This is a bug in your toolchain.
Quoted 1 line
I am using binutils-2.15 and gcc-3.4.1. I have builded gcc with:
Argh... Please refer to the archives of the linux-arm-toolchain mailing list.
Thanks, I'll look into that.
Best regards
Lars Munch