Browse Source

Default to external assembler
in cross-endian configuration.

Add note about reason of switching to external assembler.

Pierre Muller 1 year ago
parent
commit
31c8e78581
2 changed files with 18 additions and 3 deletions
  1. 10 3
      compiler/options.pas
  2. 8 0
      compiler/systems.pas

+ 10 - 3
compiler/options.pas

@@ -5142,7 +5142,10 @@ begin
     begin
     begin
       if (option.paratargetasm=as_default) then
       if (option.paratargetasm=as_default) then
         begin
         begin
-          option.paratargetasm:=target_info.assem;
+          if (target_info.endian<>source_info.endian) then
+            option.paratargetasm:=target_info.assemextern
+          else
+            option.paratargetasm:=target_info.assem;
         end;
         end;
       if not set_target_asm(option.paratargetasm) then
       if not set_target_asm(option.paratargetasm) then
         begin
         begin
@@ -5182,9 +5185,13 @@ begin
   if (af_outputbinary in target_asm.flags) and
   if (af_outputbinary in target_asm.flags) and
      ((cs_asm_leave in init_settings.globalswitches) or
      ((cs_asm_leave in init_settings.globalswitches) or
       { if -s is passed, we shouldn't call the internal assembler }
       { if -s is passed, we shouldn't call the internal assembler }
-      (cs_asm_extern in init_settings.globalswitches)) then
+      (cs_asm_extern in init_settings.globalswitches)) or
+      ((option.paratargetasm=as_none) and (target_info.endian<>source_info.endian)) then
    begin
    begin
-     Message(option_switch_bin_to_src_assembler);
+     if ((option.paratargetasm=as_none) and (target_info.endian<>source_info.endian)) then
+       Message(option_switch_bin_to_src_assembler_cross_endian)
+     else
+       Message(option_switch_bin_to_src_assembler);
 {$ifdef llvm}
 {$ifdef llvm}
      if not(target_info.system in systems_darwin) then
      if not(target_info.system in systems_darwin) then
        set_target_asm(as_clang_llvm)
        set_target_asm(as_clang_llvm)

+ 8 - 0
compiler/systems.pas

@@ -470,6 +470,14 @@ interface
        asms_int_coff = [as_arm_pecoffwince,as_x86_64_pecoff,as_i386_pecoffwince,
        asms_int_coff = [as_arm_pecoffwince,as_x86_64_pecoff,as_i386_pecoffwince,
                         as_i386_pecoffwdosx,as_i386_pecoff,as_i386_coff];
                         as_i386_pecoffwdosx,as_i386_pecoff,as_i386_coff];
 
 
+       { all internal ELF writers }
+       asms_int_elf = [as_arm_elf32,as_x86_64_elf64,as_m68k_elf32,
+                       as_sparc_elf32,as_i386_elf32];
+
+       { all internal writers }
+       asms_internals = asms_int_coff + asms_int_elf
+                        + [as_i8086_omf, as_z80_rel, as_wasm32_wasm, as_i386_macho];
+
        cpu2str : array[TSystemCpu] of string[12] =
        cpu2str : array[TSystemCpu] of string[12] =
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
             ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64',
              'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',
              'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',