Procházet zdrojové kódy

Added support for exporting aliases which is necessary for modules with merged sections

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8331 8c9fc860-2736-0410-a75d-ab315db34111
negelef před 6 roky
rodič
revize
3002ed36ad
1 změnil soubory, kde provedl 7 přidání a 2 odebrání
  1. 7 2
      source/Linker.Mod

+ 7 - 2
source/Linker.Mod

@@ -120,7 +120,7 @@ TYPE
 	END InitArrangement;
 
 	PROCEDURE Allocate* (CONST section: ObjectFile.Section): GenericLinker.Address;
-	VAR address, alignment: ObjectFile.Bits; i: LONGINT; name: ObjectFile.SegmentedName;
+	VAR address, alignment: ObjectFile.Bits; i, j: LONGINT; name: ObjectFile.SegmentedName;
 	BEGIN
 		IF section.unit > maxUnitSize THEN maxUnitSize := section.unit END;
 		IF section.fixed THEN
@@ -140,9 +140,14 @@ TYPE
 		IF exportInfo # NIL THEN
 			FOR i := 0 TO exportInfo.exports-1 DO
 				ObjectFile.StringToSegmentedName(exportInfo.symbolNames[i], name);
-				IF name= section.identifier.name THEN
+				IF name = section.identifier.name THEN
 					exportInfo.exportAddresses[i] := address DIV section.unit + displacement;
 				END;
+				FOR j := 0 TO section.aliases - 1 DO
+					IF name = section.alias[j].identifier.name THEN
+						exportInfo.exportAddresses[i] := address DIV section.unit + section.alias[j].offset + displacement;
+					END;
+				END;
 			END
 		END;