aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2012-05-25 09:24:08 +0000
committerEric Botcazou <ebotcazou@adacore.com>2012-05-25 09:24:08 +0000
commit461a084f2a88d783d44071df4d0c75e00ffbb77c (patch)
tree046da996c3e8398f97233d73b99d4888fb28c026
parentc6db9b46e63710c79478d7b90bf21fdd1919e9bc (diff)
PR ada/52362
* config.gcc (i[34567]86-*-mingw* | x86_64-*-mingw*): Set gas and gnu_ld variables to yes. * configure.ac (HAVE_GNU_LD): Move to after config.gcc inclusion. (HAVE_GNU_AS): Likewise. * config.in: Regenerate. * configure: Likewise. ada/ * link.c (__gnat_object_file_option): Set to "-Wl,@" for GNU linker. (__gnat_using_gnu_linker): Delete. * gnatlink.adb (Gnatlink): Declare Object_File_Option_Ptr here... Declare Object_File_Option string constant and Using_GNU_response_file boolean constant. (Process_Binder_File): ...instead of here.  Delete Using_GNU_Linker, Opening and Closing local variables.  Do not handle the GNU linker specially. (Write_RF): New procedure to write into the response file.  Escape some characters if a GNU response file is used.  Keep track of error status. Invoke Write_RF to write into the response file.  Delete the file only if the link was successful. * mlib-utl.adb: Do not `with' package System. (Gcc): Likewise.  Declare Object_File_Option string constant and Using_GNU_response_file boolean constant. (Write_RF): Take a string instead of address and length.  Escape some characters if a GNU response file is used. Invoke Write_RF to write into the response file.  Delete the file only if the link was successful.  Do not warn if it cannot be deleted. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@187874 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/ada/ChangeLog23
-rw-r--r--gcc/ada/gnatlink.adb137
-rw-r--r--gcc/ada/link.c34
-rw-r--r--gcc/ada/mlib-utl.adb117
-rw-r--r--gcc/config.gcc2
-rw-r--r--gcc/config.in15
-rwxr-xr-xgcc/configure28
-rw-r--r--gcc/configure.ac12
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/lto14.adb7
11 files changed, 190 insertions, 199 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index efb953651cd..772d897f4ba 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2012-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/52362
+ * config.gcc (i[34567]86-*-mingw* | x86_64-*-mingw*): Set gas and
+ gnu_ld variables to yes.
+ * configure.ac (HAVE_GNU_LD): Move to after config.gcc inclusion.
+ (HAVE_GNU_AS): Likewise.
+ * config.in: Regenerate.
+ * configure: Likewise.
+
2012-05-25 Tristan Gingold <gingold@adacore.com>
* config/i386/i386.c (struct ix86_frame): Remove unused frame field.
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 744f6eb89b9..1c5d7f7c4a5 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,26 @@
+2012-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR ada/52362
+ * link.c (__gnat_object_file_option): Set to "-Wl,@" for GNU linker.
+ (__gnat_using_gnu_linker): Delete.
+ * gnatlink.adb (Gnatlink): Declare Object_File_Option_Ptr here...
+ Declare Object_File_Option string constant and Using_GNU_response_file
+ boolean constant.
+ (Process_Binder_File): ...instead of here.  Delete Using_GNU_Linker,
+ Opening and Closing local variables.  Do not handle the GNU linker
+ specially.
+ (Write_RF): New procedure to write into the response file.  Escape some
+ characters if a GNU response file is used.  Keep track of error status.
+ Invoke Write_RF to write into the response file.  Delete the file only
+ if the link was successful.
+ * mlib-utl.adb: Do not `with' package System.
+ (Gcc): Likewise.  Declare Object_File_Option string constant and
+ Using_GNU_response_file boolean constant.
+ (Write_RF): Take a string instead of address and length.  Escape some
+ characters if a GNU response file is used.
+ Invoke Write_RF to write into the response file.  Delete the file only
+ if the link was successful.  Do not warn if it cannot be deleted.
+
2012-05-20 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/utils.c (gnat_write_global_declarations): Put a name
diff --git a/gcc/ada/gnatlink.adb b/gcc/ada/gnatlink.adb
index 09ce5bb0f5d..d6834ab5ae2 100644
--- a/gcc/ada/gnatlink.adb
+++ b/gcc/ada/gnatlink.adb
@@ -178,6 +178,19 @@ procedure Gnatlink is
-- Predicate indicating whether the linker has an option whereby the
-- names of object files can be passed to the linker in a file.
+ Object_File_Option_Ptr : Interfaces.C.Strings.chars_ptr;
+ pragma Import (C, Object_File_Option_Ptr, "__gnat_object_file_option");
+ -- Pointer to a string representing the linker option which specifies
+ -- the response file.
+
+ Object_File_Option : constant String := Value (Object_File_Option_Ptr);
+ -- The linker option which specifies the response file as a string
+
+ Using_GNU_response_file : constant Boolean :=
+ Object_File_Option'Length > 0
+ and then Object_File_Option (Object_File_Option'Last) = '@';
+ -- Whether a GNU response file is used
+
Object_List_File_Required : Boolean := False;
-- Set to True to force generation of a response file
@@ -760,28 +773,12 @@ procedure Gnatlink is
-- Pointer to string specifying the default extension for
-- object libraries, e.g. Unix uses ".a", VMS uses ".olb".
- Object_File_Option_Ptr : Interfaces.C.Strings.chars_ptr;
- pragma Import (C, Object_File_Option_Ptr, "__gnat_object_file_option");
- -- Pointer to a string representing the linker option which specifies
- -- the response file.
-
- Using_GNU_Linker : Boolean;
- for Using_GNU_Linker'Size use Character'Size;
- pragma Import (C, Using_GNU_Linker, "__gnat_using_gnu_linker");
- -- Predicate indicating whether this target uses the GNU linker. In
- -- this case we must output a GNU linker compatible response file.
-
Separate_Run_Path_Options : Boolean;
for Separate_Run_Path_Options'Size use Character'Size;
pragma Import
(C, Separate_Run_Path_Options, "__gnat_separate_run_path_options");
-- Whether separate rpath options should be emitted for each directory
- Opening : aliased constant String := """";
- Closing : aliased constant String := '"' & ASCII.LF;
- -- Needed to quote object paths in object list files when GNU linker
- -- is used.
-
procedure Get_Next_Line;
-- Read the next line from the binder file without the line
-- terminator.
@@ -804,6 +801,10 @@ procedure Gnatlink is
-- after Store_File_Context. The binder file context will be restored
-- with the data stored by the last Store_File_Context call.
+ procedure Write_RF (S : String);
+ -- Write a string to the response file and check if it was successful.
+ -- Fail the program if it was not successful (disk full).
+
-------------------
-- Get_Next_Line --
-------------------
@@ -897,6 +898,46 @@ procedure Gnatlink is
end if;
end Store_File_Context;
+ --------------
+ -- Write_RF --
+ --------------
+
+ procedure Write_RF (S : String) is
+ Success : Boolean := True;
+ begin
+ -- If a GNU response file is used, space and backslash need to be
+ -- escaped because they are interpreted as a string separator and
+ -- an escape character respectively by the underlying mechanism.
+ -- On the other hand, quote and double-quote are not escaped since
+ -- they are interpreted as string delimiters on both sides.
+
+ if Using_GNU_response_file then
+ for I in S'Range loop
+ if S (I) = ' ' or else S (I) = '\' then
+ if Write (Tname_FD, ASCII.BACK_SLASH'Address, 1) /= 1 then
+ Success := False;
+ end if;
+ end if;
+
+ if Write (Tname_FD, S (I)'Address, 1) /= 1 then
+ Success := False;
+ end if;
+ end loop;
+ else
+ if Write (Tname_FD, S'Address, S'Length) /= S'Length then
+ Success := False;
+ end if;
+ end if;
+
+ if Write (Tname_FD, ASCII.LF'Address, 1) /= 1 then
+ Success := False;
+ end if;
+
+ if not Success then
+ Exit_With_Error ("Error generating response file: disk full");
+ end if;
+ end Write_RF;
+
-- Start of processing for Process_Binder_File
begin
@@ -985,61 +1026,14 @@ procedure Gnatlink is
-- ??? Status of Write and Close operations should be checked, and
-- failure should occur if a status is wrong.
- -- If target is using the GNU linker we must add a special header
- -- and footer in the response file.
-
- -- The syntax is : INPUT (object1.o object2.o ... )
-
- -- Because the GNU linker does not like name with characters such
- -- as '!', we must put the object paths between double quotes.
-
- if Using_GNU_Linker then
- declare
- GNU_Header : aliased constant String := "INPUT (";
-
- begin
- Status := Write (Tname_FD, GNU_Header'Address,
- GNU_Header'Length);
- end;
- end if;
-
for J in Objs_Begin .. Objs_End loop
-
- -- Opening quote for GNU linker
-
- if Using_GNU_Linker then
- Status := Write (Tname_FD, Opening'Address, 1);
- end if;
-
- Status := Write (Tname_FD, Linker_Objects.Table (J).all'Address,
- Linker_Objects.Table (J).all'Length);
-
- -- Closing quote for GNU linker
-
- if Using_GNU_Linker then
- Status := Write (Tname_FD, Closing'Address, 2);
-
- else
- Status := Write (Tname_FD, ASCII.LF'Address, 1);
- end if;
+ Write_RF (Linker_Objects.Table (J).all);
Response_File_Objects.Increment_Last;
Response_File_Objects.Table (Response_File_Objects.Last) :=
Linker_Objects.Table (J);
end loop;
- -- Handle GNU linker response file footer
-
- if Using_GNU_Linker then
- declare
- GNU_Footer : aliased constant String := ")";
-
- begin
- Status := Write (Tname_FD, GNU_Footer'Address,
- GNU_Footer'Length);
- end;
- end if;
-
Close (Tname_FD, Closing_Status);
-- Add the special objects list file option together with the name
@@ -1047,7 +1041,7 @@ procedure Gnatlink is
-- file table.
Linker_Objects.Table (Objs_Begin) :=
- new String'(Value (Object_File_Option_Ptr) &
+ new String'(Object_File_Option &
Tname (Tname'First .. Tname'Last - 1));
-- The slots containing these object file names are then removed
@@ -2213,14 +2207,15 @@ begin
System.OS_Lib.Spawn (Linker_Path.all, Args, Success);
- -- Delete the temporary file used in conjunction with linking if
- -- one was created. See Process_Bind_File for details.
+ if Success then
+ -- Delete the temporary file used in conjunction with linking
+ -- if one was created. See Process_Bind_File for details.
- if Tname_FD /= Invalid_FD then
- Delete (Tname);
- end if;
+ if Tname_FD /= Invalid_FD then
+ Delete (Tname);
+ end if;
- if not Success then
+ else
Error_Msg ("error when calling " & Linker_Path.all);
Exit_Program (E_Fatal);
end if;
diff --git a/gcc/ada/link.c b/gcc/ada/link.c
index 88c48467a21..8a8e12033d7 100644
--- a/gcc/ada/link.c
+++ b/gcc/ada/link.c
@@ -72,38 +72,22 @@ extern "C" {
/* shared_libgcc_default gives the system dependent link method that */
/* be used by default for linking libgcc (shared or static) */
-/* using_gnu_linker is set to 1 when the GNU linker is used under this */
-/* target. */
-
/* separate_run_path_options is set to 1 when separate "rpath" arguments */
/* must be passed to the linker for each directory in the rpath. */
/* default_libgcc_subdir is the subdirectory name (from the installation */
/* root) where we may find a shared libgcc to use by default. */
-/* RESPONSE FILE & GNU LINKER */
-/* -------------------------- */
-/* objlist_file_supported and using_gnu_link used together tell gnatlink */
-/* to generate a GNU style response file. Note that object_file_option */
-/* must be set to "" in this case, since no option is required for a */
-/* response file to be passed to GNU ld. With a GNU linker we use the */
-/* linker script to implement the response file feature. Any file passed */
-/* in the GNU ld command line with an unknown extension is supposed to be */
-/* a linker script. Each linker script augment the current configuration. */
-/* The format of such response file is as follow : */
-/* INPUT (obj1.p obj2.o ...) */
-
#define SHARED 'H'
#define STATIC 'T'
#if defined (__WIN32)
-const char *__gnat_object_file_option = "";
+const char *__gnat_object_file_option = "-Wl,@";
const char *__gnat_run_path_option = "";
int __gnat_link_max = 30000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
-unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -115,19 +99,17 @@ int __gnat_link_max = 5000;
unsigned char __gnat_objlist_file_supported = 1;
char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (__FreeBSD__)
-const char *__gnat_object_file_option = "";
+const char *__gnat_object_file_option = "-Wl,@";
const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
-unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -139,19 +121,17 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = SHARED;
int __gnat_link_max = 262144;
unsigned char __gnat_objlist_file_supported = 1;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 1;
const char *__gnat_default_libgcc_subdir = "lib";
#elif defined (linux) || defined(__GLIBC__)
-const char *__gnat_object_file_option = "";
+const char *__gnat_object_file_option = "-Wl,@";
const char *__gnat_run_path_option = "-Wl,-rpath,";
char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
-unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
#if defined (__x86_64)
@@ -174,7 +154,6 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 15000;
const unsigned char __gnat_objlist_file_supported = 1;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -183,13 +162,12 @@ const char *__gnat_default_libgcc_subdir = "lib";
/* These are the settings for all systems that use gnu ld. GNU style response
file is supported, the shared library default is STATIC. */
-const char *__gnat_object_file_option = "";
+const char *__gnat_object_file_option = "-Wl,@";
const char *__gnat_run_path_option = "";
char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 8192;
unsigned char __gnat_objlist_file_supported = 1;
-unsigned char __gnat_using_gnu_linker = 1;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -201,7 +179,6 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".olb";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -213,7 +190,6 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
#if defined (__sparc_v9__) || defined (__sparcv9)
@@ -231,7 +207,6 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
@@ -246,7 +221,6 @@ char __gnat_shared_libgnat_default = STATIC;
char __gnat_shared_libgcc_default = STATIC;
int __gnat_link_max = 2147483647;
unsigned char __gnat_objlist_file_supported = 0;
-unsigned char __gnat_using_gnu_linker = 0;
const char *__gnat_object_library_extension = ".a";
unsigned char __gnat_separate_run_path_options = 0;
const char *__gnat_default_libgcc_subdir = "lib";
diff --git a/gcc/ada/mlib-utl.adb b/gcc/ada/mlib-utl.adb
index 215fa5d6e8d..2e3f0c0c108 100644
--- a/gcc/ada/mlib-utl.adb
+++ b/gcc/ada/mlib-utl.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2002-2011, AdaCore --
+-- Copyright (C) 2002-2012, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -31,8 +31,6 @@ with Output; use Output;
with Interfaces.C.Strings; use Interfaces.C.Strings;
-with System;
-
package body MLib.Utl is
Adalib_Path : String_Access := null;
@@ -353,16 +351,13 @@ package body MLib.Utl is
-- Pointer to a string representing the linker option which specifies
-- the response file.
- Using_GNU_Linker : Boolean;
- for Using_GNU_Linker'Size use Character'Size;
- pragma Import (C, Using_GNU_Linker, "__gnat_using_gnu_linker");
- -- Predicate indicating whether this target uses the GNU linker. In
- -- this case we must output a GNU linker compatible response file.
+ Object_File_Option : constant String := Value (Object_File_Option_Ptr);
+ -- The linker option which specifies the response file as a string
- Opening : aliased constant String := """";
- Closing : aliased constant String := '"' & ASCII.LF;
- -- Needed to quote object paths in object list files when GNU linker
- -- is used.
+ Using_GNU_response_file : constant Boolean :=
+ Object_File_Option'Length > 0
+ and then Object_File_Option (Object_File_Option'Last) = '@';
+ -- Whether a GNU response file is used
Tname : String_Access;
Tname_FD : File_Descriptor := Invalid_FD;
@@ -390,7 +385,7 @@ package body MLib.Utl is
Position : Object_Position;
- procedure Write_RF (A : System.Address; N : Integer);
+ procedure Write_RF (S : String);
-- Write a string to the response file and check if it was successful.
-- Fail the program if it was not successful (disk full).
@@ -398,12 +393,38 @@ package body MLib.Utl is
-- Write_RF --
--------------
- procedure Write_RF (A : System.Address; N : Integer) is
- Status : Integer;
+ procedure Write_RF (S : String) is
+ Success : Boolean := True;
begin
- Status := Write (Tname_FD, A, N);
+ -- If a GNU response file is used, space and backslash need to be
+ -- escaped because they are interpreted as a string separator and
+ -- an escape character respectively by the underlying mechanism.
+ -- On the other hand, quote and double-quote are not escaped since
+ -- they are interpreted as string delimiters on both sides.
+
+ if Using_GNU_response_file then
+ for I in S'Range loop
+ if S (I) = ' ' or else S (I) = '\' then
+ if Write (Tname_FD, ASCII.BACK_SLASH'Address, 1) /= 1 then
+ Success := False;
+ end if;
+ end if;
- if Status /= N then
+ if Write (Tname_FD, S (I)'Address, 1) /= 1 then
+ Success := False;
+ end if;
+ end loop;
+ else
+ if Write (Tname_FD, S'Address, S'Length) /= S'Length then
+ Success := False;
+ end if;
+ end if;
+
+ if Write (Tname_FD, ASCII.LF'Address, 1) /= 1 then
+ Success := False;
+ end if;
+
+ if not Success then
Fail ("cannot generate response file to link library: disk full");
end if;
end Write_RF;
@@ -529,53 +550,10 @@ package body MLib.Utl is
Create_Temp_File (Tname_FD, Tname);
- -- If target is using the GNU linker we must add a special header
- -- and footer in the response file.
-
- -- The syntax is : INPUT (object1.o object2.o ... )
-
- -- Because the GNU linker does not like name with characters such
- -- as '!', we must put the object paths between double quotes.
-
- if Using_GNU_Linker then
- declare
- GNU_Header : aliased constant String := "INPUT (";
-
- begin
- Write_RF (GNU_Header'Address, GNU_Header'Length);
- end;
- end if;
-
for J in Objects'Range loop
- -- Opening quote for GNU linker
-
- if Using_GNU_Linker then
- Write_RF (Opening'Address, 1);
- end if;
-
- Write_RF (Objects (J).all'Address, Objects (J).all'Length);
-
- -- Closing quote for GNU linker
-
- if Using_GNU_Linker then
- Write_RF (Closing'Address, 2);
-
- else
- Write_RF (ASCII.LF'Address, 1);
- end if;
+ Write_RF (Objects (J).all);
end loop;
- -- Handle GNU linker response file footer
-
- if Using_GNU_Linker then
- declare
- GNU_Footer : aliased constant String := ")";
-
- begin
- Write_RF (GNU_Footer'Address, GNU_Footer'Length);
- end;
- end if;
-
Close (Tname_FD, Closing_Status);
if not Closing_Status then
@@ -583,8 +561,7 @@ package body MLib.Utl is
end if;
A := A + 1;
- Arguments (A) :=
- new String'(Value (Object_File_Option_Ptr) & Tname.all);
+ Arguments (A) := new String'(Object_File_Option & Tname.all);
else
A := A + Objects'Length;
@@ -596,17 +573,15 @@ package body MLib.Utl is
Spawn (Driver.all, Arguments (1 .. A), Success);
- if Tname /= null then
- Delete_File (Tname.all, Closing_Status);
+ if Success then
+ -- Delete the temporary file used in conjunction with linking
+ -- if one was created.
- if not Closing_Status then
- Write_Str ("warning: could not delete response file """);
- Write_Str (Tname.all);
- Write_Line (""" to link library");
+ if Tname_FD /= Invalid_FD then
+ Delete_File (Tname.all);
end if;
- end if;
- if not Success then
+ else
if Driver_Name = No_Name then
Fail (Gcc_Name.all & " execution error");
else
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 5d73470bebd..7ec184cd964 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1470,6 +1470,8 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
extra_objs="winnt.o winnt-stubs.o"
c_target_objs="${c_target_objs} msformat-c.o"
cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
+ gas=yes
+ gnu_ld=yes
default_use_cxa_atexit=yes
use_gcc_stdint=wrap
case ${enable_threads} in
diff --git a/gcc/config.in b/gcc/config.in
index 9eefc9787b0..7b12b4bd3c7 100644
--- a/gcc/config.in
+++ b/gcc/config.in
@@ -333,6 +333,12 @@
#endif
+/* Define if your assembler supports HLE prefixes. */
+#ifndef USED_FOR_TARGET
+#undef HAVE_AS_IX86_HLE
+#endif
+
+
/* Define if your assembler supports the .quad directive. */
#ifndef USED_FOR_TARGET
#undef HAVE_AS_IX86_QUAD
@@ -350,11 +356,6 @@
#undef HAVE_AS_IX86_SAHF
#endif
-/* Define if your assembler supports HLE prefixes. */
-#ifndef USED_FOR_TARGET
-#undef HAVE_AS_IX86_HLE
-#endif
-
/* Define if your assembler supports the swap suffix. */
#ifndef USED_FOR_TARGET
@@ -1096,7 +1097,7 @@
#endif
-/* Define if using GNU as. */
+/* Define to 1 if using GNU as. */
#ifndef USED_FOR_TARGET
#undef HAVE_GNU_AS
#endif
@@ -1108,7 +1109,7 @@
#endif
-/* Define if using GNU ld. */
+/* Define to 1 if using GNU ld. */
#ifndef USED_FOR_TARGET
#undef HAVE_GNU_LD
#endif
diff --git a/gcc/configure b/gcc/configure
index db2021ca2d4..1cd61344511 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -3393,13 +3393,6 @@ _ACEOF
fi
-gnu_ld=`if test x"$gnu_ld_flag" = x"yes"; then echo 1; else echo 0; fi`
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_GNU_LD $gnu_ld
-_ACEOF
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a default linker was specified" >&5
$as_echo_n "checking whether a default linker was specified... " >&6; }
if test x"${DEFAULT_LINKER+set}" = x"set"; then
@@ -3458,13 +3451,6 @@ _ACEOF
fi
-gnu_as=`if test x"$gas_flag" = x"yes"; then echo 1; else echo 0; fi`
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_GNU_AS $gnu_as
-_ACEOF
-
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a default assembler was specified" >&5
$as_echo_n "checking whether a default assembler was specified... " >&6; }
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
@@ -11165,6 +11151,20 @@ $as_echo "#define USE_LONG_LONG_FOR_WIDEST_FAST_INT 1" >>confdefs.h
fi
+gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GNU_LD $gnu_ld_bool
+_ACEOF
+
+
+gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_GNU_AS $gnu_as_bool
+_ACEOF
+
+
count=a
for f in $host_xm_file; do
count=${count}x
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 6b793c4b205..a3a40389a3c 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -213,9 +213,6 @@ if test x"${DEFAULT_LINKER+set}" = x"set"; then
[Define to enable the use of a default linker.])
fi
-gnu_ld=`if test x"$gnu_ld_flag" = x"yes"; then echo 1; else echo 0; fi`
-AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld, [Define if using GNU ld.])
-
AC_MSG_CHECKING([whether a default linker was specified])
if test x"${DEFAULT_LINKER+set}" = x"set"; then
if test x"$gnu_ld_flag" = x"no"; then
@@ -256,9 +253,6 @@ if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
[Define to enable the use of a default assembler.])
fi
-gnu_as=`if test x"$gas_flag" = x"yes"; then echo 1; else echo 0; fi`
-AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as, [Define if using GNU as.])
-
AC_MSG_CHECKING([whether a default assembler was specified])
if test x"${DEFAULT_ASSEMBLER+set}" = x"set"; then
if test x"$gas_flag" = x"no"; then
@@ -1328,6 +1322,12 @@ if test x$use_long_long_for_widest_fast_int = xyes; then
efficiently supported by the host hardware.])
fi
+gnu_ld_bool=`if test x"$gnu_ld" = x"yes"; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(HAVE_GNU_LD, $gnu_ld_bool, [Define to 1 if using GNU ld.])
+
+gnu_as_bool=`if test x"$gas" = x"yes"; then echo 1; else echo 0; fi`
+AC_DEFINE_UNQUOTED(HAVE_GNU_AS, $gnu_as_bool, [Define to 1 if using GNU as.])
+
count=a
for f in $host_xm_file; do
count=${count}x
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 686de8534c3..22a29b83a21 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-25 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/lto14.adb: New test.
+
2012-05-25 Tristan Gingold <gingold@adacore.com>
* gcc.target/i386/large-frame.c: New.
diff --git a/gcc/testsuite/gnat.dg/lto14.adb b/gcc/testsuite/gnat.dg/lto14.adb
new file mode 100644
index 00000000000..d81db7af325
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto14.adb
@@ -0,0 +1,7 @@
+-- { dg-do link }
+-- { dg-options "-largs -f -margs -flto" { target lto } }
+
+procedure Lto14 is
+begin
+ null;
+end;