Browse Source

* fixed compilation with -Oodfa/-O3

git-svn-id: trunk@31679 -
Jonas Maebe 10 years ago
parent
commit
5f7b242222
1 changed files with 18 additions and 15 deletions
  1. 18 15
      compiler/ogomf.pas

+ 18 - 15
compiler/ogomf.pas

@@ -1533,6 +1533,7 @@ implementation
         if Fixup.TargetMethod in [ftmExternalIndex,ftmExternalIndexNoDisp] then
         if Fixup.TargetMethod in [ftmExternalIndex,ftmExternalIndexNoDisp] then
           begin
           begin
             sym:=objdata.symbolref(TOmfExternalNameElement(ExtDefs[Fixup.TargetDatum-1]).Name);
             sym:=objdata.symbolref(TOmfExternalNameElement(ExtDefs[Fixup.TargetDatum-1]).Name);
+            RelocType:=RELOC_NONE;
             case Fixup.LocationType of
             case Fixup.LocationType of
               fltOffset:
               fltOffset:
                 case Fixup.Mode of
                 case Fixup.Mode of
@@ -1548,12 +1549,12 @@ implementation
                   fmSelfRelative:
                   fmSelfRelative:
                     RelocType:=RELOC_SEGREL;
                     RelocType:=RELOC_SEGREL;
                 end;
                 end;
-              else
-                begin
-                  InputError('Unsupported fixup location type '+IntToStr(Ord(Fixup.LocationType))+' in external reference to '+sym.Name);
-                  exit;
-                end;
             end;
             end;
+            if RelocType=RELOC_NONE then
+              begin
+                InputError('Unsupported fixup location type '+tostr(Ord(Fixup.LocationType))+' with mode '+tostr(ord(Fixup.Mode))+' in external reference to '+sym.Name);
+                exit;
+              end;
             reloc:=TOmfRelocation.CreateSymbol(Fixup.LocationOffset,sym,RelocType);
             reloc:=TOmfRelocation.CreateSymbol(Fixup.LocationOffset,sym,RelocType);
             objsec.ObjRelocations.Add(reloc);
             objsec.ObjRelocations.Add(reloc);
             case Fixup.FrameMethod of
             case Fixup.FrameMethod of
@@ -1576,6 +1577,7 @@ implementation
         else if Fixup.TargetMethod in [ftmSegmentIndex,ftmSegmentIndexNoDisp] then
         else if Fixup.TargetMethod in [ftmSegmentIndex,ftmSegmentIndexNoDisp] then
           begin
           begin
             target_section:=TOmfObjSection(objdata.ObjSectionList[Fixup.TargetDatum-1]);
             target_section:=TOmfObjSection(objdata.ObjSectionList[Fixup.TargetDatum-1]);
+            RelocType:=RELOC_NONE;
             case Fixup.LocationType of
             case Fixup.LocationType of
               fltOffset:
               fltOffset:
                 case Fixup.Mode of
                 case Fixup.Mode of
@@ -1591,12 +1593,12 @@ implementation
                   fmSelfRelative:
                   fmSelfRelative:
                     RelocType:=RELOC_SEGREL;
                     RelocType:=RELOC_SEGREL;
                 end;
                 end;
-              else
-                begin
-                  InputError('Unsupported fixup location type '+IntToStr(Ord(Fixup.LocationType))+' in reference to segment '+target_section.Name);
-                  exit;
-                end;
             end;
             end;
+            if RelocType=RELOC_NONE then
+              begin
+                InputError('Unsupported fixup location type '+tostr(Ord(Fixup.LocationType))+' with location type '+tostr(ord(Fixup.LocationType))+' in reference to segment '+target_section.Name);
+                exit;
+              end;
             reloc:=TOmfRelocation.CreateSection(Fixup.LocationOffset,target_section,RelocType);
             reloc:=TOmfRelocation.CreateSection(Fixup.LocationOffset,target_section,RelocType);
             objsec.ObjRelocations.Add(reloc);
             objsec.ObjRelocations.Add(reloc);
             case Fixup.FrameMethod of
             case Fixup.FrameMethod of
@@ -1624,6 +1626,7 @@ implementation
                 InputError('Fixup target group other than "DGROUP" is not supported');
                 InputError('Fixup target group other than "DGROUP" is not supported');
                 exit;
                 exit;
               end;
               end;
+            RelocType:=RELOC_NONE;
             case Fixup.LocationType of
             case Fixup.LocationType of
               fltBase:
               fltBase:
                 case Fixup.Mode of
                 case Fixup.Mode of
@@ -1632,12 +1635,12 @@ implementation
                   fmSelfRelative:
                   fmSelfRelative:
                     RelocType:=RELOC_DGROUPREL;
                     RelocType:=RELOC_DGROUPREL;
                 end;
                 end;
-              else
-                begin
-                  InputError('Unsupported fixup location type '+IntToStr(Ord(Fixup.LocationType))+' in reference to group '+target_group.Name);
-                  exit;
-                end;
             end;
             end;
+            if RelocType=RELOC_NONE then
+              begin
+                InputError('Unsupported fixup location type '+IntToStr(Ord(Fixup.LocationType))+'with mode '+tostr(Ord(Fixup.Mode))+' in reference to group '+target_group.Name);
+                exit;
+              end;
             reloc:=TOmfRelocation.CreateSection(Fixup.LocationOffset,nil,RelocType);
             reloc:=TOmfRelocation.CreateSection(Fixup.LocationOffset,nil,RelocType);
             objsec.ObjRelocations.Add(reloc);
             objsec.ObjRelocations.Add(reloc);
             case Fixup.FrameMethod of
             case Fixup.FrameMethod of