Skip to content

Commit 970f38d

Browse files
Merge branch 'mr/forward-target-to-clang' into 'master'
Forward our target from the driver to Clang See merge request eng/toolchain/gnat-llvm!363
2 parents 3da9203 + 41353cf commit 970f38d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

llvm-interface/gcc_wrapper.adb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ procedure GCC_Wrapper is
6565
-- is a Clang instance that we expect to be on the PATH, like GNAT-LLVM C.
6666

6767
GCC : constant String := Command_Name;
68-
Args : Argument_List (1 .. Argument_Count + 1);
68+
Args : Argument_List (1 .. Argument_Count + 2);
6969
Arg_Count : Natural := 0;
7070
Status : Boolean;
7171
Last : Natural;
@@ -314,7 +314,7 @@ begin
314314
null;
315315

316316
elsif Arg = "-x" then
317-
if J < Args'Last then
317+
if J < Argument_Count then
318318

319319
-- While we can use our embedded Clang ("llvm-helper") to
320320
-- compile assembly code, we need to forward C and C++ code to
@@ -438,6 +438,14 @@ begin
438438
return;
439439
end if;
440440

441+
-- Tell Clang which target to compile or link for
442+
443+
if Compiler /= Ada_Frontend or else not Compile then
444+
Args (Arg_Count + 1) := new String'("-target");
445+
Args (Arg_Count + 2) := new String'(Default_Target_Triple);
446+
Arg_Count := Arg_Count + 2;
447+
end if;
448+
441449
-- Compile c/c++ files with clang
442450

443451
if Compiler = Bundled_Clang or else Compiler = External_Clang then

0 commit comments

Comments
 (0)