From e9491f468a64fdf55d07e66f87f00734c64edb7a Mon Sep 17 00:00:00 2001 From: Laurent GUERBY Date: Mon, 7 Sep 2009 09:00:51 +0000 Subject: [PATCH] make.adb: Add missing documentation for multilib handling. 2009-09-07 Laurent GUERBY * make.adb: Add missing documentation for multilib handling. From-SVN: r151473 --- gcc/ada/ChangeLog | 4 ++++ gcc/ada/make.adb | 23 +++++++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9b92ce5f4df..14291ba2fd6 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,7 @@ +2009-09-07 Laurent GUERBY + + * make.adb: Add missing documentation for multilib handling. + 2009-09-03 Diego Novillo * gcc-interface/misc.c (lang_hooks): Remove const qualifier. diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 20fc989a015..b19aa22da71 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -7296,8 +7296,14 @@ package body Make is begin pragma Assert (N_M_Switch > 0 and RTS_Specified = null); - -- This loop needs commenting ??? In fact this entire body is - -- under-commented ??? And the spec is not much help :-( + -- In case we detected a multilib switch and the user has not + -- manually specified a specific RTS we emulate the following command: + -- gnatmake $FLAGS --RTS=$(gcc -print-multi-directory $FLAGS) + + -- First select the flags which might have an impact on multilib + -- processing. Note that this is an heuristic selection and it + -- will need to be maintained over time. The condition has to + -- be kept synchronized with N_M_Switch counting in Scan_Make_Arg. for Next_Arg in 1 .. Argument_Count loop declare @@ -7322,6 +7328,10 @@ package body Make is Args (Args'Last) := new String'("-print-multi-directory"); + -- Call the GCC driver with the collected flags and save its + -- output. Alternate design would be to link in gnatmake the + -- relevant part of the GCC driver. + if Saved_Gcc /= null then Multilib_Gcc := Saved_Gcc; else @@ -7344,6 +7354,8 @@ package body Make is return; end if; + -- Parse the GCC driver output which is a single line, removing CR/LF + Output_FD := Open_Read (Output_Name.all, Binary); if Output_FD = Invalid_FD then @@ -7362,10 +7374,14 @@ package body Make is end if; end loop; + -- In case the standard RTS is selected do nothing + if N_Read = 0 or else Line (1 .. N_Read) = "." then return; end if; + -- Otherwise add -margs --RTS=output + Scan_Make_Arg ("-margs", And_Save => True); Scan_Make_Arg ("--RTS=" & Line (1 .. N_Read), And_Save => True); end Process_Multilib; @@ -7845,6 +7861,9 @@ package body Make is Add_Switch (Argv, Compiler, And_Save => And_Save); Add_Switch (Argv, Linker, And_Save => And_Save); + -- The following condition has to be kept synchronized with + -- the Process_Multilib one. + if Argv (2) = 'm' and then Argv /= "-mieee" then