diff options
author | Nicolas Setton <setton@adacore.com> | 2009-04-22 10:33:15 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2009-04-22 12:33:15 +0200 |
commit | 3b81743f8901ad7bf8055d461c3cb6d1e7e13e8a (patch) | |
tree | ef9f50f373ee8f9b9a94515d768274f5fc871681 /gcc/ada/gnatcmd.adb | |
parent | 3a69b5ffe6b707dd6e96bc5c21f5db53db5001fe (diff) | |
download | gcc-3b81743f8901ad7bf8055d461c3cb6d1e7e13e8a.tar.gz |
link.c: Add flag __gnat_separate_run_path_options.
2009-04-22 Nicolas Setton <setton@adacore.com>
* link.c: Add flag __gnat_separate_run_path_options.
* mlib.adb (Separate_Run_Path_Options): New subprogram.
* mlib.ads (Separate_Run_Path_Options): Declare.
* gnatcmd.adb (Process_Link): Add support for emitting one "rpath"
switch per directory, rather than one "rpath" switch listing all
directories.
* gnatlink.adb (Process_Binder_File): Likewise.
* make.adb (Gnatmake): Likewise.
From-SVN: r146561
Diffstat (limited to 'gcc/ada/gnatcmd.adb')
-rw-r--r-- | gcc/ada/gnatcmd.adb | 102 |
1 files changed, 64 insertions, 38 deletions
diff --git a/gcc/ada/gnatcmd.adb b/gcc/ada/gnatcmd.adb index a412551859e..66c71486788 100644 --- a/gcc/ada/gnatcmd.adb +++ b/gcc/ada/gnatcmd.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1996-2008, Free Software Foundation, Inc. -- +-- Copyright (C) 1996-2009, 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- -- @@ -976,54 +976,80 @@ procedure GNATCmd is Current : Natural; begin - -- First, compute the exact length for the switch + if MLib.Separate_Run_Path_Options then - for Index in - Library_Paths.First .. Library_Paths.Last - loop - -- Add the length of the library dir plus one for the - -- directory separator. + -- We are going to create one switch of the form + -- "-Wl,-rpath,dir_N" for each directory to consider. - Length := - Length + - Library_Paths.Table (Index)'Length + 1; - end loop; + -- One switch for each library directory - -- Finally, add the length of the standard GNAT library dir + for Index in + Library_Paths.First .. Library_Paths.Last + loop + Last_Switches.Increment_Last; + Last_Switches.Table + (Last_Switches.Last) := new String' + (Path_Option.all & + Last_Switches.Table (Index).all); + end loop; - Length := Length + MLib.Utl.Lib_Directory'Length; - Option := new String (1 .. Length); - Option (1 .. Path_Option'Length) := Path_Option.all; - Current := Path_Option'Length; + -- One switch for the standard GNAT library dir. - -- Put each library dir followed by a dir separator + Last_Switches.Increment_Last; + Last_Switches.Table + (Last_Switches.Last) := new String' + (Path_Option.all & MLib.Utl.Lib_Directory); - for Index in - Library_Paths.First .. Library_Paths.Last - loop - Option - (Current + 1 .. + else + -- First, compute the exact length for the switch + + for Index in + Library_Paths.First .. Library_Paths.Last + loop + -- Add the length of the library dir plus one for the + -- directory separator. + + Length := + Length + + Library_Paths.Table (Index)'Length + 1; + end loop; + + -- Finally, add the length of the standard GNAT library dir + + Length := Length + MLib.Utl.Lib_Directory'Length; + Option := new String (1 .. Length); + Option (1 .. Path_Option'Length) := Path_Option.all; + Current := Path_Option'Length; + + -- Put each library dir followed by a dir separator + + for Index in + Library_Paths.First .. Library_Paths.Last + loop + Option + (Current + 1 .. + Current + + Library_Paths.Table (Index)'Length) := + Library_Paths.Table (Index).all; + Current := Current + - Library_Paths.Table (Index)'Length) := - Library_Paths.Table (Index).all; - Current := - Current + - Library_Paths.Table (Index)'Length + 1; - Option (Current) := Path_Separator; - end loop; + Library_Paths.Table (Index)'Length + 1; + Option (Current) := Path_Separator; + end loop; - -- Finally put the standard GNAT library dir + -- Finally put the standard GNAT library dir - Option - (Current + 1 .. - Current + MLib.Utl.Lib_Directory'Length) := - MLib.Utl.Lib_Directory; + Option + (Current + 1 .. + Current + MLib.Utl.Lib_Directory'Length) := + MLib.Utl.Lib_Directory; - -- And add the switch to the last switches + -- And add the switch to the last switches - Last_Switches.Increment_Last; - Last_Switches.Table (Last_Switches.Last) := - Option; + Last_Switches.Increment_Last; + Last_Switches.Table (Last_Switches.Last) := + Option; + end if; end; end if; end if; |