diff mbox series

[Ada] Fix PR ada/85036

Message ID 6935906.AuG60XJ7IE@polaris
State New
Headers show
Series [Ada] Fix PR ada/85036 | expand

Commit Message

Eric Botcazou March 23, 2018, 11:13 p.m. UTC
This is a fallout of my fix for PR ada/83016, which allowed the --LINK option 
of gnatlink to contain switches in addition to the linker itself.  There is a 
conflict with the switches passed with the --GCC option so this patch arranges 
for the former switches to take precedence over the latter switches when it 
comes to the final linking step.

Tested on x86-64/Linux, applied on the mainline.


2018-03-23  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/85036
	* gnatlink.adb (Process_Args): Drop existing link switches if multiple
	switches are passed for --LINK.
diff mbox series

Patch

Index: gnatlink.adb
===================================================================
--- gnatlink.adb	(revision 258629)
+++ gnatlink.adb	(working copy)
@@ -544,6 +544,11 @@  procedure Gnatlink is
                      end if;
 
                      --  The other arguments are passed as-is to the linker
+                     --  and override those coming from --GCC= if any.
+
+                     if L_Args.all'Last >= 2 then
+                        Gcc_Linker_Options.Set_Last (0);
+                     end if;
 
                      for J in 2 .. L_Args.all'Last loop
                         Gcc_Linker_Options.Increment_Last;