Browse Source

+ Two more checks for access to global data and setting the pi_needs_got flag, intended for targets that require decision about PIC code generation strictly before pass 2.

git-svn-id: trunk@26292 -
sergei 11 years ago
parent
commit
1a3b46967e
1 changed files with 18 additions and 0 deletions
  1. 18 0
      compiler/ncal.pas

+ 18 - 0
compiler/ncal.pas

@@ -698,6 +698,19 @@ implementation
            (left.nodetype<>nothingn) then
           handlemanagedbyrefpara(left.resultdef);
 
+        { does it need to load RTTI? }
+        if assigned(parasym) and (parasym.varspez=vs_out) and
+           (cs_create_pic in current_settings.moduleswitches) and
+           (
+             is_rtti_managed_type(left.resultdef) or
+             (
+               is_open_array(resultdef) and
+               is_managed_type(tarraydef(resultdef).elementdef)
+             )
+           ) and
+           not(target_info.system in systems_garbage_collected_managed_types) then
+          include(current_procinfo.flags,pi_needs_got);
+
         if assigned(fparainit) then
           firstpass(fparainit);
         firstpass(left);
@@ -3568,6 +3581,11 @@ implementation
             ([cnf_member_call,cnf_inherited] * callnodeflags <> []) then
            current_procinfo.ConstructorCallingConstructor:=true;
 
+         { object check helper will load VMT -> needs GOT }
+         if (cs_check_object in current_settings.localswitches) and
+            (cs_create_pic in current_settings.moduleswitches) then
+           include(current_procinfo.flags,pi_needs_got);
+
          { Continue with checking a normal call or generate the inlined code }
          if cnf_do_inline in callnodeflags then
            result:=pass1_inline