Quellcode durchsuchen

* fixes for win32 mangledname

peter vor 21 Jahren
Ursprung
Commit
87d2861f89

+ 2 - 2
compiler/Makefile

@@ -1,5 +1,5 @@
 #
-# Don't edit, this file is generated by FPCMake Version 1.1 [2004/11/08]
+# Don't edit, this file is generated by FPCMake Version 1.1 [2004/11/03]
 #
 default: all
 MAKEFILETARGETS=linux go32v2 win32 os2 freebsd beos netbsd amiga atari sunos qnx netware openbsd wdosx palmos macos darwin emx watcom morphos netwlibc
@@ -1917,7 +1917,7 @@ $(addsuffix _clean,$(CYCLETARGETS)):
 	-$(DELTREE) $(addprefix $(subst _clean,,$@),/units)
 	-$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
 	-$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
-cycleclean: cleanall
+cycleclean: cleanall $(addsuffix _clean,$(PPC_TARGET))
 	-$(DEL) $(EXENAME)
 clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))
 distclean: tempclean execlean cleanall $(addsuffix _clean,$(CYCLETARGETS)) $(addsuffix _distclean,$(TARGET_DIRS))

+ 1 - 1
compiler/Makefile.fpc

@@ -297,7 +297,7 @@ $(addsuffix _clean,$(CYCLETARGETS)):
         -$(DEL) $(addprefix $(subst _clean,,$@)/,*$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT))
         -$(DEL) $(addprefix $(subst _clean,,$@)/,ppc386$(EXEEXT) ppcaxp$(EXEEXT) ppc68k$(EXEEXT) ppcx64$(EXEEXT) ppcppc$(EXEEXT) ppcppc$(EXEEXT) $(EXENAME))
 
-cycleclean: cleanall
+cycleclean: cleanall $(addsuffix _clean,$(PPC_TARGET))
         -$(DEL) $(EXENAME)
 
 clean: tempclean execlean cleanall $(addsuffix _clean,$(PPC_TARGET)) $(addsuffix _clean,$(TARGET_DIRS))

+ 4 - 3
compiler/pdecl.pas

@@ -213,7 +213,6 @@ implementation
                        end;
                       { add default calling convention }
                       handle_calling_convention(tabstractprocdef(tt.def));
-                      calc_parast(tprocvardef(tt.def));
                     end;
                    if not skipequal then
                     begin
@@ -488,7 +487,6 @@ implementation
                         consume(_SEMICOLON);
                        parse_var_proc_directives(tsym(newtype));
                        handle_calling_convention(tprocvardef(tt.def));
-                       calc_parast(tprocvardef(tt.def));
                      end;
                   end;
                 objectdef,
@@ -653,7 +651,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.91  2004-11-15 23:35:31  peter
+  Revision 1.92  2004-11-16 20:32:40  peter
+  * fixes for win32 mangledname
+
+  Revision 1.91  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 4 - 4
compiler/pdecobj.pas

@@ -594,7 +594,6 @@ implementation
                      begin
                        parse_object_proc_directives(pd);
                        handle_calling_convention(pd);
-                       calc_parast(pd);
 
                        { add definition to procsym }
                        proc_add_definition(pd);
@@ -637,7 +636,6 @@ implementation
                     pd:=constructor_head;
                     parse_object_proc_directives(pd);
                     handle_calling_convention(pd);
-                    calc_parast(pd);
 
                     { add definition to procsym }
                     proc_add_definition(pd);
@@ -677,7 +675,6 @@ implementation
                     pd:=destructor_head;
                     parse_object_proc_directives(pd);
                     handle_calling_convention(pd);
-                    calc_parast(pd);
 
                     { add definition to procsym }
                     proc_add_definition(pd);
@@ -733,7 +730,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.82  2004-10-15 09:14:17  mazen
+  Revision 1.83  2004-11-16 20:32:40  peter
+  * fixes for win32 mangledname
+
+  Revision 1.82  2004/10/15 09:14:17  mazen
   - remove $IFDEF DELPHI and related code
   - remove $IFDEF FPCPROCVAR and related code
 

+ 13 - 14
compiler/pdecsub.pas

@@ -44,8 +44,6 @@ interface
 
     function  check_proc_directive(isprocvar:boolean):boolean;
 
-    procedure calc_parast(pd:tabstractprocdef);
-
     procedure insert_funcret_local(pd:tprocdef);
 
     function  proc_add_definition(var pd:tprocdef):boolean;
@@ -1886,29 +1884,27 @@ const
           convention is set. }
         pd.parast.foreach_static(@set_addr_param_regable,pd);
 
-        { add mangledname to external list }
-        if (pd.deftype=procdef) and
-           (po_external in pd.procoptions) and
-           target_info.DllScanSupported then
-          current_module.externals.insert(tExternalsItem.create(tprocdef(pd).mangledname));
-      end;
-
-
-    procedure calc_parast(pd:tabstractprocdef);
-      begin
         { insert hidden high parameters }
         pd.parast.foreach_static(@insert_hidden_para,pd);
