/usr/src/gcc-8/debian/patches/ada-link-shlib.diff is in gcc-8-source 8-20180414-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | Description: when linking Ada shared libraries, list dependencies after objects
In gnatlink, pass the options and libraries after objects to the
linker to avoid link failures with --as-needed.
This option is activated by default on the GNU gold linker.
.
GNAT has been announcing the removal of support for GPR projects
since gcc-6.
Gnatlink will then stop being able to link shared libraries.
This probably explains why upstream is not interested in this patch.
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=680292
Author: Matthias Klose <doko@debian.org>
Forwarded: http://gcc.gnu.org/ml/gcc-patches/2013-04/msg01132.html
--- a/src/gcc/ada/mlib-tgt-specific-linux.adb
+++ b/src/gcc/ada/mlib-tgt-specific-linux.adb
@@ -81,19 +81,54 @@
Version_Arg : String_Access;
Symbolic_Link_Needed : Boolean := False;
+ N_Options : Argument_List := Options;
+ Options_Last : Natural := N_Options'Last;
+ -- After moving -lxxx to Options_2, N_Options up to index Options_Last
+ -- will contain the Options to pass to MLib.Utl.Gcc.
+
+ Real_Options_2 : Argument_List (1 .. Options'Length);
+ Real_Options_2_Last : Natural := 0;
+ -- Real_Options_2 up to index Real_Options_2_Last will contain the
+ -- Options_2 to pass to MLib.Utl.Gcc.
+
begin
if Opt.Verbose_Mode then
Write_Str ("building relocatable shared library ");
Write_Line (Lib_Path);
end if;
+ -- Move all -lxxx to Options_2
+
+ declare
+ Index : Natural := N_Options'First;
+ Arg : String_Access;
+
+ begin
+ while Index <= Options_Last loop
+ Arg := N_Options (Index);
+
+ if Arg'Length > 2
+ and then Arg (Arg'First .. Arg'First + 1) = "-l"
+ then
+ Real_Options_2_Last := Real_Options_2_Last + 1;
+ Real_Options_2 (Real_Options_2_Last) := Arg;
+ N_Options (Index .. Options_Last - 1) :=
+ N_Options (Index + 1 .. Options_Last);
+ Options_Last := Options_Last - 1;
+
+ else
+ Index := Index + 1;
+ end if;
+ end loop;
+ end;
+
if Lib_Version = "" then
Utl.Gcc
(Output_File => Lib_Path,
Objects => Ofiles,
- Options => Options,
+ Options => N_Options (N_Options'First .. Options_Last),
Driver_Name => Driver_Name,
- Options_2 => No_Argument_List);
+ Options_2 => Real_Options_2 (1 .. Real_Options_2_Last));
else
declare
@@ -111,18 +146,20 @@
Utl.Gcc
(Output_File => Lib_Version,
Objects => Ofiles,
- Options => Options & Version_Arg,
+ Options => N_Options (N_Options'First .. Options_Last)
+ & Version_Arg,
Driver_Name => Driver_Name,
- Options_2 => No_Argument_List);
+ Options_2 => Real_Options_2 (1 .. Real_Options_2_Last));
Symbolic_Link_Needed := Lib_Version /= Lib_Path;
else
Utl.Gcc
(Output_File => Lib_Dir & Directory_Separator & Lib_Version,
Objects => Ofiles,
- Options => Options & Version_Arg,
+ Options => N_Options (N_Options'First .. Options_Last)
+ & Version_Arg,
Driver_Name => Driver_Name,
- Options_2 => No_Argument_List);
+ Options_2 => Real_Options_2 (1 .. Real_Options_2_Last));
Symbolic_Link_Needed :=
Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path;
end if;
|