浏览代码

* factored out code to decide when an asmsym for a staticvarsym has to be
global, and no longer make it global for all symbols when smartlinking
is enabled on systems that use section-based smartlinking

git-svn-id: trunk@22241 -

Jonas Maebe 13 年之前
父节点
当前提交
289486346b
共有 3 个文件被更改,包括 15 次插入11 次删除
  1. 1 6
      compiler/ngenutil.pas
  2. 1 5
      compiler/ptconst.pas
  3. 13 0
      compiler/symsym.pas

+ 1 - 6
compiler/ngenutil.pas

@@ -499,12 +499,7 @@ implementation
         new_section(list,sec_user,sym.section,varalign)
         new_section(list,sec_user,sym.section,varalign)
       else
       else
         new_section(list,sectype,lower(sym.mangledname),varalign);
         new_section(list,sectype,lower(sym.mangledname),varalign);
-      if (sym.owner.symtabletype=globalsymtable) or
-         create_smartlink or
-         DLLSource or
-         (assigned(current_procinfo) and
-          (po_inline in current_procinfo.procdef.procoptions)) or
-         (vo_is_public in sym.varoptions) then
+      if sym.globalasmsym then
         begin
         begin
           { on AIX/stabx, we cannot generate debug information that encodes
           { on AIX/stabx, we cannot generate debug information that encodes
             the address of a global symbol, you need a symbol with the same
             the address of a global symbol, you need a symbol with the same

+ 1 - 5
compiler/ptconst.pas

@@ -137,11 +137,7 @@ implementation
               new_section(list,sec_user,sym.section,const_align(sym.vardef.alignment))
               new_section(list,sec_user,sym.section,const_align(sym.vardef.alignment))
             else
             else
               new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
               new_section(list,cursectype,lower(sym.mangledname),const_align(sym.vardef.alignment));
-            if (sym.owner.symtabletype=globalsymtable) or
-               create_smartlink or
-               (assigned(current_procinfo) and
-                (po_inline in current_procinfo.procdef.procoptions)) or
-               DLLSource then
+            if sym.globalasmsym then
               begin
               begin
                 { see same code in ncgutil.insertbssdata }
                 { see same code in ncgutil.insertbssdata }
                 if (target_dbg.id=dbg_stabx) and
                 if (target_dbg.id=dbg_stabx) and

+ 13 - 0
compiler/symsym.pas

@@ -191,6 +191,7 @@ interface
           inparentfpstruct : boolean;   { migrated to a parentfpstruct because of nested access (not written to ppu, because not important and would change interface crc) }
           inparentfpstruct : boolean;   { migrated to a parentfpstruct because of nested access (not written to ppu, because not important and would change interface crc) }
           constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);
           constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile);
           constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile);
+          function globalasmsym: boolean;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure ppuwrite(ppufile:tcompilerppufile);override;
           procedure buildderef;override;
           procedure buildderef;override;
           procedure deref;override;
           procedure deref;override;
@@ -1551,6 +1552,18 @@ implementation
          ppufile.getderef(defaultconstsymderef);
          ppufile.getderef(defaultconstsymderef);
       end;
       end;
 
 
+    function tabstractnormalvarsym.globalasmsym: boolean;
+      begin
+        result:=
+          (owner.symtabletype=globalsymtable) or
+          (create_smartlink and
+           not(tf_smartlink_sections in target_info.flags)) or
+          DLLSource or
+          (assigned(current_procinfo) and
+           (po_inline in current_procinfo.procdef.procoptions)) or
+          (vo_is_public in varoptions);
+      end;
+
 
 
     procedure tabstractnormalvarsym.buildderef;
     procedure tabstractnormalvarsym.buildderef;
       begin
       begin