summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatlink.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-13 11:51:34 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-01-13 11:51:34 +0000
commit0914a918f13c3934753e8a1721e660fd2e0cb551 (patch)
tree6815f7bd6ae4c52b808b0e67e421256c4df38f67 /gcc/ada/gnatlink.adb
parent708f6f12397a72cf087f064ed2f59f6fa1f4ffe9 (diff)
downloadgcc-0914a918f13c3934753e8a1721e660fd2e0cb551.tar.gz
2004-01-13 Ed Schonberg <schonberg@gnat.com>
* exp_ch3.adb (Build_Assignment): Fix bug in handling of controlled components that are initialized with aggregates. 2004-01-13 Vincent Celier <celier@gnat.com> * gnatlink.adb (Process_Binder_File): To find directory of shared libgcc, if "gcc-lib" is not a subdirectory, look for the last subdirectory "lib" in the path of the shared libgnat or libgnarl. * make.adb (Gnatmake): If GCC version is at least 3, link with -shared-libgcc, when there is at least one shared library project. * opt.ads (GCC_Version): New integer constant. * adaint.c (get_gcc_version): New function. 2004-01-13 Robert Dewar <dewar@gnat.com> * sem_dist.adb, sem_res.adb, sem_util.adb, sprint.adb, 3zsocthi.adb, einfo.adb, cstand.adb, exp_ch4.adb, exp_ch9.adb, exp_dist.adb: Minor reformatting 2004-01-13 Thomas Quinot <quinot@act-europe.fr> * s-interr.adb, s-stache.adb, s-taenca.adb, g-regpat.adb, g-spitbo.adb, 5itaprop.adb: Add missing 'constant' keywords in object declarations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75802 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gnatlink.adb')
-rw-r--r--gcc/ada/gnatlink.adb46
1 files changed, 41 insertions, 5 deletions
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index c1b11ba597c..08ad0d8da08 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -678,7 +678,7 @@ procedure Gnatlink is
-- terminator.
function Index (S, Pattern : String) return Natural;
- -- Return the first occurrence of Pattern in S, or 0 if none.
+ -- Return the last occurrence of Pattern in S, or 0 if none.
function Is_Option_Present (Opt : in String) return Boolean;
-- Return true if the option Opt is already present in
@@ -727,8 +727,9 @@ procedure Gnatlink is
function Index (S, Pattern : String) return Natural is
Len : constant Natural := Pattern'Length;
+
begin
- for J in S'First .. S'Last - Len + 1 loop
+ for J in reverse S'First .. S'Last - Len + 1 loop
if Pattern = S (J .. J + Len - 1) then
return J;
end if;
@@ -1061,7 +1062,42 @@ procedure Gnatlink is
-- Also add path to find libgcc_s.so, if
-- relevant.
- GCC_Index := Index (File_Path.all, "gcc-lib");
+ -- 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
+ -- 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 := GCC_Index - 1;
+
+ else
+ GCC_Index :=
+ Index (File_Path.all, "/lib/");
+
+ if GCC_Index = 0 then
+ 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.
+
+ if GCC_Index /= 0 then
+ GCC_Index := GCC_Index + 3;
+ end if;
+ end if;
-- Look for an eventual run_path_option in
-- the linker switches.
@@ -1124,7 +1160,7 @@ procedure Gnatlink is
(1 .. File_Path'Length
- File_Name'Length)
& Path_Separator
- & File_Path (1 .. GCC_Index - 1));
+ & File_Path (1 .. GCC_Index));
else
Linker_Options.Table
@@ -1137,7 +1173,7 @@ procedure Gnatlink is
(1 .. File_Path'Length
- File_Name'Length)
& Path_Separator
- & File_Path (1 .. GCC_Index - 1));
+ & File_Path (1 .. GCC_Index));
end if;
end if;
end if;