Browse Source

* in the i8086 load node, when generating static/global var access to variables
in the default data segment, set their treference.segment to NR_DS, in order
to avoid creating redundant segment relocations to the default data segment
(which is a problem with win16 multiple instance applications). Redundant
segment overrides are stripped later anyway, so it doesn't hurt the generated
code.

git-svn-id: trunk@37715 -

nickysn 7 years ago
parent
commit
8d18dafe34
1 changed files with 5 additions and 6 deletions
  1. 5 6
      compiler/i8086/n8086ld.pas

+ 5 - 6
compiler/i8086/n8086ld.pas

@@ -207,14 +207,13 @@ implementation
               { Normal (or external) variable }
               { Normal (or external) variable }
               else
               else
                 begin
                 begin
-                  if (current_settings.x86memorymodel<>mm_huge) and not (vo_is_far in gvs.varoptions) then
-                    begin
-                      inherited pass_generate_code;
-                      exit;
-                    end;
-                  if not (vo_is_external in gvs.varoptions) and gvs.Owner.iscurrentunit then
+                  if ((current_settings.x86memorymodel<>mm_huge) and not (vo_is_far in gvs.varoptions)) or
+                     (not (vo_is_external in gvs.varoptions) and gvs.Owner.iscurrentunit) then
                     begin
                     begin
                       inherited pass_generate_code;
                       inherited pass_generate_code;
+                      if (location.loc<>LOC_REFERENCE) and (location.loc<>LOC_CREFERENCE) then
+                        internalerror(2017121101);
+                      location.reference.segment:=NR_DS;
                       exit;
                       exit;
                     end;
                     end;