[Solved] realmode asm with C (gcc -m16 used)
Posted: Wed May 11, 2022 3:18 pm
I'd like to call a function defined in object compiled by gcc (-m16) from object compiled by gas, all in realmode. I'm using these CFLAGS to compile object for realmode, compiled as where contents of load.c is one dummy function: puts16() comes from my libsa16 library.
Problem is that while code generated by gcc is using 0x66 prefix any push/ret/call push 4B instead of 2. Segments are all 0.
I don't necessarily need to use C but I'm curious to see what am I missing.
Edit: thanks.
Code: Select all
load.o: load.c
$(CC) $(REALMODE_CFLAGS) load.c -c -o $(OBJDIR)/load.o
Code: Select all
void test_load() {
puts16("hi\r\n");
}
Problem is that while code generated by gcc is using 0x66 prefix any push/ret/call push 4B instead of 2. Segments are all 0.
Code: Select all
$ objdump -d obj/load.o -mi8086
obj/load.o: file format elf32-i386
00000000 <test_load>:
0: 66 68 00 00 00 00 pushd 0x0
6: 66 e8 fc ff ff ff calld 8 <test_load+0x8>
c: 66 58 pop eax
e: 66 c3 retd
Edit: thanks.