diff options
Diffstat (limited to 'gcc/ada/gnatlink.adb')
-rw-r--r-- | gcc/ada/gnatlink.adb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb index 123cff59800..ed01ba859fa 100644 --- a/gcc/ada/gnatlink.adb +++ b/gcc/ada/gnatlink.adb @@ -619,6 +619,10 @@ procedure Gnatlink is GNAT_Shared : Boolean := False; -- Save state of -shared option. + Xlinker_Was_Previous : Boolean := False; + -- Indicate that "-Xlinker" was the option preceding the current + -- option. If True, then the current option is never suppressed. + -- Rollback data -- These data items are used to store current binder file context. @@ -936,8 +940,17 @@ procedure Gnatlink is -- Process switches and options if Next_Line (Nfirst .. Nlast) /= End_Info then + Xlinker_Was_Previous := False; + loop - if Next_Line (Nfirst .. Nlast) = "-static" then + if Xlinker_Was_Previous + or else Next_Line (Nfirst .. Nlast) = "-Xlinker" + then + Linker_Options.Increment_Last; + Linker_Options.Table (Linker_Options.Last) := + new String'(Next_Line (Nfirst .. Nlast)); + + elsif Next_Line (Nfirst .. Nlast) = "-static" then GNAT_Static := True; elsif Next_Line (Nfirst .. Nlast) = "-shared" then @@ -946,9 +959,7 @@ procedure Gnatlink is -- Add binder options only if not already set on the command -- line. This rule is a way to control the linker options order. - elsif not Is_Option_Present (Next_Line (Nfirst .. Nlast)) - or else Next_Line (Nfirst .. Nlast) = "-Xlinker" - then + elsif not Is_Option_Present (Next_Line (Nfirst .. Nlast)) then if Nlast > Nfirst + 2 and then Next_Line (Nfirst .. Nfirst + 1) = "-L" then @@ -1125,6 +1136,8 @@ procedure Gnatlink is end if; end if; + Xlinker_Was_Previous := Next_Line (Nfirst .. Nlast) = "-Xlinker"; + Get_Next_Line; exit when Next_Line (Nfirst .. Nlast) = End_Info; |