From 92966893f5475bd56ba2956e1e97cc0a0557aacd Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 4 Aug 2011 14:18:16 +0200 Subject: [PATCH] [multiple changes] 2011-08-04 Arnaud Charlet * make.adb (Do_Codepeer_Globalize_Step): Removed. Use CodePeer_Mode instead. (CodePeer_Mode_String): New. (Linking_Phase, Binding_Phase): Call gnatlink with -P switch in CodePeer mode. (Scan_Make_Arg): Do not disable binding/linking phase in CodePeer mode. * bindgen.adb (Gen_Elab_Calls_Ada): Ignore subprograms in CodePeer mode, since no useful elaboration subprogram is needed by CodePeer. * gnatlink.adb (Gnatlink): Add support for -P switch (CodePeer mode). In this mode, compile binder file with -gnatC and do stop after this step. 2011-08-04 Vincent Celier * exp_ch7.adb: Minor comment fix. From-SVN: r177366 --- gcc/ada/ChangeLog | 18 ++++++++++++++++++ gcc/ada/bindgen.adb | 5 ++++- gcc/ada/exp_ch7.adb | 2 +- gcc/ada/gnatlink.adb | 27 +++++++++++++++++++++++---- gcc/ada/make.adb | 35 ++++++++++++++++++++++++----------- 5 files changed, 70 insertions(+), 17 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 93cd8d660ba..62e4eaa7d7e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,21 @@ +2011-08-04 Arnaud Charlet + + * make.adb (Do_Codepeer_Globalize_Step): Removed. Use CodePeer_Mode + instead. + (CodePeer_Mode_String): New. + (Linking_Phase, Binding_Phase): Call gnatlink with -P switch in + CodePeer mode. + (Scan_Make_Arg): Do not disable binding/linking phase in CodePeer mode. + * bindgen.adb (Gen_Elab_Calls_Ada): Ignore subprograms in CodePeer + mode, since no useful elaboration subprogram is needed by CodePeer. + * gnatlink.adb (Gnatlink): Add support for -P switch (CodePeer mode). + In this mode, compile binder file with -gnatC and do stop after this + step. + +2011-08-04 Vincent Celier + + * exp_ch7.adb: Minor comment fix. + 2011-08-04 Robert Dewar * exp_ch7.adb, make.adb, sem_ch10.adb, bindgen.adb, sem_res.adb, diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index aee3bddcd2c..0da8a3a41ad 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -1423,7 +1423,10 @@ package body Bindgen is -- The uname_E increment is skipped if this is a separate spec, -- since it will be done when we process the body. - else + -- Ignore subprograms in CodePeer mode, since no useful + -- elaboration subprogram is needed by CodePeer. + + elsif U.Unit_Kind /= 's' or else not CodePeer_Mode then if Force_Checking_Of_Elaboration_Flags or Interface_Library_Unit or not Bind_Main_Program diff --git a/gcc/ada/exp_ch7.adb b/gcc/ada/exp_ch7.adb index 0c570f61b77..5dad689c1f0 100644 --- a/gcc/ada/exp_ch7.adb +++ b/gcc/ada/exp_ch7.adb @@ -4079,7 +4079,7 @@ package body Exp_Ch7 is function Get_Global_Pool_For_Access_Type (T : Entity_Id) return Entity_Id is begin -- Access types whose size is smaller than System.Address size can - -- exit only on VMS. We can't use the usual global pool which returns + -- exist only on VMS. We can't use the usual global pool which returns -- an object of type Address as truncation will make it invalid. -- To handle this case, VMS has a dedicated global pool that returns -- addresses that fit into 32 bit accesses. diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index 0b5d681b376..6a0a34e78ff 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2011, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -479,6 +479,9 @@ procedure Gnatlink is (Argument (Next_Arg), Only_If_No_Suffix => True)); + when 'P' => + Opt.CodePeer_Mode := True; + when 'R' => Opt.Run_Path_Option := False; @@ -1441,12 +1444,13 @@ procedure Gnatlink is Write_Eol; Write_Line (" mainprog.ali the ALI file of the main program"); Write_Eol; - Write_Line (" -f force object file list to be generated"); + Write_Line (" -f Force object file list to be generated"); Write_Line (" -g Compile binder source file with debug information"); Write_Line (" -n Do not compile the binder source file"); + Write_Line (" -P Process files for use by CodePeer"); Write_Line (" -R Do not use a run_path_option"); - Write_Line (" -v verbose mode"); - Write_Line (" -v -v very verbose mode"); + Write_Line (" -v Verbose mode"); + Write_Line (" -v -v Very verbose mode"); Write_Eol; Write_Line (" -o nam Use 'nam' as the name of the executable"); Write_Line (" -b target Compile the binder source to run on target"); @@ -1675,6 +1679,8 @@ begin -- because bindgen uses brackets encoding for all upper -- half and wide characters in identifier names. + -- In addition, in CodePeer mode compile with -gnatC + if Ada_Bind_File then Binder_Options_From_ALI.Increment_Last; Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) := @@ -1685,6 +1691,12 @@ begin Binder_Options_From_ALI.Increment_Last; Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) := new String'("-gnatiw"); + + if Opt.CodePeer_Mode then + Binder_Options_From_ALI.Increment_Last; + Binder_Options_From_ALI.Table (Binder_Options_From_ALI.Last) := + new String'("-gnatC"); + end if; end if; -- Locate all the necessary programs and verify required files are present @@ -1888,6 +1900,13 @@ begin end Bind_Step; end if; + -- In CodePeer mode, there's nothing left to do after the binder file has + -- been compiled. + + if Opt.CodePeer_Mode then + return; + end if; + -- Now, actually link the program -- Skip this step for now on JVM since the Java interpreter will do diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 29e06b5467a..a86846b7d4e 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -386,11 +386,9 @@ package body Make is -- with the switches -c, -b and -l. These flags are reset to True for -- each invocation of procedure Gnatmake. - Do_Codepeer_Globalize_Step : Boolean := False; - -- Flag to indicate whether the CodePeer globalizer should be called - Shared_String : aliased String := "-shared"; Force_Elab_Flags_String : aliased String := "-F"; + CodePeer_Mode_String : aliased String := "-P"; No_Shared_Switch : aliased Argument_List := (1 .. 0 => null); Shared_Switch : aliased Argument_List := (1 => Shared_String'Access); @@ -2927,7 +2925,7 @@ package body Make is then -- If we compile with -gnatC, enable CodePeer globalize step - Do_Codepeer_Globalize_Step := True; + CodePeer_Mode := True; end if; end loop; @@ -2968,7 +2966,7 @@ package body Make is declare Str : String renames Args (Arg_Index).all; begin - if Do_Codepeer_Globalize_Step + if CodePeer_Mode and then Str'Length > 2 and then Str (Str'First .. Str'First + 1) = "-m" then @@ -4399,7 +4397,13 @@ package body Make is end; end if; - -- Add switch -M to gnatlink if buider switch --create-map-file + if CodePeer_Mode then + Linker_Switches.Increment_Last; + Linker_Switches.Table (Linker_Switches.Last) := + new String'(CodePeer_Mode_String); + end if; + + -- Add switch -M to gnatlink if builder switch --create-map-file -- has been specified. if Map_File /= null then @@ -4560,6 +4564,11 @@ package body Make is Args (Last_Arg) := Force_Elab_Flags_String'Access; end if; + if CodePeer_Mode then + Last_Arg := Last_Arg + 1; + Args (Last_Arg) := CodePeer_Mode_String'Access; + end if; + if Main_Project /= No_Project then -- Put all the source directories in ADA_INCLUDE_PATH, @@ -6313,10 +6322,9 @@ package body Make is end if; end loop Multiple_Main_Loop; - if Do_Codepeer_Globalize_Step then + if CodePeer_Mode then declare Success : Boolean := False; - begin Globalize (Success); @@ -7962,9 +7970,14 @@ package body Make is Add_Switch (Argv, Compiler, And_Save => And_Save); Operating_Mode := Check_Semantics; Check_Object_Consistency := False; - Compile_Only := True; - Do_Bind_Step := False; - Do_Link_Step := False; + + if not CodePeer_Mode + and then (Argv'Last < 7 or else Argv (7) /= 'C') + then + Compile_Only := True; + Do_Bind_Step := False; + Do_Link_Step := False; + end if; elsif Argv (2 .. Argv'Last) = "nostdlib" then -- 2.30.2