Browse Source

* tai_section extended with code,data,bss sections and enumerated type
* ident 'compiled by FPC' moved to pmodules
* small fix for smartlink

peter 27 years ago
parent
commit
499d54a9c0
6 changed files with 234 additions and 344 deletions
  1. 30 95
      compiler/aasm.pas
  2. 55 63
      compiler/ag386int.pas
  3. 21 92
      compiler/cobjects.pas
  4. 11 4
      compiler/parser.pas
  5. 108 58
      compiler/pmodules.pas
  6. 9 32
      compiler/win_targ.pas

+ 30 - 95
compiler/aasm.pas

@@ -53,9 +53,9 @@ unit aasm;
           ait_comp,
           ait_external,
           ait_align,
+          ait_section,
           { the following is only used by the win32 version of the compiler }
           { and only the GNU AS Win32 is able to write it                   }
-          ait_section,
           ait_const_rva,
 {$ifdef GDB}
           ait_stabn,
@@ -156,8 +156,9 @@ unit aasm;
           destructor done; virtual;
        end;
 
-
        { alignment for operator }
+
+
        pai_align = ^tai_align;
        tai_align = object(tai)
           aligntype: byte;   { 1 = no align, 2 = word align, 4 = dword align }
@@ -167,11 +168,17 @@ unit aasm;
           destructor done;virtual;
        end;
 
-       pai_section = ^tai_section;
+       { Insert a section/segment directive }
+
+       tsection=(sec_none,sec_code,sec_data,sec_bss,sec_idata);
 
+
+       pai_section = ^tai_section;
        tai_section = object(tai)
-          name : pstring;
-          constructor init(const s : string);
+          sec      : tsection;
+          idataidx : longint;
+          constructor init(s : tsection);
+          constructor init_idata(i:longint);
           destructor done;virtual;
        end;
 
@@ -300,18 +307,27 @@ type
                              TAI_SECTION
  ****************************************************************************}
 
-    constructor tai_section.init(const s : string);
+    constructor tai_section.init(s : tsection);
 
       begin
          inherited init;
          typ:=ait_section;
-         name:=stringdup(s);
+         sec:=s;
+         idataidx:=0;
+      end;
+
+    constructor tai_section.init_idata(i:longint);
+
+      begin
+         inherited init;
+         typ:=ait_section;
+         sec:=sec_idata;
+         idataidx:=i;
       end;
 
     destructor tai_section.done;
 
       begin
-         stringdispose(name);
          inherited done;
       end;
 
