diff mbox

[Ada] Remove old kludge in i386_pe_encode_section_info

Message ID 1675410.WFKYCA0tne@polaris
State New
Headers show

Commit Message

Eric Botcazou June 1, 2015, 8:20 a.m. UTC
This dates back to 2008 and is specific to the Ada compiler.

Tested on x86_64-suse-linux and i686-pc-mingw32, applied on the mainline.


2015-06-01  Eric Botcazou  <ebotcazou@adacore.com>

	* config/i386/winnt.c (i386_pe_encode_section_info) <FUNCTION_DECL>:
	Remove obsolete kludge.
ada/
	* gcc-interface/utils.c (create_var_decl_1): If an assembler name is
	specified, let the target mangle it before settting.
	(create_subprog_decl): Likewise and move this treatment last.
diff mbox

Patch

Index: ada/gcc-interface/utils.c
===================================================================
--- ada/gcc-interface/utils.c	(revision 223912)
+++ ada/gcc-interface/utils.c	(working copy)
@@ -2428,7 +2428,13 @@  create_var_decl_1 (tree var_name, tree a
   if (TREE_CODE (var_decl) == VAR_DECL)
     {
       if (asm_name)
-	SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
+	{
+	  /* Let the target mangle the name if this isn't a verbatim asm.  */
+	  if (*IDENTIFIER_POINTER (asm_name) != '*')
+	    asm_name = targetm.mangle_decl_assembler_name (var_decl, asm_name);
+
+	  SET_DECL_ASSEMBLER_NAME (var_decl, asm_name);
+	}
 
       if (global_bindings_p ())
 	rest_of_decl_compilation (var_decl, true, 0);
@@ -3047,8 +3053,17 @@  create_subprog_decl (tree subprog_name,
   DECL_BY_REFERENCE (result_decl) = TREE_ADDRESSABLE (subprog_type);
   DECL_RESULT (subprog_decl) = result_decl;
 
+  process_attributes (&subprog_decl, &attr_list, true, gnat_node);
+
+  /* Add this decl to the current binding level.  */
+  gnat_pushdecl (subprog_decl, gnat_node);
+
   if (asm_name)
     {
+      /* Let the target mangle the name if this isn't a verbatim asm.  */
+      if (*IDENTIFIER_POINTER (asm_name) != '*')
+	asm_name = targetm.mangle_decl_assembler_name (subprog_decl, asm_name);
+
       SET_DECL_ASSEMBLER_NAME (subprog_decl, asm_name);
 
       /* The expand_main_function circuitry expects "main_identifier_node" to
@@ -3061,11 +3076,6 @@  create_subprog_decl (tree subprog_name,
 	DECL_NAME (subprog_decl) = main_identifier_node;
     }
 
-  process_attributes (&subprog_decl, &attr_list, true, gnat_node);
-
-  /* Add this decl to the current binding level.  */
-  gnat_pushdecl (subprog_decl, gnat_node);
-
   /* Output the assembler code and/or RTL for the declaration.  */
   rest_of_decl_compilation (subprog_decl, global_bindings_p (), 0);
 
Index: config/i386/winnt.c
===================================================================
--- config/i386/winnt.c	(revision 223897)
+++ config/i386/winnt.c	(working copy)
@@ -339,20 +339,6 @@  i386_pe_encode_section_info (tree decl,
   switch (TREE_CODE (decl))
     {
     case FUNCTION_DECL:
-      /* FIXME:  Imported stdcall names are not modified by the Ada frontend.
-	 Check and decorate the RTL name now.  */
-      if  (strcmp (lang_hooks.name, "GNU Ada") == 0)
-	{
-	  tree new_id;
-	  tree old_id = DECL_ASSEMBLER_NAME (decl);
-	  const char* asm_str = IDENTIFIER_POINTER (old_id);
-	  /* Do not change the identifier if a verbatim asmspec
-	     or if stdcall suffix already added. */
-	  if (!(*asm_str == '*' || strchr (asm_str, '@'))
-	      && (new_id = i386_pe_maybe_mangle_decl_assembler_name (decl,
-								     old_id)))
-	    XSTR (symbol, 0) = IDENTIFIER_POINTER (new_id);
-	}
       break;
 
     case VAR_DECL: