Explorar el Código

* import library fixes for win32
* alignment works again

peter hace 26 años
padre
commit
19443ae269

+ 20 - 4
compiler/aasm.pas

@@ -264,10 +264,14 @@ unit aasm;
        end;
 
        { insert a cut to split into several smaller files }
+
+       tcutplace=(cut_normal,cut_begin,cut_end);
+
        pai_cut = ^tai_cut;
        tai_cut = object(tai)
-          endname : boolean;
+          place : tcutplace;
           constructor init;
+          constructor init_begin;
           constructor init_end;
        end;
 
@@ -729,7 +733,15 @@ uses
        begin
           inherited init;
           typ:=ait_cut;
-          endname:=false;
+          place:=cut_normal;
+       end;
+
+
+     constructor tai_cut.init_begin;
+       begin
+          inherited init;
+          typ:=ait_cut;
+          place:=cut_begin;
        end;
 
 
@@ -737,7 +749,7 @@ uses
        begin
           inherited init;
           typ:=ait_cut;
-          endname:=true;
+          place:=cut_end;
        end;
 
 
@@ -987,7 +999,11 @@ uses
 end.
 {
   $Log$
-  Revision 1.65  1999-10-27 16:11:27  peter
+  Revision 1.66  1999-11-02 15:06:56  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.65  1999/10/27 16:11:27  peter
     * insns.dat is used to generate all i386*.inc files
 
   Revision 1.64  1999/09/20 16:38:51  peter

+ 6 - 4
compiler/ag386att.pas

@@ -764,9 +764,7 @@ unit ag386att;
                    begin
                      AsmClose;
                      DoAssemble;
-                     if pai_cut(hp)^.EndName then
-                      IsEndFile:=true;
-                     AsmCreate;
+                     AsmCreate(pai_cut(hp)^.place);
                    end;
                 { avoid empty files }
                   while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
@@ -873,7 +871,11 @@ unit ag386att;
 end.
 {
   $Log$
-  Revision 1.18  1999-10-27 16:11:28  peter
+  Revision 1.19  1999-11-02 15:06:56  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.18  1999/10/27 16:11:28  peter
     * insns.dat is used to generate all i386*.inc files
 
   Revision 1.17  1999/09/27 23:36:33  peter

+ 29 - 13
compiler/ag386bin.pas

@@ -465,9 +465,9 @@ unit ag386bin;
            case hp^.typ of
              ait_align :
                begin
-                 { always use the maximum fillsize in this pass to avoid possible
-                   short jumps to become out of range }
-                 pai_align(hp)^.fillsize:=pai_align(hp)^.aligntype;
+                 { here we must determine the fillsize which is used in pass2 }
+                 pai_align(hp)^.fillsize:=align(objectalloc^.sectionsize,pai_align(hp)^.aligntype)-
+                   objectalloc^.sectionsize;
                  objectalloc^.sectionalloc(pai_align(hp)^.fillsize);
                end;
              ait_datablock :
@@ -599,6 +599,7 @@ unit ag386bin;
         );
       var
         l,j : longint;
+        alignoparray:array[0..63] of byte;
 {$ifdef I386}
         co : comp;
 {$endif I386}
@@ -622,14 +623,22 @@ unit ag386bin;
            case hp^.typ of
              ait_align :
                begin
-                 l:=pai_align(hp)^.fillsize;
-                 while (l>0) do
+                 if not pai_align(hp)^.use_op then
+                  begin
+                    l:=pai_align(hp)^.fillsize;
+                    while (l>0) do
+                     begin
+                       for j:=0to 5 do
+                        if (l>=length(alignarray[j])) then
+                         break;
+                       objectoutput^.writebytes(alignarray[j][1],length(alignarray[j]));
+                       dec(l,length(alignarray[j]));
+                     end;
+                  end
+                 else
                   begin
-                    for j:=0to 5 do
-                     if (l>=length(alignarray[j])) then
-                      break;
-                    objectoutput^.writebytes(alignarray[j][1],length(alignarray[j]));
-                    dec(l,length(alignarray[j]));
+                    fillchar(alignoparray,pai_align(hp)^.fillsize,pai_align(hp)^.fillop);
+                    objectoutput^.writebytes(alignoparray,pai_align(hp)^.fillsize);
                   end;
                end;
              ait_section :
@@ -797,7 +806,10 @@ unit ag386bin;
            objectoutput^.donewriting;
 
            { we will start a new objectfile so reset everything }
-           objectoutput^.initwriting;
+           if (hp^.typ=ait_cut) then
+            objectoutput^.initwriting(pai_cut(hp)^.place)
+           else
+            objectoutput^.initwriting(cut_normal);
            objectalloc^.resetsections;
            ResetAsmsymbolList;
 
@@ -840,7 +852,7 @@ unit ag386bin;
         objectalloc^.resetsections;
         objectalloc^.setsection(sec_code);
 
-        objectoutput^.initwriting;
+        objectoutput^.initwriting(cut_normal);
         objectoutput^.defaultsection(sec_code);
 
         if cs_debuginfo in aktmoduleswitches then
@@ -895,7 +907,11 @@ unit ag386bin;
 end.
 {
   $Log$
-  Revision 1.25  1999-09-26 21:13:40  peter
+  Revision 1.26  1999-11-02 15:06:56  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.25  1999/09/26 21:13:40  peter
     * short jmp with alignment problems fixed
 
   Revision 1.24  1999/08/25 11:59:33  jonas

+ 6 - 4
compiler/ag386int.pas

@@ -546,9 +546,7 @@ ait_stab_function_name : ;
                           AsmWriteLn(#9'END');
                           AsmClose;
                           DoAssemble;
-                          if pai_cut(hp)^.EndName then
-                           IsEndFile:=true;
-                          AsmCreate;
+                          AsmCreate(pai_cut(hp)^.place);
                         end;
                      { avoid empty files }
                        while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
@@ -631,7 +629,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.54  1999-09-10 15:41:18  peter
+  Revision 1.55  1999-11-02 15:06:56  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.54  1999/09/10 15:41:18  peter
     * added symbol_end
 
   Revision 1.53  1999/09/02 18:47:42  daniel

+ 6 - 4
compiler/ag386nsm.pas

@@ -579,9 +579,7 @@ unit ag386nsm;
                 begin
                   AsmClose;
                   DoAssemble;
-                  if pai_cut(hp)^.EndName then
-                   IsEndFile:=true;
-                  AsmCreate;
+                  AsmCreate(pai_cut(hp)^.place);
                 end;
              { avoid empty files }
                while assigned(hp^.next) and (pai(hp^.next)^.typ in [ait_cut,ait_section,ait_comment]) do
@@ -656,7 +654,11 @@ unit ag386nsm;
 end.
 {
   $Log$
-  Revision 1.52  1999-09-13 16:27:24  peter
+  Revision 1.53  1999-11-02 15:06:56  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.52  1999/09/13 16:27:24  peter
     * fix for jmps to be always near
     * string writing fixed
 

+ 19 - 13
compiler/assemble.pas

@@ -49,7 +49,7 @@ type
     objfile,
     as_bin   : string;
     SmartAsm : boolean;
-    IsEndFile : boolean;  { special 'end' file for import dir ? }
+    place    : TCutPlace; { special 'end' file for import dir ? }
   {outfile}
     AsmSize,
     AsmStartSize,
@@ -69,7 +69,7 @@ type
     Procedure AsmWritePChar(p:pchar);
     Procedure AsmWriteLn(const s:string);
     Procedure AsmLn;
-    procedure AsmCreate;
+    procedure AsmCreate(Aplace:tcutplace);
     procedure AsmClose;
     procedure Synchronize;
     procedure WriteTree(p:paasmoutput);virtual;
@@ -253,13 +253,14 @@ begin
   inc(SmartLinkFilesCnt);
   if SmartLinkFilesCnt>999999 then
    Message(asmw_f_too_many_asm_files);
-  if IsEndFile then
-   begin
-     s:=current_module^.asmprefix^+'e';
-     IsEndFile:=false;
-   end
-  else
-   s:=current_module^.asmprefix^;
+  case place of
+    cut_begin :
+      s:=current_module^.asmprefix^+'h';
+    cut_normal :
+      s:=current_module^.asmprefix^+'s';
+    cut_end :
+      s:=current_module^.asmprefix^+'t';
+  end;
   AsmFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.asmext);
   ObjFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.objext);
 end;
@@ -338,8 +339,9 @@ begin
 end;
 
 
-procedure TAsmList.AsmCreate;
+procedure TAsmList.AsmCreate(Aplace:tcutplace);
 begin
+  place:=Aplace;
   if SmartAsm then
    NextSmartName;
 {$ifdef linux}
@@ -429,7 +431,7 @@ begin
   name:=FixFileName(current_module^.modulename^);
   OutCnt:=0;
   SmartLinkFilesCnt:=0;
-  IsEndFile:=false;
+  place:=cut_normal;
   SmartAsm:=smart;
 { Which path will be used ? }
   if SmartAsm then
@@ -535,7 +537,7 @@ begin
     Message(asmw_f_assembler_output_not_supported);
 {$endif}
   end;
-  a^.AsmCreate;
+  a^.AsmCreate(cut_normal);
   a^.WriteAsmList;
   a^.AsmClose;
   a^.DoAssemble;
@@ -557,7 +559,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.54  1999-09-16 11:34:44  pierre
+  Revision 1.55  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.54  1999/09/16 11:34:44  pierre
    * typo correction
 
   Revision 1.53  1999/09/02 18:47:44  daniel

+ 12 - 1
compiler/import.pas

@@ -54,6 +54,7 @@ type
       procedure importprocedure(const func,module:string;index:longint;const name:string);virtual;
       procedure importvariable(const varname,module:string;const name:string);virtual;
       procedure generatelib;virtual;
+      procedure generatesmartlib;virtual;
    end;
 
 var
@@ -188,6 +189,12 @@ begin
 end;
 
 
+procedure timportlib.generatesmartlib;
+begin
+  Message(exec_e_dll_not_supported);
+end;
+
+
 procedure DoneImport;
 begin
   if assigned(importlib) then
@@ -227,7 +234,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.13  1999-10-21 14:29:34  peter
+  Revision 1.14  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.13  1999/10/21 14:29:34  peter
     * redesigned linker object
     + library support for linux (only procedures can be exported)
 

+ 20 - 24
compiler/og386.pas

@@ -61,13 +61,13 @@ unit og386;
          writer    : pobjectwriter;
          path      : pathstr;
          ObjFile   : string;
-         IsEndFile : boolean;  { special 'end' file for import dir ? }
+         place     : tcutplace;
          currsec   : tsection;
          constructor init(smart:boolean);
          destructor  done;virtual;
          { Writing }
          procedure NextSmartName;
-         procedure initwriting;virtual;
+         procedure initwriting(Aplace:tcutplace);virtual;
          procedure donewriting;virtual;
          procedure setsectionsizes(var s:tsecsize);virtual;
          procedure writebytes(var data;len:longint);virtual;
@@ -193,32 +193,24 @@ unit og386;
         if SmartLinkFilesCnt>999999 then
          Message(asmw_f_too_many_asm_files);
         if (cs_asm_leave in aktglobalswitches) then
-          begin
-            if IsEndFile then
-             begin
-               s:=current_module^.asmprefix^+'e';
-               IsEndFile:=false;
-             end
-            else
-             s:=current_module^.asmprefix^;
-            ObjFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.objext)
-          end
+         s:=current_module^.asmprefix^
         else
-          begin
-            if IsEndFile then
-             begin
-               s:=current_module^.modulename^+'_e';
-               IsEndFile:=false;
-             end
-            else
-             s:=current_module^.modulename^+'_';
-            ObjFile:=FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.objext);
-          end;
+         s:=current_module^.modulename^;
+        case place of
+          cut_begin :
+            s:=s+'h';
+          cut_normal :
+            s:=s+'s';
+          cut_end :
+            s:=s+'t';
+        end;
+        ObjFile:=Path+FixFileName(s+tostr(SmartLinkFilesCnt)+target_info.objext)
       end;
 
 
