瀏覽代碼

+ system_x86_64_darwin identifier
+ systems_darwin set which collects all darwin variants
+ added support for darwin/ppc64 and darwin/x86_64 where needed in
the generic code

git-svn-id: branches/fpc_2_3@6404 -

Jonas Maebe 18 年之前
父節點
當前提交
4b38989ea0

+ 1 - 1
compiler/aasmdata.pas

@@ -282,7 +282,7 @@ implementation
         for hal:=low(TAsmListType) to high(TAsmListType) do
           AsmLists[hal]:=TAsmList.create;
         { PIC data }
-        if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+        if (target_info.system in systems_darwin) then
           AsmLists[al_picdata].concat(tai_directive.create(asd_non_lazy_symbol_pointer,''));
         { CFI }
         FAsmCFI:=CAsmCFI.Create;

+ 14 - 10
compiler/aggas.pas

@@ -284,7 +284,7 @@ implementation
         secname : string;
       begin
         if (cs_create_pic in current_settings.moduleswitches) and
-           not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+           not(target_info.system in systems_darwin) then
           secname:=secnames_pic[atype]
         else
           secname:=secnames[atype];
@@ -306,7 +306,7 @@ implementation
         { For bss we need to set some flags that are target dependent,
           it is easier to disable it for smartlinking. It doesn't take up
           filespace }
-        if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
+        if not(target_info.system in systems_darwin) and
            use_smartlink_section and
            (aname<>'') and
            (atype <> sec_toc) and
@@ -338,7 +338,9 @@ implementation
          system_m68k_amiga,  { amiga has old GNU AS (2.14), which blews up from .section (KB) }
          system_m68k_linux: ;
          system_powerpc_darwin,
-         system_i386_darwin:
+         system_i386_darwin,
+         system_powerpc64_darwin,
+         system_x86_64_darwin:
            begin
              if (atype = sec_stub) then
                AsmWrite('.section ');
@@ -358,10 +360,12 @@ implementation
                 { there are processor-independent shortcuts available    }
                 { for this, namely .symbol_stub and .picsymbol_stub, but }
                 { they don't work and gcc doesn't use them either...     }
-                system_powerpc_darwin:
+                system_powerpc_darwin,
+                system_powerpc64_darwin:
                   AsmWriteln('__TEXT,__symbol_stub1,symbol_stubs,pure_instructions,16');
                 system_i386_darwin:
                   AsmWriteln('__IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5');
+                { darwin/x86-64 uses RIP-based GOT addressing }
                 else
                   internalerror(2006031101);
               end;
@@ -547,7 +551,7 @@ implementation
              begin
                if tai_align_abstract(hp).aligntype>1 then
                  begin
