From: charlet Date: Tue, 14 Aug 2007 08:48:07 +0000 (+0000) Subject: 2007-08-14 Eric Botcazou X-Git-Tag: upstream/4.9.2~46938 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bc2e722a9566ed1d57f235380639b4f83db0c5a4;p=platform%2Fupstream%2Flinaro-gcc.git 2007-08-14 Eric Botcazou * 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 --- 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;