Răsfoiți Sursa

Change code so that the condition to use global or local symbol matches
the code written in hlcg.gen_proc_symbol to avoid change from AB_LOCAL
to AB_GLOBAL, which generates erroneous code (at least for targets using GOT)

git-svn-id: trunk@29450 -

pierre 10 ani în urmă
părinte
comite
9b468ba728
1 a modificat fișierele cu 12 adăugiri și 4 ștergeri
  1. 12 4
      compiler/ncgutil.pas

+ 12 - 4
compiler/ncgutil.pas

@@ -1348,10 +1348,18 @@ implementation
         item := TCmdStrListItem(pd.aliasnames.first);
         while assigned(item) do
           begin
-            current_asmdata.DefineAsmSymbol(item.str,AB_GLOBAL,AT_FUNCTION);
-            item := TCmdStrListItem(item.next);
-          end;
-       end;
+            { The condition to use global or local symbol must match
+              the code written in hlcg.gen_proc_symbol to 
+              avoid change from AB_LOCAL to AB_GLOBAL, which generates
+              erroneous code (at least for targets using GOT) } 
+            if (cs_profile in current_settings.moduleswitches) or
+               (po_global in current_procinfo.procdef.procoptions) then
+              current_asmdata.DefineAsmSymbol(item.str,AB_GLOBAL,AT_FUNCTION)
+            else
+              current_asmdata.DefineAsmSymbol(item.str,AB_LOCAL,AT_FUNCTION);
+           item := TCmdStrListItem(item.next);
+         end;
+      end;
 
 
     procedure gen_proc_entry_code(list:TAsmList);