Kaynağa Gözat

Patched fixup problem with TRM (introduced with previous patch)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6595 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 yıl önce
ebeveyn
işleme
f622377202
1 değiştirilmiş dosya ile 8 ekleme ve 3 silme
  1. 8 3
      source/FoxTRMBackend.Mod

+ 8 - 3
source/FoxTRMBackend.Mod

@@ -1087,15 +1087,20 @@ TYPE
 
 		(* if the symbol has a statically known offset then return offset and set resulting section to nil, otherwise do not set resulting section to nil *)
 		PROCEDURE GetSymbolOffset(VAR vop: IntermediateCode.Operand; VAR sectionName: ObjectFile.Identifier): LONGINT;
-		VAR offset: LONGINT; section: Sections.Section;
+		VAR offset: LONGINT; section: Sections.Section; name: ARRAY 256 OF CHAR;
 		BEGIN
 			sectionName := vop.symbol;
+			name := sectionName.name;
 			Resolve(vop);
 			section := vop.resolved; offset := vop.offset;
-			IF (vop.symbolOffset > 0) & (section # NIL) & (section(IntermediateCode.Section).resolved # NIL) & (section(IntermediateCode.Section).resolved.os.fixed) THEN
+			TRACE(name, offset);
+			IF (section # NIL) & (section(IntermediateCode.Section).resolved # NIL) & (section(IntermediateCode.Section).resolved.os.fixed) THEN
 				INC(offset, section(IntermediateCode.Section).resolved.os.alignment);
-				INC(offset, section(IntermediateCode.Section).instructions[vop.symbolOffset].pc);
+				IF vop.symbolOffset > 0 THEN 
+					INC(offset, section(IntermediateCode.Section).instructions[vop.symbolOffset].pc);
+				END;
 				sectionName.name := "";
+				TRACE(name, offset);
 			END;
 			RETURN offset
 		END GetSymbolOffset;