-    procedure tobjectoutput.initwriting;
+    procedure tobjectoutput.initwriting(Aplace:tcutplace);
       begin
+        place:=Aplace;
         if objsmart then
          NextSmartName;
         writer^.create(objfile);
@@ -278,7 +270,11 @@ unit og386;
 end.
 {
   $Log$
-  Revision 1.12  1999-09-07 15:22:20  pierre
+  Revision 1.13  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.12  1999/09/07 15:22:20  pierre
    * runerror => do_halt
 
   Revision 1.11  1999/08/04 00:23:04  florian

+ 27 - 9
compiler/og386cff.pas

@@ -102,6 +102,7 @@ unit og386cff;
           datapos,
           relocpos,
           nrelocs,
+          align,
           flags     : longint;
           relochead : PReloc;
           reloctail : ^PReloc;
@@ -122,7 +123,7 @@ unit og386cff;
          initsym : longint;
          constructor init(smart:boolean);
          destructor  done;virtual;
-         procedure initwriting;virtual;
+         procedure initwriting(Aplace:tcutplace);virtual;
          procedure donewriting;virtual;
          procedure setsectionsizes(var s:tsecsize);virtual;
          procedure writebytes(var data;len:longint);virtual;
@@ -231,6 +232,15 @@ unit og386cff;
         index:=sec;
         secidx:=0;
         flags:=AFlags;
+        { alignment after section }
+        case sec of
+          sec_code,
+          sec_data,
+          sec_bss :
+            align:=4;
+          else
+            align:=1;
+        end;
         { filled after pass 1 }
         size:=0;
         fillsize:=0;
@@ -328,11 +338,11 @@ unit og386cff;
       end;
 
 
-    procedure tgenericcoffoutput.initwriting;
+    procedure tgenericcoffoutput.initwriting(Aplace:tcutplace);
       var
         s : string;
       begin
-        inherited initwriting;
+        inherited initwriting(Aplace);
         { reset }
         initsym:=0;
         new(syms,init(sizeof(TSymbol),symbolresize));
@@ -768,10 +778,7 @@ unit og386cff;
             sects[sec]^.size:=s[sec];
             sects[sec]^.mempos:=mempos;
             { calculate the alignment }
-            if sects[sec]^.flags=0 then
-             align:=1
-            else
-             align:=4;
+            align:=sects[sec]^.align;
             sects[sec]^.fillsize:=align-(sects[sec]^.size and (align-1));
             if sects[sec]^.fillsize=align then
              sects[sec]^.fillsize:=0;
@@ -787,6 +794,7 @@ unit og386cff;
       var
         datapos,secidx,
         nsects,sympos,i : longint;
+        gotreloc : boolean;
         sec    : tsection;
         header : coffheader;
         sechdr : coffsechdr;
@@ -830,11 +838,14 @@ unit og386cff;
             inc(initsym,2); { 2 for each section }
           end;
         { relocs }
+        gotreloc:=false;
         for sec:=low(tsection) to high(tsection) do
          if assigned(sects[sec]) then
           begin
             sects[sec]^.relocpos:=datapos;
             inc(datapos,10*sects[sec]^.nrelocs);
+            if (not gotreloc) and (sects[sec]^.nrelocs>0) then
+             gotreloc:=true;
           end;
         { symbols }
         sympos:=datapos;
@@ -844,7 +855,10 @@ unit og386cff;
         header.nsects:=nsects;
         header.sympos:=sympos;
         header.syms:=syms^.count+initsym;
-        header.flag:=$104;
+        if gotreloc then
+         header.flag:=$104
+        else
+         header.flag:=$105;
         writer^.write(header,sizeof(header));
       { Section headers }
         for sec:=low(tsection) to high(tsection) do
@@ -964,7 +978,11 @@ unit og386cff;
 end.
 {
   $Log$
-  Revision 1.12  1999-08-16 15:35:25  pierre
+  Revision 1.13  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.12  1999/08/16 15:35:25  pierre
     * fix for DLL relocation problems
     * external bss vars had wrong stabs for pecoff
     + -WB11000000 to specify default image base, allows to

+ 8 - 4
compiler/og386dbg.pas

@@ -37,7 +37,7 @@ unit og386dbg;
          rawidx  : longint;
          constructor init(smart:boolean);
          destructor  done;virtual;
-         procedure initwriting;virtual;
+         procedure initwriting(Aplace:tcutplace);virtual;
          procedure donewriting;virtual;
          procedure writebytes(var data;len:longint);virtual;
          procedure writealloc(len:longint);virtual;
@@ -65,9 +65,9 @@ unit og386dbg;
       end;
 
 
-    procedure tdbgoutput.initwriting;
+    procedure tdbgoutput.initwriting(Aplace:tcutplace);
       begin
-        inherited initwriting;
+        inherited initwriting(Aplace);
         writeln('initwriting '+Objfile);
       end;
 
@@ -180,7 +180,11 @@ unit og386dbg;
 end.
 {
   $Log$
-  Revision 1.5  1999-08-04 00:23:06  florian
+  Revision 1.6  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.5  1999/08/04 00:23:06  florian
     * renamed i386asm and i386base to cpuasm and cpubase
 
   Revision 1.4  1999/07/03 00:29:53  peter

+ 13 - 1
compiler/pmodules.pas

@@ -62,6 +62,14 @@ unit pmodules;
         { Also create a smartlinked version ? }
         if (cs_create_smart in aktmoduleswitches) then
          begin
+           { regenerate the importssection for win32 }
+           if assigned(importssection) and
+              (target_info.target=target_i386_win32) then
+            begin
+              importssection^.clear;
+              importlib^.generatesmartlib;
+            end;
+
            GenerateAsm(true);
            if target_asm.needar then
              Linker^.MakeStaticLibrary(SmartLinkFilesCnt);
@@ -1438,7 +1446,11 @@ unit pmodules;
 end.
 {
   $Log$
-  Revision 1.160  1999-10-21 14:29:37  peter
+  Revision 1.161  1999-11-02 15:06:57  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.160  1999/10/21 14:29:37  peter
     * redesigned linker object
     + library support for linux (only procedures can be exported)
 

+ 93 - 101
compiler/t_win32.pas

@@ -37,7 +37,7 @@ unit t_win32;
       procedure importprocedure(const func,module:string;index:longint;const name:string);virtual;
       procedure importvariable(const varname,module:string;const name:string);virtual;
       procedure generatelib;virtual;
-      procedure generatesmartlib;
+      procedure generatesmartlib;virtual;
     end;
 
     pexportlibwin32=^texportlibwin32;
@@ -170,33 +170,82 @@ unit t_win32;
          hp1:=pimportlist(current_module^.imports^.first);
          while assigned(hp1) do
            begin
-              importssection^.concat(new(pai_cut,init));
-              codesegment^.concat(new(pai_cut,init));
-            { create header for this importmodule }
-              { Get labels for the sections }
-              getdatalabel(lhead);
-              getdatalabel(lname);
-              getlabel(lidata4);
-              getlabel(lidata5);
-              importssection^.concat(new(pai_section,init(sec_idata2)));
-              importssection^.concat(new(pai_label,init(lhead)));
-              { pointer to procedure names }
-              importssection^.concat(new(pai_const_symbol,init_rva(lidata4)));
-              { two empty entries follow }
-              importssection^.concat(new(pai_const,init_32bit(0)));
-              importssection^.concat(new(pai_const,init_32bit(0)));
-              { pointer to dll name }
-              importssection^.concat(new(pai_const_symbol,init_rva(lname)));
-              { pointer to fixups }
-              importssection^.concat(new(pai_const_symbol,init_rva(lidata5)));
-              { first write the name references }
-              importssection^.concat(new(pai_section,init(sec_idata4)));
-              importssection^.concat(new(pai_const,init_32bit(0)));
-              importssection^.concat(new(pai_label,init(lidata4)));
-              { then the addresses and create also the indirect jump }
-              importssection^.concat(new(pai_section,init(sec_idata5)));
-              importssection^.concat(new(pai_const,init_32bit(0)));
-              importssection^.concat(new(pai_label,init(lidata5)));
+           { Get labels for the sections }
+             getdatalabel(lhead);
+             getdatalabel(lname);
+             getlabel(lidata4);
+             getlabel(lidata5);
+           { create header for this importmodule }
+             importssection^.concat(new(pai_cut,init_begin));
+             importssection^.concat(new(pai_section,init(sec_idata2)));
+             importssection^.concat(new(pai_label,init(lhead)));
+             { pointer to procedure names }
+             importssection^.concat(new(pai_const_symbol,init_rva(lidata4)));
+             { two empty entries follow }
+             importssection^.concat(new(pai_const,init_32bit(0)));
+             importssection^.concat(new(pai_const,init_32bit(0)));
+             { pointer to dll name }
+             importssection^.concat(new(pai_const_symbol,init_rva(lname)));
+             { pointer to fixups }
+             importssection^.concat(new(pai_const_symbol,init_rva(lidata5)));
+             { first write the name references }
+             importssection^.concat(new(pai_section,init(sec_idata4)));
+             importssection^.concat(new(pai_const,init_32bit(0)));
+             importssection^.concat(new(pai_label,init(lidata4)));
+             { then the addresses and create also the indirect jump }
+             importssection^.concat(new(pai_section,init(sec_idata5)));
+             importssection^.concat(new(pai_const,init_32bit(0)));
+             importssection^.concat(new(pai_label,init(lidata5)));
+
+             { create procedures }
+             hp2:=pimported_item(hp1^.imported_items^.first);
+             while assigned(hp2) do
+               begin
+                 { insert cuts }
+                 importssection^.concat(new(pai_cut,init));
+                 { create indirect jump }
+                 if not hp2^.is_var then
+                  begin
+                    getlabel(lcode);
+                    new(r);
+                    reset_reference(r^);
+                    r^.symbol:=lcode;
+                    { place jump in codesegment, insert a code section in the
+                      importsection to reduce the amount of .s files (PFV) }
+                    importssection^.concat(new(pai_section,init(sec_code)));
+{$IfDef GDB}
+                    if (cs_debuginfo in aktmoduleswitches) then
+                     importssection^.concat(new(pai_stab_function_name,init(nil)));
+{$EndIf GDB}
+                    importssection^.concat(new(pai_symbol,initname_global(hp2^.func^,0)));
+                    importssection^.concat(new(paicpu,op_ref(A_JMP,S_NO,r)));
+                    importssection^.concat(new(pai_align,init_op(4,$90)));
+                  end;
+                 { create head link }
+                 importssection^.concat(new(pai_section,init(sec_idata7)));
+                 importssection^.concat(new(pai_const_symbol,init_rva(lhead)));
+                 { fixup }
+                 getlabel(pasmlabel(hp2^.lab));
+                 importssection^.concat(new(pai_section,init(sec_idata4)));
+                 importssection^.concat(new(pai_const_symbol,init_rva(hp2^.lab)));
+                 { add jump field to importsection }
+                 importssection^.concat(new(pai_section,init(sec_idata5)));
+                 if hp2^.is_var then
+                  importssection^.concat(new(pai_symbol,initname_global(hp2^.func^,0)))
+                 else
+                  importssection^.concat(new(pai_label,init(lcode)));
+                  if hp2^.name^<>'' then
+                    importssection^.concat(new(pai_const_symbol,init_rva(hp2^.lab)))
+                  else
+                    importssection^.concat(new(pai_const,init_32bit($80000000 or hp2^.ordnr)));
+                 { finally the import information }
+                 importssection^.concat(new(pai_section,init(sec_idata6)));
+                 importssection^.concat(new(pai_label,init(hp2^.lab)));
+                 importssection^.concat(new(pai_const,init_16bit(hp2^.ordnr)));
+                 importssection^.concat(new(pai_string,init(hp2^.name^+#0)));
+                 importssection^.concat(new(pai_align,init_op(2,0)));
+                 hp2:=pimported_item(hp2^.next);
+               end;
 
               { write final section }
               importssection^.concat(new(pai_cut,init_end));
@@ -209,57 +258,8 @@ unit t_win32;
               { dllname }
               importssection^.concat(new(pai_section,init(sec_idata7)));
               importssection^.concat(new(pai_label,init(lname)));
-              importssection^.concat(new(pai_string,init(hp1^.dllname^+{target_os.sharedlibext+}#0)));
+              importssection^.concat(new(pai_string,init(hp1^.dllname^+#0)));
 
-              { create procedures }
-              hp2:=pimported_item(hp1^.imported_items^.first);
-              while assigned(hp2) do
-                begin
-                  { insert cuts }
-                  importssection^.concat(new(pai_cut,init));
-                  { create indirect jump }
-                  if not hp2^.is_var then
-                   begin
-                     getlabel(lcode);
-                     new(r);
-                     reset_reference(r^);
-                     r^.symbol:=lcode;
-                     { place jump in codesegment, insert a code section in the
-                       importsection to reduce the amount of .s files (PFV) }
-                     importssection^.concat(new(pai_section,init(sec_code)));
-{$IfDef GDB}
-                     if (cs_debuginfo in aktmoduleswitches) then
-                      importssection^.concat(new(pai_stab_function_name,init(nil)));
-{$EndIf GDB}
-                     importssection^.concat(new(pai_align,init_op(4,$90)));
-                     importssection^.concat(new(pai_symbol,initname_global(hp2^.func^,0)));
-                     importssection^.concat(new(paicpu,op_ref(A_JMP,S_NO,r)));
-                   end;
-                  { create head link }
-                  importssection^.concat(new(pai_section,init(sec_idata7)));
-                  importssection^.concat(new(pai_const_symbol,init_rva(lhead)));
-                  { fixup }
-                  getlabel(pasmlabel(hp2^.lab));
-                  importssection^.concat(new(pai_section,init(sec_idata4)));
-                  importssection^.concat(new(pai_const_symbol,init_rva(hp2^.lab)));
-                  { add jump field to importsection }
-                  importssection^.concat(new(pai_section,init(sec_idata5)));
-                  if hp2^.is_var then
-                   importssection^.concat(new(pai_symbol,initname_global(hp2^.func^,0)))
-                  else
-                   importssection^.concat(new(pai_label,init(lcode)));
-                   if hp2^.name^<>'' then
-                     importssection^.concat(new(pai_const_symbol,init_rva(hp2^.lab)))
-                   else
-                     importssection^.concat(new(pai_const,init_32bit($80000000 or hp2^.ordnr)));
-                  { finally the import information }
-                  importssection^.concat(new(pai_section,init(sec_idata6)));
-                  importssection^.concat(new(pai_label,init(hp2^.lab)));
-                  importssection^.concat(new(pai_const,init_16bit(hp2^.ordnr)));
-                  importssection^.concat(new(pai_string,init(hp2^.name^+#0)));
-                  importssection^.concat(new(pai_align,init_op(2,0)));
-                  hp2:=pimported_item(hp2^.next);
-                end;
               hp1:=pimportlist(hp1^.next);
            end;
        end;
@@ -272,26 +272,12 @@ unit t_win32;
          l1,l2,l3,l4 : pasmlabel;
          r : preference;
       begin
-         if (cs_create_smart in aktmoduleswitches) then
-          begin
-            generatesmartlib;
-            exit;
-          end;
-
          hp1:=pimportlist(current_module^.imports^.first);
          while assigned(hp1) do
            begin
-              { Insert cuts for smartlinking }
-              if (cs_create_smart in aktmoduleswitches) then
-                begin
-                  importssection^.concat(new(pai_cut,init));
-                  codesegment^.concat(new(pai_cut,init));
-                end;
-{$IfDef GDB}
-              if (cs_debuginfo in aktmoduleswitches) then
-                codesegment^.concat(new(pai_stab_function_name,init(nil)));
-{$EndIf GDB}
-
+              { align codesegment for the jumps }
+              importssection^.concat(new(pai_section,init(sec_code)));
+              importssection^.concat(new(pai_align,init_op(4,$90)));
               { Get labels for the sections }
               getlabel(l1);
               getlabel(l2);
@@ -335,16 +321,18 @@ unit t_win32;
                 begin
                    if not hp2^.is_var then
                     begin
-                      getdatalabel(l4);
+                      getlabel(l4);
                       { create indirect jump }
                       new(r);
                       reset_reference(r^);
                       r^.symbol:=l4;
                       { place jump in codesegment }
-                      codesegment^.concat(new(pai_align,init_op(4,$90)));
-                      codesegment^.concat(new(pai_symbol,initname_global(hp2^.func^,0)));
-                      codesegment^.concat(new(paicpu,op_ref(A_JMP,S_NO,r)));
+                      importssection^.concat(new(pai_section,init(sec_code)));
+                      importssection^.concat(new(pai_symbol,initname_global(hp2^.func^,0)));
+                      importssection^.concat(new(paicpu,op_ref(A_JMP,S_NO,r)));
+                      importssection^.concat(new(pai_align,init_op(4,$90)));
                       { add jump field to importsection }
+                      importssection^.concat(new(pai_section,init(sec_idata5)));
                       importssection^.concat(new(pai_label,init(l4)));
                     end
                    else
@@ -372,7 +360,7 @@ unit t_win32;
               { create import dll name }
               importssection^.concat(new(pai_section,init(sec_idata7)));
               importssection^.concat(new(pai_label,init(l1)));
-              importssection^.concat(new(pai_string,init(hp1^.dllname^+{target_os.sharedlibext+}#0)));
+              importssection^.concat(new(pai_string,init(hp1^.dllname^+#0)));
 
               hp1:=pimportlist(hp1^.next);
            end;
@@ -1058,7 +1046,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.3  1999-10-28 10:33:06  pierre
+  Revision 1.4  1999-11-02 15:06:58  peter
+    * import library fixes for win32
+    * alignment works again
+
+  Revision 1.3  1999/10/28 10:33:06  pierre
    * Libs can be link serveral times
 
   Revision 1.2  1999/10/22 14:42:40  peter