public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* XCOFF/PE hack removal
@ 2002-01-22  1:54 Alan Modra
  2002-01-22 11:10 ` Tom Rix
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2002-01-22  1:54 UTC (permalink / raw)
  To: binutils

I'd like to apply the following so that errors reported when linking
powerpc64-elf objects discern between a function descriptor symbol
and it's associated function code symbol, which only differs by a
leading dot.  However, this will affect PE and XCOFF error messages,
so I'd like an OK from the opposition camp first.  If not OK, then
I'll do something target dependent.

ld/ChangeLog
	* ldmisc.c (demangle): Put back dots when string not demangled.
 
-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.8
diff -u -p -r1.8 ldmisc.c
--- ldmisc.c	2001/09/26 01:55:44	1.8
+++ ldmisc.c	2002/01/22 09:08:55
@@ -69,6 +69,7 @@ demangle (string)
      const char *string;
 {
   char *res;
+  int dots = 0;
 
   if (output_bfd != NULL
       && bfd_get_symbol_leading_char (output_bfd) == string[0])
@@ -78,9 +79,13 @@ demangle (string)
      format.  Xcoff has a single '.', while the NT PE for PPC has
      '..'.  So we remove all of them.  */
   while (string[0] == '.')
-    ++string;
+    {
+      ++dots;
+      ++string;
+    }
 
   res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS);
+  string -= dots;
   return res ? res : xstrdup (string);
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XCOFF/PE hack removal
  2002-01-22  1:54 XCOFF/PE hack removal Alan Modra
@ 2002-01-22 11:10 ` Tom Rix
  2002-01-25  5:04   ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Rix @ 2002-01-22 11:10 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

To foo or to .foo? That is the question

Speaking for XCOFF,  I'm ok with the change.

You should add powerpc64-elf to the list of targets in the comment.

Tom

Alan Modra wrote:

> I'd like to apply the following so that errors reported when linking
> powerpc64-elf objects discern between a function descriptor symbol
> and it's associated function code symbol, which only differs by a
> leading dot.  However, this will affect PE and XCOFF error messages,
> so I'd like an OK from the opposition camp first.  If not OK, then
> I'll do something target dependent.
>
> ld/ChangeLog
>         * ldmisc.c (demangle): Put back dots when string not demangled.
>
> --
> Alan Modra
> IBM OzLabs - Linux Technology Centre
>
> Index: ld/ldmisc.c
> ===================================================================
> RCS file: /cvs/src/src/ld/ldmisc.c,v
> retrieving revision 1.8
> diff -u -p -r1.8 ldmisc.c
> --- ldmisc.c    2001/09/26 01:55:44     1.8
> +++ ldmisc.c    2002/01/22 09:08:55
> @@ -69,6 +69,7 @@ demangle (string)
>       const char *string;
>  {
>    char *res;
> +  int dots = 0;
>
>    if (output_bfd != NULL
>        && bfd_get_symbol_leading_char (output_bfd) == string[0])
> @@ -78,9 +79,13 @@ demangle (string)
>       format.  Xcoff has a single '.', while the NT PE for PPC has
>       '..'.  So we remove all of them.  */
>    while (string[0] == '.')
> -    ++string;
> +    {
> +      ++dots;
> +      ++string;
> +    }
>
>    res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS);
> +  string -= dots;
>    return res ? res : xstrdup (string);
>  }

--
Tom Rix
GCC Engineer
trix@redhat.com



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XCOFF/PE hack removal
  2002-01-22 11:10 ` Tom Rix
@ 2002-01-25  5:04   ` Alan Modra
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Modra @ 2002-01-25  5:04 UTC (permalink / raw)
  To: binutils

On Tue, Jan 22, 2002 at 08:51:52AM -0600, Tom Rix wrote:
> You should add powerpc64-elf to the list of targets in the comment.

True.  Checking in this modified patch.

ld/ChangeLog
	* ldmisc.c (demangle): Put back dots when string not demangled.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre

Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.8
diff -u -p -r1.8 ldmisc.c
--- ldmisc.c	2001/09/26 01:55:44	1.8
+++ ldmisc.c	2002/01/25 12:13:55
@@ -69,18 +69,20 @@ demangle (string)
      const char *string;
 {
   char *res;
+  char *p;
 
   if (output_bfd != NULL
       && bfd_get_symbol_leading_char (output_bfd) == string[0])
     ++string;
 
-  /* This is a hack for better error reporting on XCOFF, or the MS PE
-     format.  Xcoff has a single '.', while the NT PE for PPC has
-     '..'.  So we remove all of them.  */
-  while (string[0] == '.')
-    ++string;
+  /* This is a hack for better error reporting on XCOFF, PowerPC64-ELF
+     or the MS PE format.  These formats have a number of leading '.'s
+     on at least some symbols, so we remove all dots.  */
+  p = string;
+  while (*p == '.')
+    ++p;
 
-  res = cplus_demangle (string, DMGL_ANSI | DMGL_PARAMS);
+  res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS);
   return res ? res : xstrdup (string);
 }
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-25 12:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-22  1:54 XCOFF/PE hack removal Alan Modra
2002-01-22 11:10 ` Tom Rix
2002-01-25  5:04   ` Alan Modra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).