Преглед изворни кода

* only display and allow ABIs that are actually supported by the current
compiler binary

git-svn-id: trunk@24475 -

Jonas Maebe пре 12 година
родитељ
комит
1358618c36
3 измењених фајлова са 20 додато и 6 уклоњено
  1. 2 1
      compiler/globals.pas
  2. 5 3
      compiler/options.pas
  3. 13 2
      compiler/systems.pas

+ 2 - 1
compiler/globals.pas

@@ -1089,7 +1089,8 @@ implementation
         result:=false;
         hs:=Upper(s);
         for t:=low(t) to high(t) do
-          if abi2str[t]=hs then
+          if abiinfo[t].supported and
+             (abiinfo[t].name=hs) then
             begin
               a:=t;
               result:=true;

+ 5 - 3
compiler/options.pas

@@ -265,8 +265,10 @@ begin
       begin
         for abi:=low(abi) to high(abi) do
           begin
+            if not abiinfo[abi].supported then
+              continue;
             hs:=s;
-            hs1:=abi2str[abi];
+            hs1:=abiinfo[abi].name;
             if hs1<>'' then
               begin
                 Replace(hs,'$ABITARGETS',hs1);
@@ -3047,8 +3049,8 @@ begin
 
   { define abi }
   for abi:=low(tabi) to high(tabi) do
-    undef_system_macro('FPC_ABI_'+abi2str[abi]);
-  def_system_macro('FPC_ABI_'+abi2str[target_info.abi]);
+    undef_system_macro('FPC_ABI_'+abiinfo[abi].name);
+  def_system_macro('FPC_ABI_'+abiinfo[target_info.abi].name);
 
   { Define FPC_ABI_EABI in addition to FPC_ABI_EABIHF on EABI VFP hardfloat
     systems since most code needs to behave the same on both}

+ 13 - 2
compiler/systems.pas

@@ -215,6 +215,11 @@ interface
           abi          : tabi;
        end;
 
+    tabiinfo = record
+      name: string[10];
+      supported: boolean;
+    end;
+
     const
        { alias for supported_target field in tasminfo }
        system_any = system_none;
@@ -345,8 +350,14 @@ interface
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
              'mipseb','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086');
 
-       abi2str : array[tabi] of string[10] =
-         ('DEFAULT','SYSV','AIX','EABI','ARMEB','EABIHF');
+       abiinfo : array[tabi] of tabiinfo = (
+         (name: 'DEFAULT'; supported: true),
+         (name: 'SYSV'   ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
+         (name: 'AIX'    ; supported:{$if defined(powerpc) or defined(powerpc64)}true{$else}false{$endif}),
+         (name: 'EABI'   ; supported:{$ifdef FPC_ARMEL}true{$else}false{$endif}),
+         (name: 'ARMEB'  ; supported:{$ifdef FPC_ARMEB}true{$else}false{$endif}),
+         (name: 'EABIHF' ; supported:{$ifdef FPC_ARMHF}true{$else}false{$endif})
+       );
 
     var
        targetinfos   : array[tsystem] of psysteminfo;