diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:48:07 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-08-14 08:48:07 +0000 |
commit | bc2e722a9566ed1d57f235380639b4f83db0c5a4 (patch) | |
tree | bdff4b70efae888a74f505a86da9f2c0049b53e1 | |
parent | f98de29af633969064d34371b789a58000af8c1e (diff) | |
download | gcc-bc2e722a9566ed1d57f235380639b4f83db0c5a4.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127452 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/gnatlink.adb | 53 |
1 files changed, 45 insertions, 8 deletions
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index de898c5a5a4..9d79b0a91ce 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; |