Hi!
I have a problem with linking fasm and C code (GCC + LD).
This is a test source code with some calls to the same target:
call KERNEL_CODE_SEL:_interrupt_handler
call KERNEL_CODE_SEL:_interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call _interrupt_handler
call dword [_interrupt_handler]
call dword [_interrupt_handler]
call dword [_interrupt_handler]
call dword [_interrupt_handler]
call [_interrupt_handler]
call [_interrupt_handler]
call [_interrupt_handler]
call [_interrupt_handler]
call [_interrupt_handler]
mov eax,_interrupt_handler
mov eax,[_interrupt_handler]
For the
format ms coff parameter all addresses are equal, which makes quite sense
00201721: 9A5A0020000800 call 00008:00020005A
00201728: 9A5A0020000800 call 00008:00020005A
0020172F: E826E9FFFF call 00020005A ---X
00201734: E821E9FFFF call 00020005A ---X
00201739: E81CE9FFFF call 00020005A ---X
0020173E: E817E9FFFF call 00020005A ---X
00201743: E812E9FFFF call 00020005A ---X
00201748: E80DE9FFFF call 00020005A ---X
0020174D: E808E9FFFF call 00020005A ---X
00201752: E803E9FFFF call 00020005A ---X
00201757: FF155A002000 call d,[0020005A]
0020175D: FF155A002000 call d,[0020005A]
00201763: FF155A002000 call d,[0020005A]
00201769: FF155A002000 call d,[0020005A]
0020176F: FF155A002000 call d,[0020005A]
00201775: FF155A002000 call d,[0020005A]
0020177B: FF155A002000 call d,[0020005A]
00201781: FF155A002000 call d,[0020005A]
00201787: FF155A002000 call d,[0020005A]
0020178D: B85A002000 mov eax,00020005A
00201792: A15A002000 mov eax,[0020005A]
But for the same source compiled with
format coff parameter, the output code goes like this:
00201721: 9A5A0020000800 call 00008:00020005A
00201728: 9A5A0020000800 call 00008:00020005A
0020172F: E80EE9FFFF call 000200042 ---X
00201734: E804E9FFFF call 00020003D ---X
00201739: E8FAE8FFFF call 000200038 ---X
0020173E: E8F0E8FFFF call 000200033 ---X
00201743: E8E6E8FFFF call 00020002E ---X
00201748: E8DCE8FFFF call 000200029 ---X
0020174D: E8D2E8FFFF call 000200024 ---X
00201752: E8C8E8FFFF call 00020001F ---X
00201757: FF155A002000 call d,[0020005A]
0020175D: FF155A002000 call d,[0020005A]
00201763: FF155A002000 call d,[0020005A]
00201769: FF155A002000 call d,[0020005A]
0020176F: FF155A002000 call d,[0020005A]
00201775: FF155A002000 call d,[0020005A]
0020177B: FF155A002000 call d,[0020005A]
00201781: FF155A002000 call d,[0020005A]
00201787: FF155A002000 call d,[0020005A]
0020178D: B85A002000 mov eax,00020005A
00201792: A15A002000 mov eax,[0020005A]
You see, that the the
call _interrupt_handler acts in some strange way above, and every time it gives different call address
So my question is: is it a bug or am I missing something?
And of course, LD's map file shows 0x0020005a as the address for _interrupt_handler procedure.
Best regards,
TJ