-                   if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+                   if not(target_info.system in systems_darwin) then
                      begin
                        AsmWrite(#9'.balign '+tostr(tai_align_abstract(hp).aligntype));
                        if tai_align_abstract(hp).use_op then
@@ -585,7 +589,7 @@ implementation
 
            ait_datablock :
              begin
-               if target_info.system in [system_powerpc_darwin,system_i386_darwin] then
+               if (target_info.system in systems_darwin) then
                  begin
                    {On Mac OS X you can't have common symbols in a shared
                     library, since those are in the TEXT section and the text section is
@@ -676,7 +680,7 @@ implementation
                  aitconst_rva_symbol,
                  aitconst_indirect_symbol :
                    begin
-                     if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
+                     if (target_info.system in systems_darwin) and
                         (tai_const(hp).consttype in [aitconst_uleb128bit,aitconst_sleb128bit]) then
                        begin
                          AsmWrite(ait_const2str[aitconst_8bit]);
@@ -697,7 +701,7 @@ implementation
                              begin
                                if assigned(tai_const(hp).endsym) then
                                  begin
-                                   if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+                                   if (target_info.system in systems_darwin) then
                                      begin
                                        s := NextSetLabel;
                                        t := #9'.set '+s+','+tai_const(hp).endsym.name+'-'+tai_const(hp).sym.name;
@@ -1074,7 +1078,7 @@ implementation
       Result doesn't work properly yet due to a bug in Apple's linker
 
       if (cs_create_smart in current_settings.moduleswitches) and
-         (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+         (target_info.system in systems_darwin) then
         AsmWriteLn(#9'.subsections_via_symbols');
 }
 
@@ -1092,7 +1096,7 @@ implementation
 
     function TAppleGNUAssembler.sectionname(atype:TAsmSectiontype;const aname:string;aorder:TAsmSectionOrder):string;
       begin
-        if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+        if (target_info.system in systems_darwin) then
           case atype of
             sec_bss:
               { all bss (lcomm) symbols are automatically put in the right }

+ 2 - 1
compiler/cgobj.pas

@@ -3196,7 +3196,8 @@ implementation
         case target_info.system of
           system_powerpc_darwin,
           system_i386_darwin,
-          system_powerpc64_darwin:
+          system_powerpc64_darwin,
+          system_x86_64_darwin:
             begin
               l:=current_asmdata.getasmsymbol('L'+symname+'$non_lazy_ptr');
               if not(assigned(l)) then

+ 1 - 1
compiler/cgutils.pas

@@ -214,7 +214,7 @@ uses
     function use_fixed_stack: boolean;
       begin
 {$ifdef i386}
-        result := (target_info.system = system_i386_darwin);
+        result := (target_info.system in [system_i386_darwin,system_x86_64_darwin]);
 {$else i386}
 {$ifdef cputargethasfixedstack}
         result := true;

+ 2 - 2
compiler/cresstr.pas

@@ -133,7 +133,7 @@ uses
           s : pchar;
           referencelab: TAsmLabel;
         begin
-          if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+          if (target_info.system in systems_darwin) then
             begin
               current_asmdata.getdatalabel(referencelab);
               current_asmdata.asmlists[al_const].concat(tai_label.create(referencelab));
@@ -143,7 +143,7 @@ uses
           current_asmdata.asmlists[al_const].concat(tai_const.create_aint(-1));
           current_asmdata.asmlists[al_const].concat(tai_const.create_aint(len));
           current_asmdata.asmlists[al_const].concat(tai_label.create(result));
-          if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+          if (target_info.system in systems_darwin) then
              current_asmdata.asmlists[al_const].concat(tai_directive.create(asd_reference,referencelab.name));
           getmem(s,len+1);
           move(p^,s^,len);

+ 1 - 1
compiler/dbgdwarf.pas

@@ -2433,7 +2433,7 @@ implementation
                     if (prevlabel = nil) or
                        { darwin's assembler cannot create an uleb128 of the difference }
                        { between to symbols                                            }
-                       (target_info.system in [system_powerpc_darwin,system_powerpc64_darwin,system_i386_darwin]) then
+                       (target_info.system in systems_darwin) then
                       begin
                         asmline.concat(tai_const.create_8bit(DW_LNS_extended_op));
 {$ifdef cpu64bit}

+ 1 - 1
compiler/dbgstabs.pas

@@ -1548,7 +1548,7 @@ implementation
           exit;
         list.concat(Tai_section.create(sec_fpc,'links',0));
         { make sure the debuginfo doesn't get stripped out }
-        if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+        if (target_info.system in systems_darwin) then
           begin
             dbgtable:=tai_symbol.createname('DEBUGINFOTABLE',AT_DATA,0);
             list.concat(tai_directive.create(asd_no_dead_strip,dbgtable.sym.name));

+ 2 - 2
compiler/ncgutil.pas

@@ -1965,7 +1965,7 @@ implementation
         current_procinfo.procdef.procendtai:=tai(list.last);
 
         { finalisation marker for Mac OS X }
-        if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
+        if (target_info.system in systems_darwin) and
            (current_module.islibrary) and
            (((current_module.flags and uf_finalize)<>0) or
             (current_procinfo.procdef.proctypeoption = potype_proginit)) then
@@ -1980,7 +1980,7 @@ implementation
 
         if (current_procinfo.procdef.proctypeoption=potype_proginit) then
           begin
-           if (target_info.system in [system_powerpc_darwin,system_i386_darwin,system_powerpc_macos]) and
+           if (target_info.system in (systems_darwin+[system_powerpc_macos])) and
               not(current_module.islibrary) then
              begin
               list.concat(tai_section.create(sec_code,'',4));

+ 1 - 1
compiler/ogelf.pas

@@ -607,7 +607,7 @@ implementation
         secname : string;
       begin
         if (cs_create_pic in current_settings.moduleswitches) and
-           not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+           not(target_info.system in systems_darwin) then
           secname:=secnames_pic[atype]
         else
           secname:=secnames[atype];

+ 7 - 7
compiler/pdecvar.pas

@@ -916,7 +916,7 @@ implementation
           if is_cdecl or
              (
               is_dll and
-              (target_info.system in [system_powerpc_darwin,system_i386_darwin])
+              (target_info.system in systems_darwin)
              ) then
             C_Name := target_info.Cprefix+C_Name;
 
@@ -1171,7 +1171,7 @@ implementation
              if maybe_parse_proc_directives(hdef) then
                semicoloneaten:=true;
 
-{$ifdef powerpc}
+{$if defined(powerpc) or defined(powerpc64)}
              { from gcc/gcc/config/rs6000/rs6000.h:
               /* APPLE LOCAL begin Macintosh alignment 2002-1-22 ff */
               /* Return the alignment of a struct based on the Macintosh PowerPC
@@ -1182,7 +1182,7 @@ implementation
                  (32-bit) alignment, in which case the alignment is determined by
                  the alignment of the first field.  */
              }
-             if (target_info.system in [system_powerpc_darwin, system_powerpc_macos]) and
+             if (target_info.system in [system_powerpc_darwin, system_powerpc_macos, system_powerpc64_darwin]) and
                 is_first_field and
                 (symtablestack.top.symtabletype = recordsymtable) and
                 (trecordsymtable(symtablestack.top).usefieldalignment = -1) then
@@ -1200,7 +1200,7 @@ implementation
                    trecordsymtable(symtablestack.top).padalignment := maxpadalign;
                  is_first_field := false;
                end;
-{$endif powerpc}
+{$endif powerpc or powerpc64}
 
              { types that use init/final are not allowed in variant parts, but
                classes are allowed }
@@ -1368,14 +1368,14 @@ implementation
               unionsymtable.datasize:=maxsize;
               unionsymtable.fieldalignment:=maxalignment;
               unionsymtable.addalignmentpadding;
-{$ifdef powerpc}
+{$if defined(powerpc) or defined(powerpc64)}
               { parent inherits the alignment padding if the variant is the first "field" of the parent record/variant }
-              if (target_info.system in [system_powerpc_darwin, system_powerpc_macos]) and
+              if (target_info.system in [system_powerpc_darwin, system_powerpc_macos, system_powerpc64_darwin]) and
                  is_first_field and
                  (recst.usefieldalignment = -1) and
                  (maxpadalign > recst.padalignment) then
                 recst.padalignment:=maxpadalign;
-{$endif powerpc}
+{$endif powerpc or powerpc64}
               { Align the offset where the union symtable is added }
               if (recst.usefieldalignment=-1) then
                 usedalign:=used_align(unionsymtable.recordalignment,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign)

+ 2 - 2
compiler/pmodules.pas

@@ -1318,12 +1318,12 @@ implementation
           begin
             main_procinfo:=create_main_proc(make_mangledname('',current_module.localsymtable,mainaliasname),potype_proginit,current_module.localsymtable);
             { Win32 startup code needs a single name }
-            if not(target_info.system in [system_powerpc_darwin,system_i386_darwin]) then
+            if not(target_info.system in systems_darwin) then
               main_procinfo.procdef.aliasnames.insert('PASCALMAIN')
             else
               main_procinfo.procdef.aliasnames.insert(target_info.Cprefix+'PASCALMAIN')
           end
-         else if (target_info.system in [system_i386_netware,system_i386_netwlibc,system_powerpc_macos,system_powerpc_darwin,system_i386_darwin]) then
+         else if (target_info.system in ([system_i386_netware,system_i386_netwlibc,system_powerpc_macos]+systems_darwin)) then
            begin
              main_procinfo:=create_main_proc('PASCALMAIN',potype_proginit,current_module.localsymtable);
            end

+ 1 - 1
compiler/symdef.pas

@@ -813,7 +813,7 @@ implementation
         if suffix<>'' then
           result:=result+'_'+suffix;
         { the Darwin assembler assumes that all symbols starting with 'L' are local }
-        if (target_info.system in [system_powerpc_darwin,system_i386_darwin]) and
+        if (target_info.system in systems_darwin) and
            (result[1] = 'L') then
           result := '_' + result;
       end;

+ 5 - 0
compiler/systems.pas

@@ -142,6 +142,11 @@ interface
              system_x86_64_darwin       { 61 }
        );
 
+     const
+       systems_darwin = [system_powerpc_darwin,system_i386_darwin,
+                         system_powerpc64_darwin,system_x86_64_darwin];
+
+     type
        tasm = (as_none
              ,as_gas                   { standard gnu assembler }
              ,as_i386_as_aout