aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2007-08-14 10:48:07 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2007-08-14 10:48:07 +0200
commit7a912730535b73d3bece5a80a91efca68b6cb74a (patch)
treebdff4b70efae888a74f505a86da9f2c0049b53e1 /gcc
parent171d182e7f3a5cb93f9e95aded02ed5a2d48e0c4 (diff)
downloadgcc-7a912730535b73d3bece5a80a91efca68b6cb74a.zip
gcc-7a912730535b73d3bece5a80a91efca68b6cb74a.tar.gz
gcc-7a912730535b73d3bece5a80a91efca68b6cb74a.tar.bz2
gnatlink.adb (Gnatlink): Pass switches to the linker even if the binder-generated file is not in Ada.
2007-08-14 Eric Botcazou <ebotcazou@adacore.com> * gnatlink.adb (Gnatlink): Pass switches to the linker even if the binder-generated file is not in Ada. Pass -mrtp to the linker if it is GCC and --RTS=rtp has been recorded in the ALI file. Pass -fsjlj to the linker if it is GCC and --RTS=sjlj has been recorded. From-SVN: r127452
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gnatlink.adb53
1 files changed, 45 insertions, 8 deletions
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index de898c5..9d79b0a 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -1549,21 +1549,58 @@ begin
Index in Units.Table (ALIs.Table (A).First_Unit).First_Arg ..
Units.Table (ALIs.Table (A).First_Unit).Last_Arg
loop
- -- Do not compile with the front end switches except for --RTS
- -- if the binder generated file is in Ada.
+ -- Do not compile with the front end switches. However, --RTS
+ -- is to be dealt with specially because it needs to be passed
+ -- if the binder-generated file is in Ada and may also be used
+ -- to drive the linker.
declare
Arg : String_Ptr renames Args.Table (Index);
begin
- if not Is_Front_End_Switch (Arg.all)
- or else
- (Ada_Bind_File
- and then Arg'Length > 5
- and then Arg (Arg'First + 2 .. Arg'First + 5) = "RTS=")
- then
+ if not Is_Front_End_Switch (Arg.all) then
Binder_Options_From_ALI.Increment_Last;
Binder_Options_From_ALI.Table
(Binder_Options_From_ALI.Last) := String_Access (Arg);
+
+ elsif Arg'Length > 5
+ and then Arg (Arg'First + 2 .. Arg'First + 5) = "RTS="
+ then
+ if Ada_Bind_File then
+ Binder_Options_From_ALI.Increment_Last;
+ Binder_Options_From_ALI.Table
+ (Binder_Options_From_ALI.Last)
+ := String_Access (Arg);
+ end if;
+
+ -- GNAT doesn't support the GCC multilib mechanism.
+ -- This means that, when a multilib switch is used
+ -- to request a particular compilation mode, the
+ -- corresponding runtime switch (--RTS) must also be
+ -- specified. The long-term goal is to fully support the
+ -- multilib mechanism; however, in the meantime, it is
+ -- convenient to eliminate the redundancy by keying the
+ -- compilation mode on a single switch, namely --RTS.
+
+ -- Pass -mrtp to the linker if --RTS=rtp was passed.
+
+ if Linker_Path = Gcc_Path
+ and then Arg'Length > 8
+ and then Arg (Arg'First + 6 .. Arg'First + 8) = "rtp"
+ then
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) :=
+ new String'("-mrtp");
+
+ -- Pass -fsjlj to the linker if --RTS=sjlj was passed.
+
+ elsif Linker_Path = Gcc_Path
+ and then Arg'Length > 9
+ and then Arg (Arg'First + 6 .. Arg'First + 9) = "sjlj"
+ then
+ Linker_Options.Increment_Last;
+ Linker_Options.Table (Linker_Options.Last) :=
+ new String'("-fsjlj");
+ end if;
end if;
end;
end loop;