[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In the uClibc source from the http://cvs.uclinux.org, make a symlink
so that the PIC version of crt0.S
is used.
The gcc wrapper must be modified so that crt0.o
is linked as the
first object file.
Index: extra/gcc-uClibc/gcc-uClibc.c =================================================================== RCS file: /var/cvs/uClibc/extra/gcc-uClibc/gcc-uClibc.c,v retrieving revision 1.20 diff -u -r1.20 gcc-uClibc.c --- extra/gcc-uClibc/gcc-uClibc.c 2001/05/31 23:07:50 1.20 +++ extra/gcc-uClibc/gcc-uClibc.c 2001/06/21 17:33:31 @@ -200,6 +200,13 @@ i = 0; gcc_argv[i++] = GCC_BIN; + + + // crt0 must be specified as the first object file + if (linking && source_count && use_start){ + gcc_argv[i++] = crt0_path[use_build_dir]; + } + for ( j = 1 ; j < argc ; j++ ) { if (strcmp("--uclibc-use-build-dir",argv[j]) == 0) { use_build_dir = 1; @@ -229,7 +236,7 @@ gcc_argv[i++] = usr_lib_path; } if (use_start) { - gcc_argv[i++] = crt0_path[use_build_dir]; + //xxxxxxxxxxxx gcc_argv[i++] = crt0_path[use_build_dir]; } if (use_stdlib) { gcc_argv[i++] = nostdlib; |
--- armelf_uclinux.xr.orig Wed Jun 20 19:32:23 2001 +++ armelf_uclinux.xr Thu Jun 21 12:18:11 2001 @ -68,7 +68,12 @ the same address within the page on the next page up. */ .data 0 : { + __data_start = . ; + + *(.rodata) *(.rodata.*) *(.gnu.linkonce.r*) + *(.rodata1) *(.data) + *(.data.*) } .data1 0 : { *(.data1) } .eh_frame : { *(.eh_frame) } |
This modification is necessary to move the .rodata
section into
the data segment. If this is not done, all relocation offsets
in the .data
section are wrong.
CROSS = arm-uclinux CPUFLAGS=-mdisable-got OPTIMIZATION=-O2 HAS_MMU = false |
export PATH=<your uclibc-directory>/bin:$PATH |
gcc -mdisable-got -c source.c |
gcc -mdisable-got -Wl,-r obj1.o obj2.o ..... -o out.elf |
To convert to flat format, ldelft2
from the elf2flt-0.8
package can be used.
Linking with ldelf2flt
from the Aplio tools will not work, because all
relocations are made from the data segment to the text segment.
The conversion can be done with
ldelf2flt -o out.flat out.elf |
It is very important to look for missing symbols here, because linking with -r
doesn't give any error messages during the link process.
The resuling flat file `out.flat' can be copied into the directory that is used
to create the rom filesystem image. The applications that are created this way
are suitable for XIP execution. Initialized variables will work as expected.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |