aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-09-11 05:44:51 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-09-11 05:44:51 +0000
commit8f820299e3a349d39429bfe64bcbf22593369bf4 (patch)
tree140d683aaf2a58cbce1b0d42cae3e952ee21331c /gcc
parent4337bc937caa26789f01e16d3eaa7ddd72c9558a (diff)
downloadgcc-8f820299e3a349d39429bfe64bcbf22593369bf4.zip
gcc-8f820299e3a349d39429bfe64bcbf22593369bf4.tar.gz
gcc-8f820299e3a349d39429bfe64bcbf22593369bf4.tar.bz2
varasm.c (make_decl_rtl): Restore leading star on DECL_ASSEMBLER_NAME set for decls with an asmspec.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/asm-names.c23
-rw-r--r--gcc/varasm.c10
4 files changed, 40 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5f7a72a..f4164e5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 830af37..73b4889 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..f02f08f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/asm-names.c
@@ -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(); }
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 5a10d65..af76b15 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -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))
{