Browse Source

* make DoPipe() a method of TExternalAssembler and use it in
TAArch64AppleAssembler to determine whether we have to add extra
parameters to support assembling via a pipe ("as" is a symlink to
clang for Arch64 on OS X, and needs to be explicitly told its going to
receive assembler code from standard input)

git-svn-id: trunk@29952 -

Jonas Maebe 10 years ago
parent
commit
bb1274a8ee
2 changed files with 15 additions and 1 deletions
  1. 13 0
      compiler/aarch64/agcpugas.pas
  2. 2 1
      compiler/assemble.pas

+ 13 - 0
compiler/aarch64/agcpugas.pas

@@ -41,6 +41,7 @@ unit agcpugas;
 
 
       TAArch64AppleAssembler=class(TAppleGNUassembler)
       TAArch64AppleAssembler=class(TAppleGNUassembler)
         constructor create(smart: boolean); override;
         constructor create(smart: boolean); override;
+        function MakeCmdLine: TCmdStr; override;
       end;
       end;
 
 
 
 
@@ -77,6 +78,18 @@ unit agcpugas;
         InstrWriter := TAArch64InstrWriter.create(self);
         InstrWriter := TAArch64InstrWriter.create(self);
       end;
       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                    }
 {                  Helper routines for Instruction Writer                    }

+ 2 - 1
compiler/assemble.pas

@@ -83,6 +83,7 @@ interface
         lastsectype : TAsmSectionType;
         lastsectype : TAsmSectionType;
         procedure WriteSourceLine(hp: tailineinfo);
         procedure WriteSourceLine(hp: tailineinfo);
         procedure WriteTempalloc(hp: tai_tempalloc);
         procedure WriteTempalloc(hp: tai_tempalloc);
+        Function DoPipe:boolean;
       public
       public
         {# Returns the complete path and executable name of the assembler
         {# Returns the complete path and executable name of the assembler
            program.
            program.
@@ -271,7 +272,7 @@ Implementation
                                  TExternalAssembler
                                  TExternalAssembler
 *****************************************************************************}
 *****************************************************************************}
 
 
-    Function DoPipe:boolean;
+    Function TExternalAssembler.DoPipe:boolean;
       begin
       begin
         DoPipe:=(cs_asm_pipe in current_settings.globalswitches) and
         DoPipe:=(cs_asm_pipe in current_settings.globalswitches) and
                 (([cs_asm_extern,cs_asm_leave,cs_link_on_target] * current_settings.globalswitches) = []) and
                 (([cs_asm_extern,cs_asm_leave,cs_link_on_target] * current_settings.globalswitches) = []) and