Browse Source

+ added the global symbols to the .rel output file

git-svn-id: trunk@45246 -
nickysn 5 years ago
parent
commit
23fa725b01
1 changed files with 12 additions and 2 deletions
  1. 12 2
      compiler/ogrel.pas

+ 12 - 2
compiler/ogrel.pas

@@ -174,7 +174,7 @@ implementation
     function TRelObjOutput.writeData(Data: TObjData): boolean;
     function TRelObjOutput.writeData(Data: TObjData): boolean;
       var
       var
         global_symbols_count: Integer = 0;
         global_symbols_count: Integer = 0;
-        secidx, idx, i: Integer;
+        secidx, idx, i, j: Integer;
         objsym: TObjSymbol;
         objsym: TObjSymbol;
         objsec: TObjSection;
         objsec: TObjSection;
       begin
       begin
@@ -182,7 +182,7 @@ implementation
         for i:=0 to Data.ObjSymbolList.Count-1 do
         for i:=0 to Data.ObjSymbolList.Count-1 do
           begin
           begin
             objsym:=TObjSymbol(Data.ObjSymbolList[i]);
             objsym:=TObjSymbol(Data.ObjSymbolList[i]);
-            if objsym.bind=AB_EXTERNAL then
+            if objsym.bind in [AB_EXTERNAL,AB_GLOBAL] then
               Inc(global_symbols_count);
               Inc(global_symbols_count);
           end;
           end;
 
 
@@ -207,6 +207,16 @@ implementation
             writeLine('A '+objsec.Name+' size '+tohex(objsec.Size)+' flags 0 addr 0');
             writeLine('A '+objsec.Name+' size '+tohex(objsec.Size)+' flags 0 addr 0');
             objsec.SecSymIdx:=secidx;
             objsec.SecSymIdx:=secidx;
             Inc(secidx);
             Inc(secidx);
+            for j:=0 to Data.ObjSymbolList.Count-1 do
+              begin
+                objsym:=TObjSymbol(Data.ObjSymbolList[j]);
+                if (objsym.bind=AB_GLOBAL) and (objsym.objsection=objsec) then
+                  begin
+                    writeLine('S '+ApplyAsmSymbolRestrictions(objsym.Name)+' Def'+HexStr(objsym.offset,4));
+                    objsym.symidx:=idx;
+                    Inc(idx);
+                  end;
+              end;
           end;
           end;
         result:=true;
         result:=true;
       end;
       end;