Browse Source

+ smartlinking for ag386bin

peter 26 years ago
parent
commit
d0b1246e38
1 changed files with 23 additions and 10 deletions
  1. 23 10
      compiler/aasm.pas

+ 23 - 10
compiler/aasm.pas

@@ -79,7 +79,7 @@ unit aasm;
 
 
   { asm symbol functions }
   { asm symbol functions }
     type
     type
-       TAsmsymtype=(AS_NONE,AS_LOCAL,AS_GLOBAL,AS_EXTERNAL);
+       TAsmsymtype=(AS_EXTERNAL,AS_LOCAL,AS_GLOBAL);
 
 
        pasmsymbol = ^tasmsymbol;
        pasmsymbol = ^tasmsymbol;
        tasmsymbol = object(tnamed_object)
        tasmsymbol = object(tnamed_object)
@@ -89,6 +89,8 @@ unit aasm;
          size    : longint;
          size    : longint;
          typ     : TAsmsymtype;
          typ     : TAsmsymtype;
          constructor init(const s:string);
          constructor init(const s:string);
+         procedure reset;
+         procedure setaddress(sec:tsection;offset,len:longint);
        end;
        end;
 
 
        pasmsymbollist = ^tasmsymbollist;
        pasmsymbollist = ^tasmsymbollist;
@@ -153,6 +155,7 @@ unit aasm;
        pai_label = ^tai_label;
        pai_label = ^tai_label;
        tai_label = object(tai)
        tai_label = object(tai)
           l : plabel;
           l : plabel;
+          sym : pasmsymbol; { filled in pass1 of ag386bin }
           constructor init(_l : plabel);
           constructor init(_l : plabel);
           destructor done; virtual;
           destructor done; virtual;
           procedure setaddress(offset:longint);
           procedure setaddress(offset:longint);
@@ -218,7 +221,6 @@ unit aasm;
        pai_const_symbol = ^tai_const_symbol;
        pai_const_symbol = ^tai_const_symbol;
        tai_const_symbol = object(tai)
        tai_const_symbol = object(tai)
           sym    : pasmsymbol;
           sym    : pasmsymbol;
-          address,
           offset : longint;
           offset : longint;
           constructor init(const name:string);
           constructor init(const name:string);
           constructor init_offset(const name:string;ofs:longint);
           constructor init_offset(const name:string;ofs:longint);
@@ -602,6 +604,7 @@ uses
         inherited init;
         inherited init;
         typ:=ait_label;
         typ:=ait_label;
         l:=_l;
         l:=_l;
+        sym:=nil;
         l^.is_set:=true;
         l^.is_set:=true;
       end;
       end;
 
 
@@ -803,13 +806,24 @@ uses
     constructor tasmsymbol.init(const s:string);
     constructor tasmsymbol.init(const s:string);
       begin;
       begin;
         inherited init(s);
         inherited init(s);
-        idx:=0;
+        reset;
+      end;
+
+    procedure tasmsymbol.reset;
+      begin
         section:=sec_none;
         section:=sec_none;
         address:=0;
         address:=0;
         size:=0;
         size:=0;
-        typ:=AS_NONE;
+        idx:=-1;
+        typ:=AS_EXTERNAL;
       end;
       end;
 
 
+    procedure tasmsymbol.setaddress(sec:tsection;offset,len:longint);
+      begin
+        section:=sec;
+        address:=offset;
+        size:=len;
+      end;
 
 
     { generates an help record for constants }
     { generates an help record for constants }
     function newasmsymbol(const s : string) : pasmsymbol;
     function newasmsymbol(const s : string) : pasmsymbol;
@@ -867,11 +881,7 @@ uses
 
 
     procedure ResetAsmSym(p:Pnamed_object);{$ifndef FPC}far;{$endif}
     procedure ResetAsmSym(p:Pnamed_object);{$ifndef FPC}far;{$endif}
       begin
       begin
-        pasmsymbol(p)^.idx:=0;
-        pasmsymbol(p)^.section:=sec_none;
-        pasmsymbol(p)^.address:=0;
-        pasmsymbol(p)^.size:=0;
-        pasmsymbol(p)^.typ:=AS_NONE;
+        pasmsymbol(p)^.reset;
       end;
       end;
 
 
 
 
@@ -1002,7 +1012,10 @@ uses
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.35  1999-03-05 13:09:48  peter
+  Revision 1.36  1999-03-08 14:51:04  peter
+    + smartlinking for ag386bin
+
+  Revision 1.35  1999/03/05 13:09:48  peter
     * first things for tai_cut support for ag386bin
     * first things for tai_cut support for ag386bin
 
 
   Revision 1.34  1999/03/03 11:59:27  pierre
   Revision 1.34  1999/03/03 11:59:27  pierre