OSDN Git Service

* varasm.c (make_decl_rtl): Restore leading star on
authorzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Sep 2000 05:44:51 +0000 (05:44 +0000)
committerzack <zack@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Sep 2000 05:44:51 +0000 (05:44 +0000)
DECL_ASSEMBLER_NAME set for decls with an asmspec.
* gcc.dg/asm-names.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36309 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/asm-names.c [new file with mode: 0644]
gcc/varasm.c

index 5f7a72a..f4164e5 100644 (file)
@@ -1,5 +1,10 @@
 2000-09-10  Zack Weinberg  <zack@wolery.cumb.org>
 
+       * varasm.c (make_decl_rtl): Restore leading star on
+       DECL_ASSEMBLER_NAME set for decls with an asmspec. 
+
+2000-09-10  Zack Weinberg  <zack@wolery.cumb.org>
+
        * c-pragma.c (handle_pragma_pack): Correct parsing logic so it
        won't give a spurious error for '#pragma pack()'.  Simplify
        control flow for readability.  'reset' action is not necessary.
index 830af37..73b4889 100644 (file)
@@ -1,3 +1,7 @@
+2000-09-10  Zack Weinberg  <zack@wolery.cumb.org>
+
+       * gcc.dg/asm-names.c: New test.
+
 2000-09-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/cpp/tr-warn6.c: New test
diff --git a/gcc/testsuite/gcc.dg/asm-names.c b/gcc/testsuite/gcc.dg/asm-names.c
new file mode 100644 (file)
index 0000000..f02f08f
--- /dev/null
@@ -0,0 +1,23 @@
+/* The name specified by an asm("...") suffix on a declaration is not
+   to have an underscore prefixed, even if normal symbols are.
+   Problem reported by Krister Walfridsson <cato@df.lth.se>.  */
+
+/* { dg-do link } */
+/* { dg-options "-fleading-underscore" } */
+
+extern void frobnicate (void) asm ("___frob14");  /* three underscores */
+
+void __frob14 (void) {} /* two underscores */
+
+int
+main (void)
+{
+  frobnicate ();
+  return 0;
+}
+
+/* In case built where the runtime expects no leading underscore on
+   main(). */
+extern int xmain (void) asm ("main");
+
+int xmain (void) { return main(); }
index 5a10d65..af76b15 100644 (file)
@@ -710,8 +710,14 @@ make_decl_rtl (decl, asmspec, top_level)
 
   reg_number = decode_reg_name (asmspec);
   if (reg_number == -2)
-    /* ASMSPEC is given, and not the name of a register.  */
-    new_name = asmspec;
+    {
+      /* ASMSPEC is given, and not the name of a register.  Mark the
+        name with a star so assemble_name won't munge it.  */
+      char *starred = alloca (strlen (asmspec) + 2);
+      starred[0] = '*';
+      strcpy (starred + 1, asmspec);
+      new_name = starred;
+    }
 
   if (TREE_CODE (decl) != FUNCTION_DECL && DECL_REGISTER (decl))
     {