+
         { insert hidden self parameter }
         insert_self_and_vmt_para(pd);
+
         { insert funcret parameter if required }
         insert_funcret_para(pd);
+
         { insert parentfp parameter if required }
         insert_parentfp_para(pd);
 
         { Calculate parameter tlist }
         pd.calcparas;
-      end;
 
+        { add mangledname to external list, must be done after pd.calcparas }
+        if (pd.deftype=procdef) and
+           (po_external in pd.procoptions) and
+           target_info.DllScanSupported then
+          current_module.externals.insert(tExternalsItem.create(tprocdef(pd).mangledname));
+      end;
 
 
     procedure parse_proc_directives(pd:tabstractprocdef;var pdflags:tpdflags);
@@ -2267,7 +2263,10 @@ const
 end.
 {
   $Log$
-  Revision 1.205  2004-11-15 23:35:31  peter
+  Revision 1.206  2004-11-16 20:32:40  peter
+  * fixes for win32 mangledname
+
+  Revision 1.205  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 4 - 5
compiler/pdecvar.pas

@@ -395,7 +395,6 @@ implementation
                      readprocdef.rettype:=p.proptype;
                      { Insert hidden parameters }
                      handle_calling_convention(readprocdef);
-                     calc_parast(readprocdef);
                      { search procdefs matching readprocdef }
                      { we ignore hidden stuff here because the property access symbol might have
                        non default calling conventions which might change the hidden stuff;
@@ -443,7 +442,6 @@ implementation
                      writeprocdef.parast.insert(hparavs);
                      { Insert hidden parameters }
                      handle_calling_convention(writeprocdef);
-                     calc_parast(writeprocdef);
                      { search procdefs matching writeprocdef }
                      p.writeaccess.procdef:=Tprocsym(sym).search_procdef_bypara(writeprocdef.paras,writeprocdef.rettype.def,[cpo_allowdefaults,cpo_allowconvert]);
                      if not assigned(p.writeaccess.procdef) then
@@ -962,7 +960,6 @@ implementation
                        begin
                          { Add calling convention for procvar }
                          handle_calling_convention(tprocvardef(tt.def));
-                         calc_parast(tprocvardef(tt.def));
                        end;
                      read_default_value(sc,tt,is_threadvar);
                      { for locals we've created typedconstsym with a different name }
@@ -989,7 +986,6 @@ implementation
                    end;
                  { Add calling convention for procvar }
                  handle_calling_convention(tprocvardef(tt.def));
-                 calc_parast(tprocvardef(tt.def));
                  { Handling of Delphi typed const = initialized vars }
                  if (token=_EQUAL) and
                     not(is_record or is_object) and
@@ -1310,7 +1306,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.84  2004-11-15 23:35:31  peter
+  Revision 1.85  2004-11-16 20:32:40  peter
+  * fixes for win32 mangledname
+
+  Revision 1.84  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 5 - 2
compiler/pmodules.pas

@@ -798,7 +798,7 @@ implementation
         pd.forwarddef:=false;
         pd.setmangledname(target_info.cprefix+name);
         pd.aliasnames.insert(pd.mangledname);
-        calc_parast(pd);
+        handle_calling_convention(pd);
         { We don't need is a local symtable. Change it into the static
           symtable }
         pd.localst.free;
@@ -1521,7 +1521,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.174  2004-11-15 23:35:31  peter
+  Revision 1.175  2004-11-16 20:32:40  peter
+  * fixes for win32 mangledname
+
+  Revision 1.174  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 4 - 5
compiler/psub.pas

@@ -1174,10 +1174,6 @@ implementation
          { Set calling convention }
          handle_calling_convention(pd);
 
-         { everything of the proc definition is known, we can now
-           calculate the parameters }
-         calc_parast(pd);
-
          { search for forward declarations }
          if not proc_add_definition(pd) then
            begin
@@ -1402,7 +1398,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.215  2004-11-15 23:35:31  peter
+  Revision 1.216  2004-11-16 20:32:41  peter
+  * fixes for win32 mangledname
+
+  Revision 1.215  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 4 - 2
compiler/ptype.pas

@@ -646,7 +646,6 @@ implementation
                       end;
                     { Add implicit hidden parameters and function result }
                     handle_calling_convention(pd);
-                    calc_parast(pd);
                   end;
               end;
             else
@@ -659,7 +658,10 @@ implementation
 end.
 {
   $Log$
-  Revision 1.70  2004-11-15 23:35:31  peter
+  Revision 1.71  2004-11-16 20:32:41  peter
+  * fixes for win32 mangledname
+
+  Revision 1.70  2004/11/15 23:35:31  peter
     * tparaitem removed, use tparavarsym instead
     * parameter order is now calculated from paranr value in tparavarsym
 

+ 39 - 25
compiler/systems/t_win32.pas

@@ -121,9 +121,9 @@ implementation
          hp2 : twin32imported_item;
          hs  : string;
       begin
-         { force the current mangledname }
-         if assigned(aprocdef) then
-           aprocdef.has_mangledname:=true;
+         { procdef or funcname must be give, not both }
+         if assigned(aprocdef) and (func<>'') then
+           internalerror(200411161);
          { append extension if required }
          hs:=AddExtension(module,target_info.sharedlibext);
          { search for the module }
@@ -141,13 +141,26 @@ implementation
               current_module.imports.concat(hp1);
            end;
          { search for reuse of old import item }
-         hp2:=twin32imported_item(hp1.imported_items.first);
-         while assigned(hp2) do
-          begin
-            if hp2.func^=func then
-             break;
-            hp2:=twin32imported_item(hp2.next);
-          end;
+         if assigned(aprocdef) then
+           begin
+             hp2:=twin32imported_item(hp1.imported_items.first);
+             while assigned(hp2) do
+              begin
+                if hp2.procdef=aprocdef then
+                 break;
+                hp2:=twin32imported_item(hp2.next);
+              end;
+           end
+         else
+           begin
+             hp2:=twin32imported_item(hp1.imported_items.first);
+             while assigned(hp2) do
+              begin
+                if hp2.func^=func then
+                 break;
+                hp2:=twin32imported_item(hp2.next);
+              end;
+           end;
          if not assigned(hp2) then
           begin
             hp2:=twin32imported_item.create(func,name,index);
@@ -159,7 +172,7 @@ implementation
 
     procedure timportlibwin32.importprocedure(aprocdef:tprocdef;const module : string;index : longint;const name : string);
       begin
-        win32importproc(aprocdef,aprocdef.mangledname,module,index,name);
+        win32importproc(aprocdef,'',module,index,name);
       end;
 
 
@@ -294,17 +307,16 @@ implementation
                     if (cs_debuginfo in aktmoduleswitches) then
                      importsSection.concat(Tai_stab_function_name.Create(nil));
 {$EndIf GDB}
-                    importsSection.concat(Tai_symbol.Createname_global(hp2.func^,AT_FUNCTION,0));
+                    if assigned(hp2.procdef) then
+                      mangledstring:=hp2.procdef.mangledname
+                    else
+                      mangledstring:=hp2.func^;
+                    importsSection.concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0));
                     importsSection.concat(Taicpu.Op_ref(A_JMP,S_NO,href));
                     importsSection.concat(Tai_align.Create_op(4,$90));
 {$IfDef GDB}
                     if (cs_debuginfo in aktmoduleswitches) and assigned(hp2.procdef) then
-                     begin
-                       mangledstring:=hp2.procdef.mangledname;
-                       hp2.procdef.setmangledname(hp2.func^);
                        hp2.procdef.concatstabto(importssection);
-                       hp2.procdef.setmangledname(mangledstring);
-                     end;
 {$EndIf GDB}
                   end;
                  { create head link }
@@ -452,17 +464,16 @@ implementation
                       if (cs_debuginfo in aktmoduleswitches) then
                         importssection.concat(tai_stab_function_name.create(nil));
 {$EndIf GDB}
-                      importsSection.concat(Tai_symbol.Createname_global(hp2.func^,AT_FUNCTION,0));
+                      if assigned(hp2.procdef) then
+                        mangledstring:=hp2.procdef.mangledname
+                      else
+                        mangledstring:=hp2.func^;
+                      importsSection.concat(Tai_symbol.Createname_global(mangledstring,AT_FUNCTION,0));
                       importsSection.concat(Taicpu.Op_ref(A_JMP,S_NO,href));
                       importsSection.concat(Tai_align.Create_op(4,$90));
 {$IfDef GDB}
                       if (cs_debuginfo in aktmoduleswitches) and assigned(hp2.procdef) then
-                       begin
-                         mangledstring:=hp2.procdef.mangledname;
-                         hp2.procdef.setmangledname(hp2.func^);
-                         hp2.procdef.concatstabto(importssection);
-                         hp2.procdef.setmangledname(mangledstring);
-                       end;
+                        hp2.procdef.concatstabto(importssection);
 {$EndIf GDB}
                       { add jump field to imporTSection }
                       new_section(importsSection,sec_idata5,'',0);
@@ -1612,7 +1623,10 @@ initialization
 end.
 {
   $Log$
-  Revision 1.42  2004-11-08 22:09:59  peter
+  Revision 1.43  2004-11-16 20:32:41  peter
+  * fixes for win32 mangledname
+
+  Revision 1.42  2004/11/08 22:09:59  peter
     * tvarsym splitted
 
   Revision 1.41  2004/11/04 17:12:52  peter