~ubuntu-branches/debian/sid/gcc-4.8/sid

« back to all changes in this revision

Viewing changes to .svn/pristine/83/8373feb477626e79212ec5c0f566b368ea8ad641.svn-base

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2014-12-19 19:48:34 UTC
  • Revision ID: package-import@ubuntu.com-20141219194834-4dz1q7rrn5pad823
Tags: 4.8.4-1
* GCC 4.8.4 release.
  - Fix PR target/61407 (darwin), PR middle-end/58624 (ice),
    PR sanitizer/64265 (wrong code).
* Require recent binutils to pass go test failures.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# DP: In gnatlink, pass the options and libraries after objects to the
 
2
# DP: linker to avoid link failures with --as-needed. Closes: #680292.
 
3
 
 
4
--- a/src/gcc/ada/mlib-tgt-specific-linux.adb
 
5
+++ b/src/gcc/ada/mlib-tgt-specific-linux.adb
 
6
@@ -81,19 +81,54 @@
 
7
       Version_Arg          : String_Access;
 
8
       Symbolic_Link_Needed : Boolean := False;
 
9
 
 
10
+      N_Options    : Argument_List := Options;
 
11
+      Options_Last : Natural := N_Options'Last;
 
12
+      --  After moving -lxxx to Options_2, N_Options up to index Options_Last
 
13
+      --  will contain the Options to pass to MLib.Utl.Gcc.
 
14
+
 
15
+      Real_Options_2 : Argument_List (1 .. Options'Length);
 
16
+      Real_Options_2_Last : Natural := 0;
 
17
+      --  Real_Options_2 up to index Real_Options_2_Last will contain the
 
18
+      --  Options_2 to pass to MLib.Utl.Gcc.
 
19
+
 
20
    begin
 
21
       if Opt.Verbose_Mode then
 
22
          Write_Str ("building relocatable shared library ");
 
23
          Write_Line (Lib_Path);
 
24
       end if;
 
25
 
 
26
+      --  Move all -lxxx to Options_2
 
27
+
 
28
+      declare
 
29
+         Index : Natural := N_Options'First;
 
30
+         Arg   : String_Access;
 
31
+
 
32
+      begin
 
33
+         while Index <= Options_Last loop
 
34
+            Arg := N_Options (Index);
 
35
+
 
36
+            if Arg'Length > 2
 
37
+              and then Arg (Arg'First .. Arg'First + 1) = "-l"
 
38
+            then
 
39
+               Real_Options_2_Last := Real_Options_2_Last + 1;
 
40
+               Real_Options_2 (Real_Options_2_Last) := Arg;
 
41
+               N_Options (Index .. Options_Last - 1) :=
 
42
+                 N_Options (Index + 1 .. Options_Last);
 
43
+               Options_Last := Options_Last - 1;
 
44
+
 
45
+            else
 
46
+               Index := Index + 1;
 
47
+            end if;
 
48
+         end loop;
 
49
+      end;
 
50
+
 
51
       if Lib_Version = "" then
 
52
          Utl.Gcc
 
53
            (Output_File => Lib_Path,
 
54
             Objects     => Ofiles,
 
55
-            Options     => Options,
 
56
+            Options     => N_Options (N_Options'First .. Options_Last),
 
57
             Driver_Name => Driver_Name,
 
58
-            Options_2   => No_Argument_List);
 
59
+            Options_2   => Real_Options_2 (1 .. Real_Options_2_Last));
 
60
 
 
61
       else
 
62
          declare
 
63
@@ -111,18 +146,18 @@
 
64
                Utl.Gcc
 
65
                  (Output_File => Lib_Version,
 
66
                   Objects     => Ofiles,
 
67
-                  Options     => Options & Version_Arg,
 
68
+                 Options     => N_Options (N_Options'First .. Options_Last) & Version_Arg,
 
69
                   Driver_Name => Driver_Name,
 
70
-                  Options_2   => No_Argument_List);
 
71
+                  Options_2   => Real_Options_2 (1 .. Real_Options_2_Last));
 
72
                Symbolic_Link_Needed := Lib_Version /= Lib_Path;
 
73
 
 
74
             else
 
75
                Utl.Gcc
 
76
                  (Output_File => Lib_Dir & Directory_Separator & Lib_Version,
 
77
                   Objects     => Ofiles,
 
78
-                  Options     => Options & Version_Arg,
 
79
+                 Options     => N_Options (N_Options'First .. Options_Last) & Version_Arg,
 
80
                   Driver_Name => Driver_Name,
 
81
-                  Options_2   => No_Argument_List);
 
82
+                  Options_2   => Real_Options_2 (1 .. Real_Options_2_Last));
 
83
                Symbolic_Link_Needed :=
 
84
                  Lib_Dir & Directory_Separator & Lib_Version /= Lib_Path;
 
85
             end if;