@@ -721,7 +737,12 @@ type
 end.
 {
   $Log$
-  Revision 1.5  1998-05-01 07:43:52  florian
+  Revision 1.6  1998-05-06 18:36:53  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
+
+  Revision 1.5  1998/05/01 07:43:52  florian
     + basics for rtti implemented
     + switch $m (generate rtti for published sections)
 
@@ -742,90 +763,4 @@ end.
   Revision 1.2  1998/04/09 15:46:37  florian
     + register allocation tracing stuff added
 
-  Revision 1.1.1.1  1998/03/25 11:18:16  root
-  * Restored version
-
-  Revision 1.18  1998/03/10 16:27:36  pierre
-    * better line info in stabs debug
-    * symtabletype and lexlevel separated into two fields of tsymtable
-    + ifdef MAKELIB for direct library output, not complete
-    + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
-      working
-    + ifdef TESTFUNCRET for setting func result in underfunction, not
-      working
-
-  Revision 1.17  1998/03/10 01:17:13  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.16  1998/03/02 01:47:56  peter
-    * renamed target_DOS to target_GO32V1
-    + new verbose system, merged old errors and verbose units into one new
-      verbose.pas, so errors.pas is obsolete
-
-  Revision 1.15  1998/02/28 14:43:46  florian
-    * final implemenation of win32 imports
-    * extended tai_align to allow 8 and 16 byte aligns
-
-  Revision 1.14  1998/02/28 00:20:20  florian
-    * more changes to get import libs for Win32 working
-
-  Revision 1.13  1998/02/27 22:27:50  florian
-    + win_targ unit
-    + support of sections
-    + new asmlists: sections, exports and resource
-
-  Revision 1.12  1998/02/24 00:19:08  peter
-    * makefile works again (btw. linux does like any char after a \ )
-    * removed circular unit with assemble and files
-    * fixed a sigsegv in pexpr
-    * pmodule init unit/program is the almost the same, merged them
-
-  Revision 1.11  1998/02/13 10:34:29  daniel
-  * Made Motorola version compilable.
-  * Fixed optimizer
-
-  Revision 1.10  1998/02/06 23:08:31  florian
-    + endian to targetinfo and sourceinfo added
-    + endian independed writing of ppu file (reading missed), a PPU file
-      is written with the target endian
-
-  Revision 1.9  1998/01/11 04:14:30  carl
-  + correct floating point support for m68k
-
-  Revision 1.6  1997/12/09 13:18:34  carl
-  + added pai_align abstract object (required for m68k)
-  + renamed ait_real_s80bit --> ait_real_extended
-
-  Revision 1.5  1997/12/01 18:14:32  pierre
-      * fixes a bug in nasm output due to my previous changes
-
-  Revision 1.3  1997/11/28 18:14:17  pierre
-   working version with several bug fixes
-
-  Revision 1.2  1997/11/28 14:26:18  florian
-  Fixed some bugs
-
-  Revision 1.1.1.1  1997/11/27 08:32:50  michael
-  FPC Compiler CVS start
-
-  Pre-CVS log:
-
-  FK     Florian Klaempfl
-  PM     Pierre Muller
-  +      feature added
-  -      removed
-  *      bug fixed or changed
-
-  History:
-      30th september 1996:
-         + unit started
-      13th november 1997:
-         + added pai_single and pai_extended (PM)
-      14th november 1997:
-         + added bestreal type and pai_bestreal
-           to store all real consts with best precision (PM)
-           has a drawback for GDB that does not know extended !! (PM)
-
 }

+ 55 - 63
compiler/ag386int.pas

@@ -234,10 +234,21 @@ unit ag386int;
                                TI386INTASMLIST
  ****************************************************************************}
 
