This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
mips linker: absolute link with relocatable linked file
- From: tanaka <tanaka at personal-media dot co dot jp>
- To: binutils at sources dot redhat dot com
- Date: Tue, 19 Nov 2002 19:17:25 +0900
- Subject: mips linker: absolute link with relocatable linked file
- Organization: personal media corp.
Hello,
I tried to link a program absolute format with a file,
which is linked relocatable format previously.
But linker tells me like below.
>test(.text+0x18): relocation truncated to fit: R_MIPS_GPREL16 no symbol
Why error occurred.
Before relocatable link, the object file has .sdata section.
Thanks.
tanaka@personal-media.co.jp
-----test.c------
int main_int_data1 = 1;
int main_int_data2 = 2;
static int main_staticint_data1 = 1;
static int main_staticint_data2 = 2;
void _start()
{
main_int_data1 = 10;
main_int_data2 = 11;
main_staticint_data1 = 12;
main_staticint_data2 = 13;
}
------ test.lnk -------
OUTPUT_FORMAT("elf32-littlemips", "elf32-bigmips",
"elf32-littlemips")
OUTPUT_ARCH(mips)
ENTRY(_start)
SECTIONS
{
. = 0x00100000;
.text : {
*(.text)
} =0
. = ALIGN(0x1000);
.data ALIGN(0x10) : {
*(.data)
_gp = ALIGN(16) + 0x7ff0;
*(.sdata)
}
.bss : {
*(.sbss)
*(.bss)
}
}
------- command line ----------
gcc -O2 -c test.c -o test.o
gcc -nostdlib -r -T test.lnk test.o -o test
gcc -nostdlib -static -T test.lnk -Wl,-Ttext,0x00100000 test -o test.abs
------- configure -------
../gcc-3.2/configure --target=mipsel-unknown-elf --with-gnu-as
--with-gnu-ld --enable-languages=c
GNU assembler version 2.13 (mipsel-unknown-elf) using BFD version 2.13
GNU ld version 2.13