Răsfoiți Sursa

Specify endianess and abi when calling xtensa linker

Pierre Muller 2 ani în urmă
părinte
comite
4750840e89

+ 15 - 1
compiler/systems/t_embed.pas

@@ -98,10 +98,24 @@ const
 {$else}
   platform_select='';
 {$endif}
+var
+  platformopt : string;
 begin
+  {$ifdef xtensa}
+  if target_info.endian=endian_little then
+    platformopt:=' -b elf32-xtensa-le -m elf32xtensa'
+  else
+    platformopt:=' -b elf32-xtensa-be -m elf32xtensa';
+  if target_info.abi=abi_xtensa_call0 then
+    platformopt:=platformopt+' --abi-call0'
+  else if target_info.abi=abi_xtensa_windowed then
+    platformopt:=platformopt+' --abi-windowed';
+  {$else}
+  platformopt:='';
+  {$endif}
   with Info do
    begin
-     ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
+     ExeCmd[1]:='ld -g '+platform_select+platformopt+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
    end;
 end;
 

+ 15 - 1
compiler/systems/t_freertos.pas

@@ -73,8 +73,22 @@ const
 {$else}
   platform_select='';
 {$endif}
+var
+  platformopt : string;
 begin
-  Info.ExeCmd[1]:='ld -g '+platform_select+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
+  {$ifdef xtensa}
+  if target_info.endian=endian_little then
+    platformopt:=' -b elf32-xtensa-le -m elf32xtensa'
+  else
+    platformopt:=' -b elf32-xtensa-be -m elf32xtensa';
+  if target_info.abi=abi_xtensa_call0 then
+    platformopt:=platformopt+' --abi-call0'
+  else if target_info.abi=abi_xtensa_windowed then
+    platformopt:=platformopt+' --abi-windowed';
+  {$else}
+  platformopt:='';
+  {$endif}
+  Info.ExeCmd[1]:='ld -g '+platform_select+platformopt+' $OPT $DYNLINK $STATIC $GCSECTIONS $STRIP $MAP -L. -o $EXE -T $RES';
 end;
 
 

+ 10 - 0
compiler/systems/t_linux.pas

@@ -402,6 +402,16 @@ begin
   else
     platformopt:=' -b elf64-powerpc -m elf64ppc';
 {$endif powerpc64}
+{$ifdef xtensa}
+  if target_info.endian=endian_little then
+    platformopt:=' -b elf32-xtensa-le -m elf32xtensa'
+  else
+    platformopt:=' -b elf32-xtensa-be -m elf32xtensa';
+  if target_info.abi=abi_xtensa_call0 then
+    platformopt:=platformopt+' --abi-call0'
+  else if target_info.abi=abi_xtensa_windowed then
+    platformopt:=platformopt+' --abi-windowed';
+  {$endif}
 {$ifdef arm}
   platformopt:=' -z noexecstack';
 {$endif arm}