]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
varasm.c (make_decl_rtl): Restore leading star on DECL_ASSEMBLER_NAME set for decls...
authorZack Weinberg <zack@wolery.cumb.org>
Mon, 11 Sep 2000 05:44:51 +0000 (05:44 +0000)
committerZack Weinberg <zack@gcc.gnu.org>
Mon, 11 Sep 2000 05:44:51 +0000 (05:44 +0000)
* varasm.c (make_decl_rtl): Restore leading star on
DECL_ASSEMBLER_NAME set for decls with an asmspec.
* gcc.dg/asm-names.c: New test.

From-SVN: r36309

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

index 5f7a72a3ad38de43804206b75655cc3fec3f2ae0..f4164e545c66aff1a782de016ac363d53ee0651b 100644 (file)
@@ -1,3 +1,8 @@
+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
index 830af37eb6319640068c4109b499f89e225afd37..73b488939caa48523a105af33cd7b53adea8e5c3 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 5a10d65687fdd0b3a2b7788e57a9151a7b621db0..af76b15560b9c7f46e05790b1f7f42ea140e2331 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))
     {