This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

mips linker: absolute link with relocatable linked file


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]