Help about calculation of addend for ELF relocations for MIPS arch

Pan ruochen panruochen@gmail.com
Wed Aug 13 08:14:00 GMT 2008


> That seems fairly unusual, and I wouldn't be shocked if there is some
> bug when doing it.
>
> Looking at bfd/elfxx-mips.c, the GNU linker seems to assume that all
> sections in an object file have a zero VMA.  That may well be a bug.
>
> Ian
>

The GUN linker can still fix the relocation entries of `foo.out' correctly
with the following linker script.
$cat image.lds
OUTPUT_ARCH(mips)
ENTRY(Init)
SECTIONS
{
	.text 0x188e1000 :  { *(.text) 	}
	.data 0x18909000 : { *(.data) }
	_bss_start = ABSOLUTE(.);
 	.bss 0x18921000 : { *(.sbss) *(.bss) }
	_bss_end = ABSOLUTE(.);
}
$mips-elf-ld -T image.lds -EL -o foo.img foo.out

Maybe I should have a look at the source to find how it works.


PRC



More information about the Binutils mailing list