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
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.
+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
--- /dev/null
+/* 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(); }
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))
{