Commit c8effb4f by Vincent Celier Committed by Arnaud Charlet

makegpr.adb (Build_Global_Archive): Make sure the list of sources is correctly…

makegpr.adb (Build_Global_Archive): Make sure the list of sources is correctly computed and the main project data...

2005-07-04  Vincent Celier  <celier@adacore.com>

	* makegpr.adb (Build_Global_Archive): Make sure the list of sources is
	correctly computed and the main project data is not modified while
	doing so.
	(Add_C_Plus_Plus_Link_For_Gnatmake): Always link with the C++ compiler
	(Choose_C_Plus_Plus_Link_Process): Do not generate shell script
	c++linker as this does not work on some platforms.

From-SVN: r101596
parent 65d5180d
...@@ -60,10 +60,6 @@ package body Makegpr is ...@@ -60,10 +60,6 @@ package body Makegpr is
-- The maximum number of arguments for a single invocation of the -- The maximum number of arguments for a single invocation of the
-- Archive Indexer (ar). -- Archive Indexer (ar).
Cpp_Linker : constant String := "c++linker";
-- The name of a linking script, built one the fly, when there are C++
-- sources and the C++ compiler is not g++.
No_Argument : aliased Argument_List := (1 .. 0 => null); No_Argument : aliased Argument_List := (1 .. 0 => null);
-- Null argument list representing case of no arguments -- Null argument list representing case of no arguments
...@@ -1023,6 +1019,7 @@ package body Makegpr is ...@@ -1023,6 +1019,7 @@ package body Makegpr is
Data : Project_Data := Data : Project_Data :=
Project_Tree.Projects.Table (Main_Project); Project_Tree.Projects.Table (Main_Project);
Source_Id : Other_Source_Id; Source_Id : Other_Source_Id;
S_Id : Other_Source_Id;
Source : Other_Source; Source : Other_Source;
Success : Boolean; Success : Boolean;
...@@ -1090,22 +1087,28 @@ package body Makegpr is ...@@ -1090,22 +1087,28 @@ package body Makegpr is
-- Put all sources of language other than Ada in -- Put all sources of language other than Ada in
-- Source_Indexes. -- Source_Indexes.
for Proj in Project_Table.First .. declare
Project_Table.Last (Project_Tree.Projects) Local_Data : Project_Data;
loop
Data := Project_Tree.Projects.Table (Proj);
if not Data.Library then begin
Last_Source := 0; Last_Source := 0;
Source_Id := Data.First_Other_Source;
while Source_Id /= No_Other_Source loop for Proj in Project_Table.First ..
Add_Source_Id (Proj, Source_Id); Project_Table.Last (Project_Tree.Projects)
Source_Id := Project_Tree.Other_Sources.Table loop
(Source_Id).Next; Local_Data := Project_Tree.Projects.Table (Proj);
end loop;
end if; if not Local_Data.Library then
end loop; Source_Id := Local_Data.First_Other_Source;
while Source_Id /= No_Other_Source loop
Add_Source_Id (Proj, Source_Id);
Source_Id := Project_Tree.Other_Sources.Table
(Source_Id).Next;
end loop;
end if;
end loop;
end;
-- Read the dependency file, line by line -- Read the dependency file, line by line
...@@ -1120,9 +1123,8 @@ package body Makegpr is ...@@ -1120,9 +1123,8 @@ package body Makegpr is
-- Check if this object file is for a source of this project -- Check if this object file is for a source of this project
for S in 1 .. Last_Source loop for S in 1 .. Last_Source loop
Source_Id := Source_Indexes (S).Id; S_Id := Source_Indexes (S).Id;
Source := Project_Tree.Other_Sources.Table Source := Project_Tree.Other_Sources.Table (S_Id);
(Source_Id);
if (not Source_Indexes (S).Found) if (not Source_Indexes (S).Found)
and then Source.Object_Path = Object_Path and then Source.Object_Path = Object_Path
...@@ -1130,6 +1132,7 @@ package body Makegpr is ...@@ -1130,6 +1132,7 @@ package body Makegpr is
-- We have found the object file: get the source -- We have found the object file: get the source
-- data, and mark it as found. -- data, and mark it as found.
Source_Id := S_Id;
Source_Indexes (S).Found := True; Source_Indexes (S).Found := True;
exit; exit;
end if; end if;
...@@ -3369,18 +3372,9 @@ package body Makegpr is ...@@ -3369,18 +3372,9 @@ package body Makegpr is
procedure Add_C_Plus_Plus_Link_For_Gnatmake is procedure Add_C_Plus_Plus_Link_For_Gnatmake is
begin begin
if Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then Add_Argument
Add_Argument ("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all,
("--LINK=" & Compiler_Names (C_Plus_Plus_Language_Index).all, Verbose_Mode);
Verbose_Mode);
else
Add_Argument
("--LINK=" &
Object_Dir & Directory_Separator &
Cpp_Linker,
Verbose_Mode);
end if;
end Add_C_Plus_Plus_Link_For_Gnatmake; end Add_C_Plus_Plus_Link_For_Gnatmake;
----------------------- -----------------------
...@@ -3449,29 +3443,6 @@ package body Makegpr is ...@@ -3449,29 +3443,6 @@ package body Makegpr is
if Compiler_Names (C_Plus_Plus_Language_Index) = null then if Compiler_Names (C_Plus_Plus_Language_Index) = null then
Get_Compiler (C_Plus_Plus_Language_Index); Get_Compiler (C_Plus_Plus_Language_Index);
end if; end if;
if not Compiler_Is_Gcc (C_Plus_Plus_Language_Index) then
Change_Dir (Object_Dir);
declare
File : Ada.Text_IO.File_Type;
use Ada.Text_IO;
begin
Create (File, Out_File, Cpp_Linker);
Put_Line (File, "#!/bin/sh");
Put_Line (File, "LIBGCC=`gcc -print-libgcc-file-name`");
Put_Line
(File,
Compiler_Names (C_Plus_Plus_Language_Index).all &
" $* ${LIBGCC}");
Close (File);
Set_Executable (Cpp_Linker);
end;
end if;
end Choose_C_Plus_Plus_Link_Process; end Choose_C_Plus_Plus_Link_Process;
------------------ ------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment