Browse Source

* append rather than insert the alias symbols for the program/procedure
initialisation/finalisation routines
o this ensures the procdef's mangled name and its first symbol match,
which is required for Darwin when generating debug information and
using ".set" directives to define alias symbols, because a symbol
defined via ".set" cannot be used in a data relocations (and the DWARF
debug generator uses the default mangled name, which used to correspond
to the alias symbol due to the "insert" instead of "append")

git-svn-id: trunk@42094 -

Jonas Maebe 6 years ago
parent
commit
8ec3cd6390
1 changed files with 9 additions and 9 deletions
  1. 9 9
      compiler/pmodules.pas

+ 9 - 9
compiler/pmodules.pas

@@ -728,14 +728,14 @@ implementation
           mf_init :
           mf_init :
             begin
             begin
               result:=create_main_proc(make_mangledname('',current_module.localsymtable,'init_implicit$'),potype_unitinit,st);
               result:=create_main_proc(make_mangledname('',current_module.localsymtable,'init_implicit$'),potype_unitinit,st);
-              result.procdef.aliasnames.insert(make_mangledname('INIT$',current_module.localsymtable,''));
+              result.procdef.aliasnames.concat(make_mangledname('INIT$',current_module.localsymtable,''));
             end;
             end;
           mf_finalize :
           mf_finalize :
             begin
             begin
               result:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize_implicit$'),potype_unitfinalize,st);
               result:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize_implicit$'),potype_unitfinalize,st);
-              result.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
+              result.procdef.aliasnames.concat(make_mangledname('FINALIZE$',current_module.localsymtable,''));
               if (not current_module.is_unit) then
               if (not current_module.is_unit) then
-                result.procdef.aliasnames.insert('PASCALFINALIZE');
+                result.procdef.aliasnames.concat('PASCALFINALIZE');
             end;
             end;
           else
           else
             internalerror(200304253);
             internalerror(200304253);
@@ -1080,7 +1080,7 @@ type
 
 
              { Compile the unit }
              { Compile the unit }
              init_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'init$'),potype_unitinit,current_module.localsymtable);
              init_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'init$'),potype_unitinit,current_module.localsymtable);
-             init_procinfo.procdef.aliasnames.insert(make_mangledname('INIT$',current_module.localsymtable,''));
+             init_procinfo.procdef.aliasnames.concat(make_mangledname('INIT$',current_module.localsymtable,''));
              init_procinfo.parse_body;
              init_procinfo.parse_body;
              { save file pos for debuginfo }
              { save file pos for debuginfo }
              current_module.mainfilepos:=init_procinfo.entrypos;
              current_module.mainfilepos:=init_procinfo.entrypos;
@@ -1090,7 +1090,7 @@ type
                begin
                begin
                  { Compile the finalize }
                  { Compile the finalize }
                  finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize$'),potype_unitfinalize,current_module.localsymtable);
                  finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize$'),potype_unitfinalize,current_module.localsymtable);
-                 finalize_procinfo.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
+                 finalize_procinfo.procdef.aliasnames.concat(make_mangledname('FINALIZE$',current_module.localsymtable,''));
                  finalize_procinfo.parse_body;
                  finalize_procinfo.parse_body;
                end
                end
            end;
            end;
@@ -2127,9 +2127,9 @@ type
             main_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,current_module.localsymtable);
             main_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,current_module.localsymtable);
             { Win32 startup code needs a single name }
             { Win32 startup code needs a single name }
             if not(target_info.system in (systems_darwin+systems_aix)) then
             if not(target_info.system in (systems_darwin+systems_aix)) then
-              main_procinfo.procdef.aliasnames.insert('PASCALMAIN')
+              main_procinfo.procdef.aliasnames.concat('PASCALMAIN')
             else
             else
-              main_procinfo.procdef.aliasnames.insert(target_info.Cprefix+'PASCALMAIN');
+              main_procinfo.procdef.aliasnames.concat(target_info.Cprefix+'PASCALMAIN');
 
 
             { ToDo: systems that use indirect entry info, but check back with Windows! }
             { ToDo: systems that use indirect entry info, but check back with Windows! }
             if target_info.system in systems_darwin then
             if target_info.system in systems_darwin then
@@ -2161,7 +2161,7 @@ type
          else
          else
            begin
            begin
              main_procinfo:=create_main_proc(mainaliasname,potype_proginit,current_module.localsymtable);
              main_procinfo:=create_main_proc(mainaliasname,potype_proginit,current_module.localsymtable);
-             main_procinfo.procdef.aliasnames.insert('PASCALMAIN');
+             main_procinfo.procdef.aliasnames.concat('PASCALMAIN');
            end;
            end;
          main_procinfo.parse_body;
          main_procinfo.parse_body;
          { save file pos for debuginfo }
          { save file pos for debuginfo }
@@ -2173,7 +2173,7 @@ type
               { Parse the finalize }
               { Parse the finalize }
               finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize$'),potype_unitfinalize,current_module.localsymtable);
               finalize_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,'finalize$'),potype_unitfinalize,current_module.localsymtable);
               finalize_procinfo.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
               finalize_procinfo.procdef.aliasnames.insert(make_mangledname('FINALIZE$',current_module.localsymtable,''));
-              finalize_procinfo.procdef.aliasnames.insert('PASCALFINALIZE');
+              finalize_procinfo.procdef.aliasnames.concat('PASCALFINALIZE');
               finalize_procinfo.parse_body;
               finalize_procinfo.parse_body;
            end;
            end;