Browse Source

* fixed crashes by forgotten strpnew() for init_symbol

peter 26 years ago
parent
commit
5c3f708222
2 changed files with 28 additions and 14 deletions
  1. 20 10
      compiler/pmodules.pas
  2. 8 4
      compiler/types.pas

+ 20 - 10
compiler/pmodules.pas

@@ -72,14 +72,23 @@ unit pmodules;
     { Insert the used object file for this unit in the used list for this unit }
     { Insert the used object file for this unit in the used list for this unit }
       begin
       begin
         if (cs_create_sharedlib in aktmoduleswitches) then
         if (cs_create_sharedlib in aktmoduleswitches) then
-          current_module^.linksharedlibs.insert(current_module^.sharedlibfilename^)
+          begin
+            current_module^.linksharedlibs.insert(current_module^.sharedlibfilename^);
+            current_module^.flags:=current_module^.flags or uf_shared_linked;
+          end
         else
         else
          begin
          begin
            if (cs_create_staticlib in aktmoduleswitches) or
            if (cs_create_staticlib in aktmoduleswitches) or
               (cs_smartlink in aktmoduleswitches) then
               (cs_smartlink in aktmoduleswitches) then
-             current_module^.linkstaticlibs.insert(current_module^.staticlibfilename^)
+             begin
+               current_module^.linkstaticlibs.insert(current_module^.staticlibfilename^);
+               current_module^.flags:=current_module^.flags or uf_static_linked;
+             end
            else
            else
-             current_module^.linkunitfiles.insert(current_module^.objfilename^);
+             begin
+               current_module^.linkunitfiles.insert(current_module^.objfilename^);
+               current_module^.flags:=current_module^.flags or uf_obj_linked;
+             end;
          end;
          end;
       end;
       end;
 
 
@@ -181,10 +190,10 @@ unit pmodules;
                target_link.binders:=2;
                target_link.binders:=2;
               end;
               end;
              if apptype=at_cui then
              if apptype=at_cui then
-              datasegment^.concat(new(pai_const,init_symbol('_mainCRTStartup')))
+              datasegment^.concat(new(pai_const,init_symbol(strpnew('_mainCRTStartup'))))
              else
              else
               begin
               begin
-               datasegment^.concat(new(pai_const,init_symbol('_WinMainCRTStartup')));
+               datasegment^.concat(new(pai_const,init_symbol(strpnew('_WinMainCRTStartup'))));
                target_link.linkcmd:='--subsystem windows '+target_link.linkcmd;
                target_link.linkcmd:='--subsystem windows '+target_link.linkcmd;
                target_link.bindcmd[2]:='--subsystem windows '+target_link.bindcmd[2];
                target_link.bindcmd[2]:='--subsystem windows '+target_link.bindcmd[2];
               end;
               end;
@@ -1035,9 +1044,7 @@ unit pmodules;
          { insert own objectfile, or say that it's in a library
          { insert own objectfile, or say that it's in a library
            (no check for an .o when loading) }
            (no check for an .o when loading) }
          if is_assembler_generated then
          if is_assembler_generated then
-           insertobjectfile
-         else
-           current_module^.flags:=current_module^.flags or uf_in_library;
+           insertobjectfile;
 
 
          { Write out the ppufile }
          { Write out the ppufile }
          if (status.errorcount=0) then
          if (status.errorcount=0) then
@@ -1178,7 +1185,7 @@ unit pmodules;
          { for browser }
          { for browser }
          current_module^.globalsymtable:=current_module^.localsymtable;
          current_module^.globalsymtable:=current_module^.localsymtable;
          current_module^.localsymtable:=nil;
          current_module^.localsymtable:=nil;
-         
+
          codegen_doneprocedure;
          codegen_doneprocedure;
 
 
          { consume the last point }
          { consume the last point }
@@ -1234,7 +1241,10 @@ unit pmodules;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.96  1999-02-05 08:54:27  pierre
+  Revision 1.97  1999-02-16 00:45:31  peter
+    * fixed crashes by forgotten strpnew() for init_symbol
+
+  Revision 1.96  1999/02/05 08:54:27  pierre
     + linkofiles splitted inot linkofiles and linkunitfiles
     + linkofiles splitted inot linkofiles and linkunitfiles
       because linkofiles must be stored with directory
       because linkofiles must be stored with directory
       to enabled linking of different objects with same name
       to enabled linking of different objects with same name

+ 8 - 4
compiler/types.pas

@@ -1024,12 +1024,13 @@ unit types;
                                   if (procdefcoll^.data^.options and poabstractmethod)<>0 then
                                   if (procdefcoll^.data^.options and poabstractmethod)<>0 then
                                     begin
                                     begin
                                        _class^.options:=_class^.options or oo_is_abstract;
                                        _class^.options:=_class^.options or oo_is_abstract;
-                                       datasegment^.concat(new(pai_const,init_symbol('FPC_ABSTRACTERROR')));
+                                       datasegment^.concat(new(pai_const,
+                                         init_symbol(strpnew('FPC_ABSTRACTERROR'))));
                                     end
                                     end
                                   else
                                   else
                                     begin
                                     begin
-                                      datasegment^.concat(new(pai_const,init_symbol(
-                                        strpnew(procdefcoll^.data^.mangledname))));
+                                      datasegment^.concat(new(pai_const,
+                                        init_symbol(strpnew(procdefcoll^.data^.mangledname))));
                                       maybe_concat_external(procdefcoll^.data^.owner,
                                       maybe_concat_external(procdefcoll^.data^.owner,
                                         procdefcoll^.data^.mangledname);
                                         procdefcoll^.data^.mangledname);
                                     end;
                                     end;
@@ -1061,7 +1062,10 @@ unit types;
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.48  1999-02-09 23:03:08  florian
+  Revision 1.49  1999-02-16 00:45:30  peter
+    * fixed crashes by forgotten strpnew() for init_symbol
+
+  Revision 1.48  1999/02/09 23:03:08  florian
     * check for duplicate field names in inherited classes/objects
     * check for duplicate field names in inherited classes/objects
     * bug with self from the mailing list solved (the problem
     * bug with self from the mailing list solved (the problem
       was that classes were sometimes pushed wrong)
       was that classes were sometimes pushed wrong)