Browse Source

* nasm works (linux only tested)

peter 27 years ago
parent
commit
f3d93555d8
5 changed files with 62 additions and 43 deletions
  1. 23 29
      compiler/ag386int.pas
  2. 10 2
      compiler/assemble.pas
  3. 13 7
      compiler/cgi386.pas
  4. 5 2
      compiler/cgi386ad.inc
  5. 11 3
      compiler/types.pas

+ 23 - 29
compiler/ag386int.pas

@@ -337,13 +337,13 @@ unit ag386int;
      ait_datablock : begin
                        if current_module^.output_format in [of_nasm,of_obj] then
                         begin
-                          if pai_symbol(hp)^.is_global then
+                          if pai_datablock(hp)^.is_global then
                            AsmWriteLn('GLOBAL '+StrPas(pai_datablock(hp)^.name));
                           AsmWriteLn(PadTabs(pai_datablock(hp)^.name,':')+'RESB'#9+tostr(pai_datablock(hp)^.size));
                         end
                        else
                         begin
-                          if pai_symbol(hp)^.is_global then
+                          if pai_datablock(hp)^.is_global then
                            AsmWriteLn(#9#9'PUBLIC'#9+StrPas(pai_datablock(hp)^.name));
                           AsmWriteLn(PadTabs(pai_datablock(hp)^.name,#0)+'DB'#9+tostr(pai_datablock(hp)^.size)+' DUP(?)');
                         end;
@@ -393,13 +393,13 @@ unit ag386int;
                      end;
           ait_comp : AsmWriteLn(#9#9'DQ'#9+comp2str(pai_extended(hp)^.value));
         ait_string : begin
-                  counter := 0;
-                  lines := pai_string(hp)^.len div line_length;
-                  { separate lines in different parts }
-                  if pai_string(hp)^.len > 0 then
-                      Begin
-                        for j := 0 to lines-1 do
-                          begin
+                       counter := 0;
+                       lines := pai_string(hp)^.len div line_length;
+                     { separate lines in different parts }
+                       if pai_string(hp)^.len > 0 then
+                        Begin
+                          for j := 0 to lines-1 do
+                           begin
                              AsmWrite(#9#9'DB'#9);
                              quoted:=false;
                              for i:=counter to counter+line_length do
@@ -503,15 +503,15 @@ ait_labeled_instruction :
                      end;
    ait_instruction : begin
                        suffix:='';
-                       { added prefix instructions      }
-                       { must be on same line as opcode }
+                       prefix:= '';
+                     { added prefix instructions, must be on same line as opcode }
                        if (pai386(hp)^.op1t = top_none) and
                           ((pai386(hp)^._operator = A_REP) or
                            (pai386(hp)^._operator = A_LOCK) or
                            (pai386(hp)^._operator =  A_REPE) or
                            (pai386(hp)^._operator = A_REPNE)) then
                         Begin
-                          prefix:=int_op2str[pai386(hp)^._operator]+' ';
+                          prefix:=int_op2str[pai386(hp)^._operator]+#9;
                           hp:=Pai(hp^.next);
                         { this is theorically impossible... }
                           if hp=nil then
@@ -520,9 +520,7 @@ ait_labeled_instruction :
                              AsmWriteLn(s);
                              break;
                            end;
-                        end
-                       else
-                        prefix:= '';
+                        end;
                        if pai386(hp)^.op1t<>top_none then
                         begin
                           if pai386(hp)^._operator in [A_CALL] then
@@ -570,12 +568,12 @@ ait_labeled_instruction :
                               S_L: suffix:='d';
                              else
                               Message(assem_f_invalid_suffix_intel);
+                             end;
                            end;
-                         end;
-                        s:='';
-                      end;
-                     AsmWriteLn(#9#9+int_op2str[pai386(hp)^._operator]+s);
-                   end;
+                          s:='';
+                        end;
+                       AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^._operator]+suffix+s);
+                     end;
 {$ifdef GDB}
              ait_stabn,
              ait_stabs,
@@ -584,13 +582,6 @@ ait_stab_function_name : ;
          else
           internalerror(10000);
          end;
-       { we only write a line if not a variable otherwise might }
-       { cause some problems.                                   }
-  {     if ((hp^.typ<>ait_label) and (hp^.typ<>ait_symbol)) or
-           (assigned(hp^.next) and not(pai(hp^.next)^.typ in
-          [ait_const_32bit,ait_const_16bit,ait_const_8bit,
-           ait_const_symbol,ait_real_64bit,ait_real_extended,ait_string,ait_comp])) then
-             AsmWrite(target_info.newline);}
          hp:=pai(hp^.next);
        end;
     end;
@@ -670,8 +661,11 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:16  root
-  Initial revision
+  Revision 1.2  1998-04-08 11:34:17  peter
+    * nasm works (linux only tested)
+
+  Revision 1.1.1.1  1998/03/25 11:18:16  root
+  * Restored version
 
   Revision 1.1  1998/03/10 01:26:09  peter
     + new uniform names

+ 10 - 2
compiler/assemble.pas

@@ -377,8 +377,13 @@ begin
                RemoveAsm;
             end;
   of_nasm : begin
+            {$ifdef linux}
+              if CallAssembler(FindAssembler(of_nasm),' -f elf -o '+objfile+' '+asmfile) then
+               RemoveAsm;
+            {$else}
               if CallAssembler(FindAssembler(of_nasm),' -f coff -o '+objfile+' '+asmfile) then
                RemoveAsm;
+            {$endif}
             end;
    of_obj : begin
               if CallAssembler(FindAssembler(of_nasm),' -f obj -o '+objfile+' '+asmfile) then
@@ -405,8 +410,11 @@ end;
 end.
 {
   $Log$
-  Revision 1.1  1998-03-25 11:18:16  root
-  Initial revision
+  Revision 1.2  1998-04-08 11:34:18  peter
+    * nasm works (linux only tested)
+
+  Revision 1.1.1.1  1998/03/25 11:18:16  root
+  * Restored version
 
   Revision 1.17  1998/03/10 13:23:00  florian
     * small win32 problems fixed

+ 13 - 7
compiler/cgi386.pas

@@ -4328,13 +4328,16 @@ implementation
                             {We won't do a second pass on p^.right, because
                              this will emit the constant set.}
                             {If register is used, use only lower 8 bits}
+                            if p^.left^.location.loc in [LOC_REGISTER,LOC_CREGISTER] then
+                             begin
+                               if p^.left^.location.register in [R_AL..R_DH] then
+                                 exprasmlist^.concat(new(pai386,op_const_reg(
+                                   A_AND,S_B,255,p^.left^.location.register)))
+                               else
 
-                            case p^.left^.location.loc of
-                               LOC_REGISTER,
-                               LOC_CREGISTER :
-                                 exprasmlist^.concat(new(pai386,op_const_reg(A_AND,S_B,
-                                   255,p^.left^.location.register)));
-                            end;
+                                 exprasmlist^.concat(new(pai386,op_const_reg(
+                                   A_AND,S_L,255,p^.left^.location.register)));
+                             end;
                             {Get a label to jump to the end.}
                             p^.location.loc:=LOC_FLAGS;
                             {It's better to use the zero flag when there are
@@ -5706,7 +5709,10 @@ do_jmp:
 end.
 {
   $Log$
-  Revision 1.5  1998-04-07 22:45:04  florian
+  Revision 1.6  1998-04-08 11:34:20  peter
+    * nasm works (linux only tested)
+
+  Revision 1.5  1998/04/07 22:45:04  florian
     * bug0092, bug0115 and bug0121 fixed
     + packed object/class/array
 

+ 5 - 2
compiler/cgi386ad.inc

@@ -1000,7 +1000,7 @@
                       begin
                          if not(R_EAX in unused) then
                            emit_reg_reg(A_MOV,S_L,R_EAX,R_EDI);
-                         exprasmlist^.concat(new(pai386,op_reg(A_FNSTS,S_W,R_AX)));
+                         exprasmlist^.concat(new(pai386,op_reg(A_FNSTSW,S_NO,R_AX)));
                          exprasmlist^.concat(new(pai386,op_none(A_SAHF,S_NO)));
                          if not(R_EAX in unused) then
                            emit_reg_reg(A_MOV,S_L,R_EDI,R_EAX);
@@ -1234,7 +1234,10 @@
 
 {
      $Log$
-     Revision 1.2  1998-03-28 23:09:55  florian
+     Revision 1.3  1998-04-08 11:34:22  peter
+       * nasm works (linux only tested)
+
+     Revision 1.2  1998/03/28 23:09:55  florian
        * secondin bugfix (m68k and i386)
        * overflow checking bugfix (m68k and i386) -- pretty useless in
          secondadd, since everything is done using 32-bit

+ 11 - 3
compiler/types.pas

@@ -838,8 +838,13 @@ unit types;
                                        datasegment^.concat(new(pai_const,init_symbol('ABSTRACTERROR')));
                                     end
                                   else
-                                    datasegment^.concat(new(pai_const,init_symbol(
-                                      strpnew(procdefcoll^.data^.mangledname))));
+                                    begin
+                                      datasegment^.concat(new(pai_const,init_symbol(
+                                        strpnew(procdefcoll^.data^.mangledname))));
+                                      if (procdefcoll^.data^.options and povirtualmethod)<>0 then
+                                        maybe_concat_external(procdefcoll^.data^.owner,
+                                          procdefcoll^.data^.mangledname);
+                                    end;
                                end;
                           end;
                         procdefcoll:=procdefcoll^.next;
@@ -868,7 +873,10 @@ unit types;
 end.
 {
   $Log$
-  Revision 1.2  1998-03-28 23:09:57  florian
+  Revision 1.3  1998-04-08 11:34:22  peter
+    * nasm works (linux only tested)
+
+  Revision 1.2  1998/03/28 23:09:57  florian
     * secondin bugfix (m68k and i386)
     * overflow checking bugfix (m68k and i386) -- pretty useless in
       secondadd, since everything is done using 32-bit