diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-25 14:21:16 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-01-25 14:21:16 +0000 |
commit | bfcff2f0f0708e3ff43f6d7732a6bd5a0b4bd96a (patch) | |
tree | 54850037d6cfdb1cf7eb673529bc194fb29790cc /gcc/ada/gnatlink.adb | |
parent | fcc74387ed97a025b45ca1a634eabc4b9f234def (diff) | |
download | gcc-bfcff2f0f0708e3ff43f6d7732a6bd5a0b4bd96a.tar.gz |
2010-01-25 Florian Villoing <villoing@adacore.com>
* gnat_ugn.texi: Fix typo.
2010-01-25 Thomas Quinot <quinot@adacore.com>
* scos.ads: Update specification.
2010-01-25 Ed Schonberg <schonberg@adacore.com>
* sem_ch6.adb (Process_PPCs): If a postcondition is present and the
enclosing subprogram has no previous spec, attach postcondition
procedure to the defining entity for the body.
2010-01-25 Ed Schonberg <schonberg@adacore.com>
* exp_aggr.adb (Build_Record_Aggr_Code); Do not generate call to
initialization procedure of the ancestor part of an extension aggregate
if it is an interface type.
2010-01-25 Vincent Celier <celier@adacore.com>
* gnatlink.adb (Process_Binder_File): The directory for the shared
version of libgcc in the run path options is found in the subdirectory
indicated by __gnat_default_libgcc_subdir.
* link.c: Declare new const char * __gnat_default_libgcc_subdir for
each platform.
2010-01-25 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb: More flexible pragma Annotate.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156209 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatlink.adb')
-rw-r--r-- | gcc/ada/gnatlink.adb | 238 |
1 files changed, 134 insertions, 104 deletions
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index 708e1794d04..54dbadf0ac5 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -733,6 +733,11 @@ procedure Gnatlink is -- specifies the path where the dynamic loader should find shared -- libraries. Equal to null string if this system doesn't support it. + Libgcc_Subdir_Ptr : Interfaces.C.Strings.chars_ptr; + pragma Import (C, Libgcc_Subdir_Ptr, "__gnat_default_libgcc_subdir"); + -- Pointer to string indicating the installation subdirectory where + -- a default shared libgcc might be found. + Object_Library_Ext_Ptr : Interfaces.C.Strings.chars_ptr; pragma Import (C, Object_Library_Ext_Ptr, "__gnat_object_library_extension"); @@ -1210,143 +1215,168 @@ procedure Gnatlink is -- Also add path to find libgcc_s.so, if -- relevant. + declare + Path : String (1 .. File_Path'Length + 15); + Path_Last : constant Natural := + File_Path'Length; + + begin + Path (1 .. File_Path'Length) := + File_Path.all; + -- To find the location of the shared version -- of libgcc, we look for "gcc-lib" in the -- path of the library. However, this -- subdirectory is no longer present in - -- in recent version of GCC. So, we look for + -- recent versions of GCC. So, we look for -- the last subdirectory "lib" in the path. - GCC_Index := - Index (File_Path.all, "gcc-lib"); - - if GCC_Index /= 0 then - -- The shared version of libgcc is - -- located in the parent directory. + GCC_Index := + Index (Path (1 .. Path_Last), "gcc-lib"); - GCC_Index := GCC_Index - 1; + if GCC_Index /= 0 then + -- The shared version of libgcc is + -- located in the parent directory. - else - GCC_Index := - Index (File_Path.all, "/lib/"); + GCC_Index := GCC_Index - 1; - if GCC_Index = 0 then + else GCC_Index := - Index (File_Path.all, - Directory_Separator & - "lib" & - Directory_Separator); - end if; - - -- We have found a subdirectory "lib", - -- this is where the shared version of - -- libgcc should be located. + Index + (Path (1 .. Path_Last), + "/lib/"); + + if GCC_Index = 0 then + GCC_Index := + Index (Path (1 .. Path_Last), + Directory_Separator & + "lib" & + Directory_Separator); + end if; - if GCC_Index /= 0 then - GCC_Index := GCC_Index + 3; + -- If we have found a "lib" subdir in + -- the path to libgnat, the possible + -- shared libgcc of interest by default + -- is in libgcc_subdir at the same + -- level. + + if GCC_Index /= 0 then + declare + Subdir : constant String := + Value (Libgcc_Subdir_Ptr); + begin + Path + (GCC_Index + 1 .. + GCC_Index + Subdir'Length) := + Subdir; + GCC_Index := + GCC_Index + Subdir'Length; + end; + end if; end if; - end if; -- Look for an eventual run_path_option in -- the linker switches. - if Separate_Run_Path_Options then - Linker_Options.Increment_Last; - Linker_Options.Table - (Linker_Options.Last) := - new String' - (Run_Path_Opt - & File_Path - (1 .. File_Path'Length - - File_Name'Length)); - - if GCC_Index /= 0 then + if Separate_Run_Path_Options then Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := new String' (Run_Path_Opt - & File_Path (1 .. GCC_Index)); - end if; - else - for J in reverse - 1 .. Linker_Options.Last - loop - if Linker_Options.Table (J) /= null - and then - Linker_Options.Table (J)'Length - > Run_Path_Opt'Length - and then - Linker_Options.Table (J) - (1 .. Run_Path_Opt'Length) = - Run_Path_Opt - then - -- We have found a already specified - -- run_path_option: we will add to - -- this switch, because only one - -- run_path_option should be - -- specified. - - Run_Path_Opt_Index := J; - exit; - end if; - end loop; + & File_Path + (1 .. File_Path'Length + - File_Name'Length)); - -- If there is no run_path_option, we need - -- to add one. - - if Run_Path_Opt_Index = 0 then - Linker_Options.Increment_Last; - end if; - - if GCC_Index = 0 then - if Run_Path_Opt_Index = 0 then + if GCC_Index /= 0 then + Linker_Options.Increment_Last; Linker_Options.Table (Linker_Options.Last) := new String' (Run_Path_Opt - & File_Path - (1 .. File_Path'Length - - File_Name'Length)); - - else - Linker_Options.Table - (Run_Path_Opt_Index) := - new String' - (Linker_Options.Table - (Run_Path_Opt_Index).all - & Path_Separator - & File_Path - (1 .. File_Path'Length - - File_Name'Length)); + & Path (1 .. GCC_Index)); end if; - else + for J in reverse + 1 .. Linker_Options.Last + loop + if Linker_Options.Table (J) /= null + and then + Linker_Options.Table (J)'Length + > Run_Path_Opt'Length + and then + Linker_Options.Table (J) + (1 .. Run_Path_Opt'Length) = + Run_Path_Opt + then + -- We have found a already + -- specified run_path_option: we + -- will add to this switch, + -- because only one + -- run_path_option should be + -- specified. + + Run_Path_Opt_Index := J; + exit; + end if; + end loop; + + -- If there is no run_path_option, we + -- need to add one. + if Run_Path_Opt_Index = 0 then - Linker_Options.Table - (Linker_Options.Last) := - new String'(Run_Path_Opt - & File_Path - (1 .. File_Path'Length - - File_Name'Length) - & Path_Separator - & File_Path (1 .. GCC_Index)); + Linker_Options.Increment_Last; + end if; + + if GCC_Index = 0 then + if Run_Path_Opt_Index = 0 then + Linker_Options.Table + (Linker_Options.Last) := + new String' + (Run_Path_Opt + & File_Path + (1 .. File_Path'Length + - File_Name'Length)); + + else + Linker_Options.Table + (Run_Path_Opt_Index) := + new String' + (Linker_Options.Table + (Run_Path_Opt_Index).all + & Path_Separator + & File_Path + (1 .. File_Path'Length + - File_Name'Length)); + end if; else - Linker_Options.Table - (Run_Path_Opt_Index) := - new String' - (Linker_Options.Table - (Run_Path_Opt_Index).all - & Path_Separator - & File_Path - (1 .. File_Path'Length - - File_Name'Length) - & Path_Separator - & File_Path (1 .. GCC_Index)); + if Run_Path_Opt_Index = 0 then + Linker_Options.Table + (Linker_Options.Last) := + new String'(Run_Path_Opt + & File_Path + (1 .. File_Path'Length + - File_Name'Length) + & Path_Separator + & Path (1 .. GCC_Index)); + + else + Linker_Options.Table + (Run_Path_Opt_Index) := + new String' + (Linker_Options.Table + (Run_Path_Opt_Index).all + & Path_Separator + & File_Path + (1 .. File_Path'Length + - File_Name'Length) + & Path_Separator + & Path (1 .. GCC_Index)); + end if; end if; end if; - end if; + end; end if; end if; |