This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch ping: bug in assemble_name affects __asm__ usage on HP-UX IA64


I submitted a patch last month to address a bug I found while building
libgomp but have not gotten any feedback on it yet.  It is not a
regression so I am just looking to check it in on the main line.

Steve Ellcey
sje@cup.hp.com



>From sje Tue Jan 24 09:45:46 2006
To: gcc-patches@gcc.gnu.org
Subject: PATCH: Missing declarations for functions with __asm__ names
Reply-to: sje@cup.hp.com
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

While testing libgomp on IA64 HP-UX I noticed that the HP linker was
giving warnings about some functions not being declared as functions in
the object file.  I tracked this down to the fact that GCC was not
putting out .global and .type statements for functions if those
functions had a special assembler name given with the __asm__
attribute/keyword.  This, in turn, was caused by assemble_name using the
stripped name when calling maybe_get_identifier instead of the
unstripped name and not finding a tree node for it.  Using the
unstripped name fixes the problem and caused no regressions on IA64
HP-UX or Linux.

Since there are other uses of maybe_get_identifier() where the name is
stripped first (dwarf2asm.c, config/* files) I would appreciate some
comments on whether or not stripping the name before using it as an
argument to maybe_get_identifier() is the right approach or not.

If it is the right approach is it OK to check this patch in?

Steve Ellcey
sje@cup.hp.com

ChangeLog

2006-01-24  Steve Ellcey  <sje@cup.hp.com>

	* varasm.c (assemble_name): Use unstripped name when calling
	maybe_get_identifier.


testsuite ChangeLog

2006-01-24  Steve Ellcey  <sje@cup.hp.com>
	* gcc.target/ia64/asm-decl.c: New test.

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 110102)
+++ gcc/varasm.c	(working copy)
@@ -1860,12 +1860,9 @@ assemble_name_raw (FILE *file, const cha
 void
 assemble_name (FILE *file, const char *name)
 {
-  const char *real_name;
   tree id;
 
-  real_name = targetm.strip_name_encoding (name);
-
-  id = maybe_get_identifier (real_name);
+  id = maybe_get_identifier (name);
   if (id)
     {
       tree id_orig = id;


Index: gcc/testsuite/gcc.target/ia64/asm-decl.c
===================================================================
--- gcc/testsuite/gcc.target/ia64/asm-decl.c	(revision 0)
+++ gcc/testsuite/gcc.target/ia64/asm-decl.c	(revision 0)
@@ -0,0 +1,13 @@
+/* Make sure a function with __asm__ name gets declared properly. */
+/* { dg-do compile { target ia64*-*-hpux* } } */
+/* { dg-final { scan-assembler "\\.global.*foobar" } } */
+/* { dg-final { scan-assembler "\\.type.*foobar.*function" } } */
+
+extern double bar (void);
+extern double bar (void) __asm__ ("foobar");
+
+double
+foo (void)
+{
+  return bar ();
+}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]