mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 11:20:23 +02:00
* 8086: Fixed Ofs() for far routines.
resultdef of typeconvnode.typecheck_proc_to_procvar() is reused every time you get an address of a proc. So it is forbidden to change the far/near attribute of resultdef - it leads to mess during code generation. Instead it is needed to use separate reusable resultdefs with new flags pc_far_address and pc_offset. git-svn-id: trunk@46470 -
This commit is contained in:
parent
6878ffbf04
commit
222f981dd1
@ -70,14 +70,22 @@ implementation
|
||||
begin
|
||||
if resultdef.typ<>procvardef then
|
||||
internalerror(2018040401);
|
||||
exclude(tprocvardef(resultdef).procoptions,po_far);
|
||||
if po_far in tprocvardef(resultdef).procoptions then
|
||||
begin
|
||||
resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_offset);
|
||||
exclude(tprocvardef(resultdef).procoptions,po_far);
|
||||
end;
|
||||
end
|
||||
else if (tcnf_proc_2_procvar_2_voidpointer in convnodeflags) and
|
||||
(current_settings.x86memorymodel in x86_far_code_models) then
|
||||
begin
|
||||
if resultdef.typ<>procvardef then
|
||||
internalerror(2018040402);
|
||||
include(tprocvardef(resultdef).procoptions,po_far);
|
||||
if not (po_far in tprocvardef(resultdef).procoptions) then
|
||||
begin
|
||||
resultdef:=cprocvardef.getreusableprocaddr(tabstractprocdef(left.resultdef),pc_far_address);
|
||||
include(tprocvardef(resultdef).procoptions,po_far);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -643,6 +643,12 @@ interface
|
||||
pno_mangledname, pno_noparams);
|
||||
tprocnameoptions = set of tprocnameoption;
|
||||
tproccopytyp = (pc_normal,
|
||||
{$ifdef i8086}
|
||||
{ the address in a far format }
|
||||
pc_far_address,
|
||||
{ the offset part of the far address }
|
||||
pc_offset,
|
||||
{$endif i8086}
|
||||
{ creates a procvardef describing only the code pointer
|
||||
of a method/netsted function/... }
|
||||
pc_address_only,
|
||||
|
Loading…
Reference in New Issue
Block a user