diff --git a/compiler/assemble.pas b/compiler/assemble.pas index 29ac0771cc..b70e81f852 100644 --- a/compiler/assemble.pas +++ b/compiler/assemble.pas @@ -570,6 +570,13 @@ Implementation end; end; +{$ifdef i386} + const format_option='--32'; +{$else}{$ifdef x86_64} + const format_option='--64'; +{$else} + const format_option=''; +{$endif}{$endif} procedure TExternalAssembler.AsmCreate(Aplace:tcutplace); begin @@ -579,7 +586,7 @@ Implementation if DoPipe then begin Message1(exec_i_assembling_pipe,asmfile); - POpen(outfile,'as -o '+objfile,'W'); + POpen(outfile,'as '+format_option+' -o '+objfile,'W'); end else {$endif} diff --git a/compiler/x86/agx86att.pas b/compiler/x86/agx86att.pas index 67c34c8e2f..e3f44f9cb4 100644 --- a/compiler/x86/agx86att.pas +++ b/compiler/x86/agx86att.pas @@ -240,7 +240,7 @@ interface id : as_gas; idtxt : 'AS'; asmbin : 'as'; - asmcmd : '-o $OBJ $ASM'; + asmcmd : '--64 -o $OBJ $ASM'; supported_target : system_any; flags : [af_allowdirect,af_needar,af_smartlink_sections,af_supports_dwarf]; labelprefix : '.L'; @@ -252,7 +252,7 @@ interface id : as_gas; idtxt : 'AS'; asmbin : 'as'; - asmcmd : '-o $OBJ $ASM'; + asmcmd : '--32 -o $OBJ $ASM'; supported_target : system_any; flags : [af_allowdirect,af_needar,af_smartlink_sections]; labelprefix : '.L';