mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 09:59:25 +02:00
+ added support for using Clang as an assembler, and make it the default
for all non-ppc(32/64) Darwin platforms o pass the macosx-version-min/iphoneos-version-min to clang as an assembler, so that it properly sets this information starting with Xcode 7 (solves errors when targeting the iOS simulator, and warnings about object files being compiled for a different OS X version when targeting (Mac) OS X) o the old assembler is still selectable via -Aas-darwin (required with Xcode 3.1.x and older) o since the first Xcode version that shipped with Clang is Xcode 3.2, which is available for Mac OS X 10.6, most users should not encounter any issues with the new default (in fact, it fixes some tests for x86 because Clang supports some instructions that "as" doesn't). Clang does not support Stabs however, so -gs does require the use of -Aas-darwin git-svn-id: trunk@31830 -
This commit is contained in:
parent
624376b403
commit
7c594b0288
@ -45,7 +45,6 @@ unit agcpugas;
|
||||
|
||||
TAArch64AppleAssembler=class(TAppleGNUassembler)
|
||||
constructor create(info: pasminfo; smart: boolean); override;
|
||||
function MakeCmdLine: TCmdStr; override;
|
||||
end;
|
||||
|
||||
|
||||
@ -91,18 +90,6 @@ unit agcpugas;
|
||||
InstrWriter := TAArch64InstrWriter.create(self);
|
||||
end;
|
||||
|
||||
function TAArch64AppleAssembler.MakeCmdLine: TCmdStr;
|
||||
begin
|
||||
{ 'as' calls through to clang for aarch64, and that one only supports
|
||||
reading from standard input in case "-" is specified as input file
|
||||
(in which case you also have to specify the language via -x) }
|
||||
result:=inherited;
|
||||
{$ifdef hasunix}
|
||||
if DoPipe then
|
||||
result:=result+' -x assembler -'
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
|
||||
{****************************************************************************}
|
||||
{ Helper routines for Instruction Writer }
|
||||
@ -295,14 +282,14 @@ unit agcpugas;
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
as_aarch64_gas_darwin_info : tasminfo =
|
||||
as_aarch64_clang_darwin_info : tasminfo =
|
||||
(
|
||||
id : as_darwin;
|
||||
idtxt : 'AS-DARWIN';
|
||||
asmbin : 'as';
|
||||
asmcmd : '-o $OBJ $EXTRAOPT $ASM -arch arm64';
|
||||
id : as_clang;
|
||||
idtxt : 'CLANG';
|
||||
asmbin : 'clang';
|
||||
asmcmd : '-c -o $OBJ $EXTRAOPT -arch arm64 $DARWINVERSION -x assembler $ASM';
|
||||
supported_targets : [system_aarch64_darwin];
|
||||
flags : [af_needar,af_smartlink_sections,af_supports_dwarf,af_stabs_use_function_absolute_addresses];
|
||||
flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
|
||||
labelprefix : 'L';
|
||||
comment : '# ';
|
||||
dollarsign: '$';
|
||||
@ -311,5 +298,5 @@ unit agcpugas;
|
||||
|
||||
begin
|
||||
RegisterAssembler(as_aarch64_gas_info,TAArch64Assembler);
|
||||
RegisterAssembler(as_aarch64_gas_darwin_info,TAArch64AppleAssembler);
|
||||
RegisterAssembler(as_aarch64_clang_darwin_info,TAArch64AppleAssembler);
|
||||
end.
|
||||
|
@ -425,7 +425,22 @@ unit agarmgas;
|
||||
);
|
||||
|
||||
|
||||
as_arm_clang_darwin_info : tasminfo =
|
||||
(
|
||||
id : as_clang;
|
||||
idtxt : 'CLANG';
|
||||
asmbin : 'clang';
|
||||
asmcmd : '-c -o $OBJ $EXTRAOPT -arch $ARCH $DARWINVERSION -x assembler $ASM';
|
||||
supported_targets : [system_arm_darwin];
|
||||
flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
|
||||
labelprefix : 'L';
|
||||
comment : '# ';
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
|
||||
begin
|
||||
RegisterAssembler(as_arm_gas_info,TARMGNUAssembler);
|
||||
RegisterAssembler(as_arm_gas_darwin_info,TArmAppleGNUAssembler);
|
||||
RegisterAssembler(as_arm_clang_darwin_info,TArmAppleGNUAssembler);
|
||||
end.
|
||||
|
@ -898,6 +898,13 @@ Implementation
|
||||
function TExternalAssembler.MakeCmdLine: TCmdStr;
|
||||
begin
|
||||
result:=asminfo^.asmcmd;
|
||||
{ for Xcode 7.x and later }
|
||||
if MacOSXVersionMin<>'' then
|
||||
Replace(result,'$DARWINVERSION','-mmacosx-version-min='+MacOSXVersionMin)
|
||||
else if iPhoneOSVersionMin<>'' then
|
||||
Replace(result,'$DARWINVERSION','-miphoneos-version-min='+iPhoneOSVersionMin)
|
||||
else
|
||||
Replace(result,'$DARWINVERSION','');
|
||||
{$ifdef arm}
|
||||
if (target_info.system=system_arm_darwin) then
|
||||
Replace(result,'$ARCH',lower(cputypestr[current_settings.cputype]));
|
||||
@ -911,7 +918,10 @@ Implementation
|
||||
begin
|
||||
{$ifdef hasunix}
|
||||
if DoPipe then
|
||||
Replace(result,'$ASM','')
|
||||
if asminfo^.id<>as_clang then
|
||||
Replace(result,'$ASM','')
|
||||
else
|
||||
Replace(result,'$ASM','-')
|
||||
else
|
||||
{$endif}
|
||||
Replace(result,'$ASM',maybequoted(AsmFileName));
|
||||
|
@ -220,6 +220,7 @@
|
||||
,as_arm_elf32
|
||||
,as_i8086_omf
|
||||
,as_llvm
|
||||
,as_clang
|
||||
);
|
||||
|
||||
tlink = (ld_none,
|
||||
|
@ -70,7 +70,7 @@ interface
|
||||
id : tasm;
|
||||
idtxt : string[12];
|
||||
asmbin : string[8];
|
||||
asmcmd : string[50];
|
||||
asmcmd : string[70];
|
||||
supported_targets : set of tsystem;
|
||||
flags : set of tasmflags;
|
||||
labelprefix : string[3];
|
||||
|
@ -741,8 +741,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
@ -806,8 +806,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
@ -936,8 +936,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
@ -1000,8 +1000,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
@ -1064,8 +1064,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
@ -1129,8 +1129,8 @@ unit i_bsd;
|
||||
Cprefix : '_';
|
||||
newline : #10;
|
||||
dirsep : '/';
|
||||
assem : as_darwin;
|
||||
assemextern : as_darwin;
|
||||
assem : as_clang;
|
||||
assemextern : as_clang;
|
||||
link : ld_none;
|
||||
linkextern : ld_bsd;
|
||||
ar : ar_gnu_ar;
|
||||
|
@ -484,6 +484,19 @@ interface
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
as_x86_64_clang_darwin_info : tasminfo =
|
||||
(
|
||||
id : as_clang;
|
||||
idtxt : 'CLANG';
|
||||
asmbin : 'clang';
|
||||
asmcmd : '-c -o $OBJ $EXTRAOPT -arch x86_64 $DARWINVERSION -x assembler $ASM';
|
||||
supported_targets : [system_x86_64_darwin,system_x86_64_iphonesim];
|
||||
flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
|
||||
labelprefix : 'L';
|
||||
comment : '# ';
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
{$else x86_64}
|
||||
as_i386_as_info : tasminfo =
|
||||
(
|
||||
@ -545,6 +558,19 @@ interface
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
as_i386_clang_darwin_info : tasminfo =
|
||||
(
|
||||
id : as_clang;
|
||||
idtxt : 'CLANG';
|
||||
asmbin : 'clang';
|
||||
asmcmd : '-c -o $OBJ $EXTRAOPT -arch i386 $DARWINVERSION -x assembler $ASM';
|
||||
supported_targets : [system_i386_darwin,system_i386_iphonesim];
|
||||
flags : [af_needar,af_smartlink_sections,af_supports_dwarf];
|
||||
labelprefix : 'L';
|
||||
comment : '# ';
|
||||
dollarsign: '$';
|
||||
);
|
||||
|
||||
as_i386_gas_info : tasminfo =
|
||||
(
|
||||
id : as_ggas;
|
||||
@ -568,11 +594,13 @@ initialization
|
||||
RegisterAssembler(as_x86_64_yasm_info,Tx86ATTAssembler);
|
||||
RegisterAssembler(as_x86_64_gas_info,Tx86ATTAssembler);
|
||||
RegisterAssembler(as_x86_64_gas_darwin_info,Tx86AppleGNUAssembler);
|
||||
RegisterAssembler(as_x86_64_clang_darwin_info,Tx86AppleGNUAssembler);
|
||||
{$else x86_64}
|
||||
RegisterAssembler(as_i386_as_info,Tx86ATTAssembler);
|
||||
RegisterAssembler(as_i386_gas_info,Tx86ATTAssembler);
|
||||
RegisterAssembler(as_i386_yasm_info,Tx86ATTAssembler);
|
||||
RegisterAssembler(as_i386_gas_darwin_info,Tx86AppleGNUAssembler);
|
||||
RegisterAssembler(as_i386_clang_darwin_info,Tx86AppleGNUAssembler);
|
||||
RegisterAssembler(as_i386_as_aout_info,Tx86AoutGNUAssembler);
|
||||
{$endif x86_64}
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user