Patchwork : vms/alpha: avoid writing directly symbol names

login
register
mail settings
Submitter Tristan Gingold
Date Dec. 16, 2011, 3:52 p.m.
Message ID <7DCD8EAE-A31D-42CB-A640-186A9F32D3B3@adacore.com>
Download mbox | patch
Permalink /patch/131859/
State New
Headers show

Comments

Tristan Gingold - Dec. 16, 2011, 3:52 p.m.
Now that transparent aliases are heavily used by VMS to translate names, we shouldn't directly emit symbol name but use assemble_name.
This patch fixes some abuse.

Committed on trunk.

Tristan.

2011-12-16  Tristan Gingold  <gingold@adacore.com>

	* config/alpha/alpha.c (alpha_use_linkage): Follow transparent alias.
	(alpha_write_one_linkage): Use assemble_name to emit linkage name.

Patch

Index: config/alpha/alpha.c
===================================================================
--- config/alpha/alpha.c	(revision 182404)
+++ config/alpha/alpha.c	(working copy)
@@ -9541,10 +9541,20 @@ 
     {
       size_t buf_len;
       char *linksym;
+      tree id;
 
       if (name[0] == '*')
 	name++;
 
+      /* Follow transparent alias, as this is used for CRTL translations.  */
+      id = maybe_get_identifier (name);
+      if (id)
+        {
+          while (IDENTIFIER_TRANSPARENT_ALIAS (id))
+            id = TREE_CHAIN (id);
+          name = IDENTIFIER_POINTER (id);
+        }
+
       buf_len = strlen (name) + 8 + 9;
       linksym = (char *) alloca (buf_len);
       snprintf (linksym, buf_len, "$%d..%s..lk", cfun->funcdef_no, name);
@@ -9577,7 +9587,7 @@ 
   if (link->rkind == KIND_CODEADDR)
     {
       /* External and used, request code address.  */
-      fprintf (stream, "\t.code_address %s\n", name);
+      fprintf (stream, "\t.code_address ");
     }
   else
     {
@@ -9586,14 +9596,16 @@ 
 	{
 	  /* Locally defined, build linkage pair.  */
 	  fprintf (stream, "\t.quad %s..en\n", name);
-	  fprintf (stream, "\t.quad %s\n", name);
+	  fprintf (stream, "\t.quad ");
 	}
       else
 	{
 	  /* External, request linkage pair.  */
-	  fprintf (stream, "\t.linkage %s\n", name);
+	  fprintf (stream, "\t.linkage ");
 	}
     }
+  assemble_name (stream, name);
+  fputs ("\n", stream);
 
   return 0;
 }