瀏覽代碼

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 年之前
父節點
當前提交
f622377202
共有 1 個文件被更改,包括 8 次插入3 次删除
  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 *)
 		(* 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;
 		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
 		BEGIN
 			sectionName := vop.symbol;
 			sectionName := vop.symbol;
+			name := sectionName.name;
 			Resolve(vop);
 			Resolve(vop);
 			section := vop.resolved; offset := vop.offset;
 			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).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 := "";
 				sectionName.name := "";
+				TRACE(name, offset);
 			END;
 			END;
 			RETURN offset
 			RETURN offset
 		END GetSymbolOffset;
 		END GetSymbolOffset;