From 31c8e78581f442ef537693da2db81bacd4a30fee Mon Sep 17 00:00:00 2001 From: Pierre Muller Date: Wed, 1 Nov 2023 20:47:27 +0000 Subject: [PATCH] Default to external assembler in cross-endian configuration. Add note about reason of switching to external assembler. --- compiler/options.pas | 13 ++++++++++--- compiler/systems.pas | 8 ++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/compiler/options.pas b/compiler/options.pas index 1a6e08545d..22ab324f74 100644 --- a/compiler/options.pas +++ b/compiler/options.pas @@ -5142,7 +5142,10 @@ begin begin if (option.paratargetasm=as_default) then 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; if not set_target_asm(option.paratargetasm) then begin @@ -5182,9 +5185,13 @@ begin if (af_outputbinary in target_asm.flags) and ((cs_asm_leave in init_settings.globalswitches) or { 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 - 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} if not(target_info.system in systems_darwin) then set_target_asm(as_clang_llvm) diff --git a/compiler/systems.pas b/compiler/systems.pas index 37d5595b23..0ff58ce42f 100644 --- a/compiler/systems.pas +++ b/compiler/systems.pas @@ -470,6 +470,14 @@ interface asms_int_coff = [as_arm_pecoffwince,as_x86_64_pecoff,as_i386_pecoffwince, 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] = ('','i386','m68k','alpha','powerpc','sparc','vm','ia64','x86_64', 'mips','arm', 'powerpc64', 'avr', 'mipsel','jvm', 'i8086',