+    var
+      LastSec : tsection;
+
+
     const
       ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
         (#9'DD'#9,'',#9'DW'#9,#9'DB'#9);
 
+      ait_section2nasmstr : array[tsection] of string[6]=
+       ('','.text','.data','.bss','.idata');
+
+      ait_section2masmstr : array[tsection] of string[6]=
+       ('','CODE','DATA','BSS','');
+
+
     Function PadTabs(p:pchar;addch:char):string;
     var
       s : string;
@@ -274,6 +285,8 @@ unit ag386int;
       found,
       quoted   : boolean;
     begin
+      if not assigned(p) then
+       exit;
       hp:=pai(p^.first);
       while assigned(hp) do
        begin
@@ -283,6 +296,21 @@ unit ag386int;
                        AsmWritePChar(pai_asm_comment(hp)^.str);
                        AsmLn;
                      End;
+       ait_section : begin
+                       if current_module^.output_format in [of_nasm,of_obj] then
+                         AsmWriteLn('SECTION '+ait_section2nasmstr[pai_section(hp)^.sec])
+                       else
+
+
+                         begin
+                           if LastSec<>sec_none then
+                             AsmWriteLn('_'+ait_section2masmstr[LastSec]+#9#9'ENDS');
+                           AsmWriteLn('_'+ait_section2masmstr[pai_section(hp)^.sec]+'DATA'#9#9+
+                             'SEGMENT'#9'PARA PUBLIC USE32 '''+ait_section2masmstr[pai_section(hp)^.sec]+'''');
+                         end;
+
+                       LastSec:=pai_section(hp)^.sec;
+                     end;
          ait_align : begin
                      { align not supported at all with nasm v095  }
                      { align with specific value not supported by }
@@ -578,76 +606,35 @@ ait_stab_function_name : ;
       if assigned(current_module^.mainsource) then
        comment(v_info,'Start writing intel-styled assembler output for '+current_module^.mainsource^);
 {$endif}
+      LastSec:=sec_none;
       if current_module^.output_format in [of_nasm,of_obj] then
-       begin
-         WriteTree(externals);
-         { INTEL ASM doesn't support stabs
-         WriteTree(debuglist);}
-
-         AsmWriteLn('BITS 32');
-         AsmWriteLn('SECTION .text');
-         {
-         AsmWriteLn(#9#9'ASSUME'#9'CS:_TEXT,ES:DGROUP,DS:DGROUP,SS:DGROUP');
-         }
-         WriteTree(codesegment);
-
-         AsmLn;
-         AsmWriteLn('SECTION .data');
-{$ifdef EXTDEBUG}
-         if not comp_unit then
-{$endif EXTDEBUG}
-           begin
-              DataSegment^.insert(new(pai_align,init(4)));
-              DataSegment^.insert(new(pai_string,init('target: '+target_info.short_name)));
-              DataSegment^.insert(new(pai_string,init('compiled by FPC '+version_string)));
-           end;
-         WriteTree(datasegment);
-         WriteTree(consts);
-         WriteTree(rttilist);
-
-         AsmLn;
-         AsmWriteLn('SECTION .bss');
-         WriteTree(bsssegment);
-       end
+       AsmWriteLn('BITS 32')
       else
        begin
          AsmWriteLn(#9'.386p');
          AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
-
-         WriteTree(externals);
-         { INTEL ASM doesn't support stabs
-         WriteTree(debuglist);}
-
          AsmWriteLn('DGROUP'#9#9'GROUP'#9'_BSS,_DATA');
-         AsmWriteLn('_TEXT'#9#9'SEGMENT'#9'PARA PUBLIC USE32 ''CODE''');
          AsmWriteLn(#9#9'ASSUME'#9'CS:_TEXT,ES:DGROUP,DS:DGROUP,SS:DGROUP');
-         AsmLn;
-         WriteTree(codesegment);
-         AsmWriteLn('_TEXT'#9#9'ENDS');
+       end;
+
+
+
+      WriteTree(externals);
+    { INTEL ASM doesn't support stabs
+      WriteTree(debuglist);}
+
+      WriteTree(codesegment);
+      WriteTree(datasegment);
+      WriteTree(consts);
+      WriteTree(rttilist);
+      WriteTree(bsssegment);
+
+      if not (current_module^.output_format in [of_nasm,of_obj]) then
+       AsmWriteLn(#9#9'END');
+
+
+      AsmLn;
 
-         AsmLn;
-         AsmWriteLn('_DATA'#9#9'SEGMENT'#9'PARA PUBLIC USE32 ''DATA''');
-{$ifdef EXTDEBUG}
-         if not comp_unit then
-{$endif EXTDEBUG}
-           begin
-              DataSegment^.insert(new(pai_align,init(4)));
-              DataSegment^.insert(new(pai_string,init('target: '+target_info.short_name)));
-              DataSegment^.insert(new(pai_string,init('compiled by FPC '+version_string)));
-           end;
-         WriteTree(datasegment);
-         WriteTree(consts);
-         WriteTree(rttilist);
-         AsmWriteLn('_DATA'#9#9'ENDS');
-
-         AsmLn;
-         AsmWriteLn('_BSS'#9#9'SEGMENT'#9'PARA PUBLIC USE32 ''BSS''');
-         WriteTree(bsssegment);
-         AsmWriteLn('_BSS'#9#9'ENDS');
-
-         AsmLn;
-         AsmWriteLn(#9#9'END');
-      end;
 {$ifdef EXTDEBUG}
       if assigned(current_module^.mainsource) then
        comment(v_info,'Done writing intel-styled assembler output for '+current_module^.mainsource^);
@@ -657,7 +644,12 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.7  1998-05-06 08:38:32  pierre
+  Revision 1.8  1998-05-06 18:36:53  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
+
+  Revision 1.7  1998/05/06 08:38:32  pierre
     * better position info with UseTokenInfo
       UseTokenInfo greatly simplified
     + added check for changed tree after first time firstpass

+ 21 - 92
compiler/cobjects.pas

@@ -103,6 +103,11 @@ unit cobjects;
           { removes p from the list (p isn't disposed) }
           { it's not tested if p is in the list !      }
           procedure remove(p : plinkedlist_item);
+
+
+
+          { is the linkedlist empty ? }
+          function  empty:boolean;
        end;
 
        { String Queue}
@@ -130,10 +135,13 @@ unit cobjects;
           constructor init;
           destructor done;
 
+
+
           { true is the container empty }
           function empty:boolean;
 
 
+
           { inserts a string }
           procedure insert(const s : string);
 {$ifdef UseTokenInfo}
@@ -731,6 +739,13 @@ end;
          p^.first:=nil;
       end;
 
+    function tlinkedlist.empty:boolean;
+      begin
+        empty:=(first=nil);
+      end;
+
+
+
 {****************************************************************************
                                TBUFFEREDFILE
  ****************************************************************************}
@@ -1063,7 +1078,12 @@ end;
 end.
 {
   $Log$
-  Revision 1.6  1998-05-06 08:38:37  pierre
+  Revision 1.7  1998-05-06 18:36:53  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
+
+  Revision 1.6  1998/05/06 08:38:37  pierre
     * better position info with UseTokenInfo
       UseTokenInfo greatly simplified
     + added check for changed tree after first time firstpass
@@ -1094,95 +1114,4 @@ end.
 
   Revision 1.2  1998/04/07 11:09:04  peter
     + filemode is set correct in tbufferedfile.reset
-
-  Revision 1.1.1.1  1998/03/25 11:18:15  root
-  * Restored version
-
-  Revision 1.15  1998/03/10 16:27:38  pierre
-    * better line info in stabs debug
-    * symtabletype and lexlevel separated into two fields of tsymtable
-    + ifdef MAKELIB for direct library output, not complete
-    + ifdef CHAINPROCSYMS for overloaded seach across units, not fully
-      working
-    + ifdef TESTFUNCRET for setting func result in underfunction, not
-      working
-
-  Revision 1.14  1998/03/10 01:17:18  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.13  1998/03/04 17:33:42  michael
-  + Changed ifdef FPK to ifdef FPC
-
-  Revision 1.12  1998/03/02 01:48:31  peter
-    * renamed target_DOS to target_GO32V1
-    + new verbose system, merged old errors and verbose units into one new
-      verbose.pas, so errors.pas is obsolete
-
-  Revision 1.11  1998/02/28 00:20:22  florian
-    * more changes to get import libs for Win32 working
-
-  Revision 1.10  1998/02/24 14:20:50  peter
-    + tstringcontainer.empty
-    * ld -T option restored for linux
-    * libraries are placed before the objectfiles in a .PPU file
-    * removed 'uses link' from files.pas
-
-  Revision 1.9  1998/02/18 13:48:17  michael
-  + Implemented an OS independent AsmRes object.
-
-  Revision 1.8  1998/02/17 21:20:45  peter
-    + Script unit
-    + __EXIT is called again to exit a program
-    - target_info.link/assembler calls
-    * linking works again for dos
-    * optimized a few filehandling functions
-    * fixed stabs generation for procedures
-
-  Revision 1.7  1998/02/13 10:34:55  daniel
-  * Made Motorola version compilable.
-  * Fixed optimizer
-
-  Revision 1.6  1998/02/12 11:50:01  daniel
-  Yes! Finally! After three retries, my patch!
-
-  Changes:
-
-  Complete rewrite of psub.pas.
-  Added support for DLL's.
-  Compiler requires less memory.
-  Platform units for each platform.
-
-  Revision 1.5  1998/02/06 23:08:32  florian
-    + endian to targetinfo and sourceinfo added
-    + endian independed writing of ppu file (reading missed), a PPU file
-      is written with the target endian
-
-  Revision 1.4  1998/01/13 17:11:34  michael
-  * Changed getftime method to work faster under linux.
-
-  Revision 1.3  1997/12/05 13:45:34  daniel
-  - Removed overlay init. This is done by PPOVIN.PAS.
-
-  Revision 1.2  1997/11/28 18:14:28  pierre
-   working version with several bug fixes
-
-  Revision 1.1.1.1  1997/11/27 08:32:55  michael
-  FPC Compiler CVS start
-
- Pre-CVS log:
-
- History:
-      30th september 1996:
-         + english comments (FK)
-         + _2pchar renamed to pstring2pchar (FK)
-         + _2pstring renamed to pchar2pstring (FK)
-      15th october 1996:
-         + tstringcontainer is compilable (FK)
-         + full compilable (FK)
-       4th january 1996:
-         + tstring_item added (FK)
-      19th november 1997:
-         + call of overlay init (FK)
 }

+ 11 - 4
compiler/parser.pas

@@ -402,15 +402,17 @@ unit parser;
 
              GenerateAsm(filename);
 
-           { add the files for the linker from current_module}
-             addlinkerfiles(current_module);
-
              if smartlink then
               begin
                 Linker.SetLibName(FileName);
                 Linker.MakeStaticLibrary(SmartLinkPath(FileName));
               end;
 
+           { add the files for the linker from current_module, this must be
+             after the makestaticlibrary, because it will add the library
+             name (PFV) }
+             addlinkerfiles(current_module);
+
              { Check linking  => we are at first level in compile }
              if (compile_level=1) then
               begin
@@ -534,7 +536,12 @@ done:
 end.
 {
   $Log$
-  Revision 1.13  1998-05-06 08:38:42  pierre
+  Revision 1.14  1998-05-06 18:36:53  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
+
+  Revision 1.13  1998/05/06 08:38:42  pierre
     * better position info with UseTokenInfo
       UseTokenInfo greatly simplified
     + added check for changed tree after first time firstpass

+ 108 - 58
compiler/pmodules.pas

@@ -74,6 +74,75 @@ unit pmodules;
          end;
       end;
 
+    procedure insertsegment;
+      begin
+      {Insert Ident of the compiler}
+        if not smartlink then
+         begin
+           datasegment^.insert(new(pai_align,init(4)));
+           datasegment^.insert(new(pai_string,init('FPC '+version_string+' - '+target_info.short_name)));
+         end;
+
+        bsssegment^.insert(new(pai_section,init(sec_bss)));
+        codesegment^.insert(new(pai_section,init(sec_code)));
+        datasegment^.insert(new(pai_section,init(sec_data)));
+      end;
+
+    procedure insertheap;
+      begin
+         if smartlink then
+           begin
+             bsssegment^.concat(new(pai_cut,init));
+             datasegment^.concat(new(pai_cut,init));
+           end;
+
+
+
+        { On the Macintosh Classic M68k Architecture
+          The Heap variable is simply a POINTER to the
+          real HEAP. The HEAP must be set up by the RTL
+          and must store the pointer in this value.
+          On OS/2 the heap is also intialized by the RTL. We do
+          not output a pointer }
+         case target_info.target of
+          target_OS2 : ;
+       target_Mac68K : bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)));
+         else
+           bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
+         end;
+         datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
+         datasegment^.concat(new(pai_const,init_32bit(heapsize)));
+      end;
+
+
+    procedure inserttargetspecific;
+      var
+        i : longint;
+      begin
+
+        case target_info.target of
+       target_GO32V2 : begin
+                       { stacksize can be specified }
+                         datasegment^.concat(new(pai_symbol,init_global('__stklen')));
+                         datasegment^.concat(new(pai_const,init_32bit(stacksize)));
+                       end;
+        target_WIN32 : begin
+                       { generate the last entry for the imports directory }
+                         if not(assigned(importssection)) then
+                           importssection:=new(paasmoutput,init);
+                       { $3 ensure that it is the last entry, all other entries }
+                       { are written to $2                                      }
+                         importssection^.concat(new(pai_section,init_idata(3)));
+                         for i:=1 to 5 do
+                           importssection^.concat(new(pai_const,init_32bit(0)));
+                       end;
+        end;
+
+      end;
+
+
+
+
     { all intern procedures for system unit }
 
     procedure insertinternsyms(p : psymtable);
@@ -697,9 +766,6 @@ unit pmodules;
          dispose(aktprocsym^.definition^.localst,done);
          aktprocsym^.definition^.localst:=p;
 
-         names.init;
-         names.insert(current_module^.unitname^+'_init');
-         names.insert('INIT$$'+current_module^.unitname^);
 
          { testing !!!!!!!!! }
          { we set the interface part as a unitsymtable  }
@@ -743,13 +809,16 @@ unit pmodules;
          {Reset the codegenerator.}
          codegen_newprocedure;
 
+         names.init;
+         names.insert(current_module^.unitname^+'_init');
+         names.insert('INIT$$'+current_module^.unitname^);
          compile_proc_body(names,true,false);
+         names.done;
 
          codegen_doneprocedure;
 
          consume(POINT);
 
-         names.done;
 
          { size of the static data }
          datasize:=symtablestack^.datasize;
@@ -789,12 +858,20 @@ unit pmodules;
               pu:=pused_unit(pu^.next);
            end;
          inc(datasize,symtablestack^.datasize);
+
+
+
+      { finish asmlist by adding segment starts }
+
+
+         insertsegment;
       end;
 
+
+
     procedure proc_program(islibrary : boolean);
 
       var
-         i : longint;
          st : psymtable;
          programname : stringid;
          names:Tstringcontainer;
@@ -873,8 +950,6 @@ unit pmodules;
          { the elements of enumeration types are inserted       }
          constsymtable:=st;
 
-         codegen_newprocedure;
-
          { set some informations about the main program }
          procinfo.retdef:=voiddef;
          procinfo._class:=nil;
@@ -890,82 +965,57 @@ unit pmodules;
          procprefix:='';
          in_except_block:=false;
 
+         codegen_newprocedure;
+
          {The program intialization needs an alias, so it can be called
           from the bootstrap code.}
          names.init;
          names.insert('program_init');
          names.insert('PASCALMAIN');
-         case target_info.target of
-          target_GO32V1,
-          target_GO32V2,
-             target_OS2,
-           target_WIN32 : names.insert('_main');
-           target_LINUX : names.insert('main');
-         end;
+         names.insert(target_os.cprefix+'main');
          compile_proc_body(names,true,false);
          names.done;
 
          codegen_doneprocedure;
 
+         consume(POINT);
+
+
+
          if smartlink then
           current_module^.linkstaticlibs.insert(current_module^.arfilename^)
          else
           current_module^.linkofiles.insert(current_module^.objfilename^);
 
-         if smartlink then
-           begin
-             bsssegment^.concat(new(pai_cut,init));
-             datasegment^.concat(new(pai_cut,init));
-           end;
-        { On the Macintosh Classic M68k Architecture   }
-        { The Heap variable is simply a POINTER to the }
-        { real HEAP. The HEAP must be set up by the RTL }
-        { and must store the pointer in this value.    }
-        {On OS/2 the heap is also intialized by the RTL. We do
-         not  output a pointer.}
-         if target_info.target<>target_OS2 then
-            if (target_info.target = target_MAC68k) then
-                bsssegment^.concat(new(pai_datablock,init_global('HEAP',4)))
-            else
-                bsssegment^.concat(new(pai_datablock,init_global('HEAP',heapsize)));
-         if target_info.target=target_GO32V2 then
-           begin
-              { stacksize can be specified }
-              datasegment^.concat(new(pai_symbol,init_global('__stklen')));
-              datasegment^.concat(new(pai_const,init_32bit(stacksize)));
-           end;
-         if (target_info.target=target_WIN32) then
-           begin
-              { generate the last entry for the imports directory }
-              if not(assigned(importssection)) then
-                importssection:=new(paasmoutput,init);
-              { $3 ensure that it is the last entry, all other entries }
-              { are written to $2                                      }
-              importssection^.concat(new(pai_section,init('.idata$3')));
-              for i:=1 to 5 do
-                importssection^.concat(new(pai_const,init_32bit(0)));
-           end;
+         insertheap;
+         inserttargetspecific;
 
-         {I prefer starting with a heapsize of 256K in OS/2. The heap can
-          grow later until the size specified on the command line. Allocating
-          four megs at once can hurt performance when more programs are in
-          memory.}
-         datasegment^.concat(new(pai_symbol,init_global('HEAPSIZE')));
-         if target_info.target=target_OS2 then
-          heapsize:=256*1024;
-         datasegment^.concat(new(pai_const,init_32bit(heapsize)));
-         datasize:=symtablestack^.datasize;
 
-         consume(POINT);
 
+         datasize:=symtablestack^.datasize;
          symtablestack^.check_forwards;
          symtablestack^.allsymbolsused;
+
+
+
+      { finish asmlist by adding segment starts }
+
+
+         insertsegment;
+
+
+
       end;
 
 end.
 {
   $Log$
-  Revision 1.10  1998-05-04 17:54:28  peter
+  Revision 1.11  1998-05-06 18:36:53  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
+
+  Revision 1.10  1998/05/04 17:54:28  peter
     + smartlinking works (only case jumptable left todo)
     * redesign of systems.pas to support assemblers and linkers
     + Unitname is now also in the PPU-file, increased version to 14

+ 9 - 32
compiler/win_targ.pas

@@ -95,7 +95,7 @@ unit win_targ;
               getlabel(l2);
               getlabel(l3);
               { create import directory entry }
-              importssection^.concat(new(pai_section,init('.idata$2')));
+              importssection^.concat(new(pai_section,init_idata(2)));
               { pointer to procedure names }
               importssection^.concat(new(pai_const,init_rva(strpnew(lab2str
                 (l2)))));
@@ -114,7 +114,7 @@ unit win_targ;
               { this would give too much idata* entries  }
 
               { first write the name references }
-              importssection^.concat(new(pai_section,init('.idata$4')));
+              importssection^.concat(new(pai_section,init_idata(4)));
               importssection^.concat(new(pai_label,init(l2)));
               hp2:=pimported_procedure(hp1^.imported_procedures^.first);
               while assigned(hp2) do
@@ -128,7 +128,7 @@ unit win_targ;
               importssection^.concat(new(pai_const,init_32bit(0)));
 
               { then the addresses and create also the indirect jump }
-              importssection^.concat(new(pai_section,init('.idata$5')));
+              importssection^.concat(new(pai_section,init_idata(5)));
               importssection^.concat(new(pai_label,init(l3)));
               hp2:=pimported_procedure(hp1^.imported_procedures^.first);
               while assigned(hp2) do
@@ -153,7 +153,7 @@ unit win_targ;
               importssection^.concat(new(pai_const,init_32bit(0)));
 
               { finally the import information }
-              importssection^.concat(new(pai_section,init('.idata$6')));
+              importssection^.concat(new(pai_section,init_idata(6)));
               hp2:=pimported_procedure(hp1^.imported_procedures^.first);
               while assigned(hp2) do
                 begin
@@ -164,7 +164,7 @@ unit win_targ;
                    hp2:=pimported_procedure(hp2^.next);
                 end;
               { create import dll name }
-              importssection^.concat(new(pai_section,init('.idata$7')));
+              importssection^.concat(new(pai_section,init_idata(7)));
               importssection^.concat(new(pai_label,init(l1)));
               importssection^.concat(new(pai_string,init(hp1^.dllname^+#0)));
 
@@ -175,32 +175,9 @@ unit win_targ;
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:15  root
-  Initial revision
+  Revision 1.2  1998-05-06 18:36:55  peter
+    * tai_section extended with code,data,bss sections and enumerated type
+    * ident 'compiled by FPC' moved to pmodules
+    * small fix for smartlink
 
-  Revision 1.9  1998/03/10 13:23:00  florian
-    * small win32 problems fixed
-
-  Revision 1.8  1998/03/10 01:17:31  peter
-    * all files have the same header
-    * messages are fully implemented, EXTDEBUG uses Comment()
-    + AG... files for the Assembler generation
-
-  Revision 1.7  1998/03/04 10:35:34  florian
-    * writing of externals fixed
-
-  Revision 1.6  1998/03/02 13:38:52  peter
-    + importlib object
-    * doesn't crash on a systemunit anymore
-    * updated makefile and depend
-
-  Revision 1.4  1998/02/28 14:43:50  florian
-    * final implemenation of win32 imports
-    * extended tai_align to allow 8 and 16 byte aligns
-
-  Revision 1.3  1998/02/28 09:30:59  florian
-    + writing of win32 import section added
-
-  Revision 1.2  1998/02/28 00:20:35  florian
-    * more changes to get import libs for Win32 working
 }