Procházet zdrojové kódy

Merged revisions 6404 via svnmerge from
svn+ssh://[email protected]/FPC/svn/fpc/branches/merged/fpc_2_3

........
r6404 | jonas | 2007-02-10 23:01:23 +0100 (Sat, 10 Feb 2007) | 5 lines

+ 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/fixes_2_2@8767 -

Jonas Maebe před 18 roky
rodič
revize
71fdb2e8ac

+ 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

@@ -291,7 +291,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];
@@ -313,7 +313,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
@@ -345,7 +345,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 ');
@@ -365,10 +367,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;
@@ -554,7 +558,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
@@ -592,7 +596,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
@@ -686,7 +690,7 @@ implementation
                  aitconst_secrel32_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]);
@@ -707,7 +711,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;
@@ -1066,7 +1070,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');
 }
 
@@ -1084,7 +1088,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 }

+ 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

@@ -2568,7 +2568,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));
                         asmline.concat(tai_const.create_uleb128bit(1+sizeof(aint)));

+ 1 - 1
compiler/dbgstabs.pas

@@ -1635,7 +1635,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

@@ -2003,7 +2003,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
@@ -2018,7 +2018,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

@@ -609,7 +609,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

@@ -1064,7 +1064,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;
 
@@ -1335,7 +1335,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
@@ -1346,7 +1346,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=C_alignment) then
@@ -1364,7 +1364,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 }
@@ -1533,14 +1533,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=C_alignment) 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=C_alignment) then
                 usedalign:=used_align(unionsymtable.recordalignment,current_settings.alignment.recordalignmin,current_settings.alignment.maxCrecordalign)

+ 2 - 2
compiler/pmodules.pas

@@ -1315,12 +1315,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

@@ -815,7 +815,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;