Again, I have problem with linker, 'ld'. When I link my .asm file and .c file into flat binary everything is Ok. But when I try to call a function from third .c file linker doesn't insert correct 'call' instruction (it points to a very strange place in the flat binary). I use the following script file to link it together:
Code: Select all
SECTIONS
{
. = 0x10000;
.text : { pm.o(.flat) test.o(.text) test2.o(.text) }
}
OUTPUT_FORMAT(binary)
OUTPUT(test)
Code: Select all
void _start()
{
test2();
while(1);
}
void (*_start_ptr)() = _start;
Code: Select all
void test2()
{
}
I'am using Cygwin + recompiled binutils 2.16 (targeted to i586-elf, like in Wiki). Any ideas?..
TIA, Mikae.