public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "CHIGOT, CLEMENT" <clement.chigot@atos.net>
To: "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>,
	"iant@golang.org" <iant@golang.org>
Cc: David Edelsohn <dje.gcc@gmail.com>
Subject: [PATCH] gcc: handle double quotes in symbol name during stabstrings generation
Date: Wed, 2 Dec 2020 12:24:27 +0000	[thread overview]
Message-ID: <PR3PR02MB6380A2FBD200EB9078E038CDEAF30@PR3PR02MB6380.eurprd02.prod.outlook.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 785 bytes --]

Hi Ian

Since the new gccgo mangling scheme, libgo compilation is broken on AIX (or in Linux with -gstabs) because of a type symbol having a " in its name. I've made a patch (see attachment) in order to fix stabstring generation, because, IMO, it should be handled anyway.
However, it happens only once in the whole libgo so I don't know if this " is intended or not. The problematic type is there: https://github.com/golang/go/blob/master/src/crypto/x509/x509.go#L2674. Other similar types don't trigger the bug though.

I've a minimal test which might can be added if you wish, in Golang tests or in Gcc Go tests or in both ?

If the patch is okay, could you please apply it for me ?
Thanks,


Clément Chigot
ATOS Bull SAS
1 rue de Provence - 38432 Échirolles - France

[-- Attachment #2: 0001-gcc-handle-double-quotes-in-symbol-name-during-stabs.patch --]
[-- Type: application/octet-stream, Size: 1526 bytes --]

From c2836614aa4309f2e5077de83eabedf5e867290d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Cl=C3=A9ment=20Chigot?= <clement.chigot@atos.net>
Date: Wed, 2 Dec 2020 18:19:35 +0100
Subject: [PATCH] gcc: handle double quotes in symbol name during stabstrings
 generation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

With the new gccgo mangling scheme, a type name might now have a double
quotes in it. The current code doesn't escape these double quotes when
writing .stabs pseudo-opcode in the assembly file.

Changelog:
2020-12-02  Clément Chigot  <clement.chigot@atosnet>

	* dbxout.c (dbxout_symbol_name): Handle double quotes.
---
 gcc/dbxout.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index eaee2f19ce0..d1ffd7f36d2 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -3274,7 +3274,24 @@ dbxout_symbol_name (tree decl, const char *suffix, int letter)
        added by ASM_FORMAT_PRIVATE_NAME.  */
     name = DECL_NAME (decl);
 
-  if (name)
+  if (name && strchr(IDENTIFIER_POINTER(name), '"'))
+    {
+      /* Make sure double quote characters are correctly handled.  */
+      const char *str = IDENTIFIER_POINTER(name);
+      char c;
+      while ((c = *(str)++) != 0)
+	{
+	  if (c == '\"')
+#ifdef XCOFF_DEBUGGING_INFO
+	    stabstr_C ('\"');
+#else
+	    stabstr_C ('\\');
+#endif
+
+	  stabstr_C (c);
+	}
+    }
+  else if (name)
     stabstr_I (name);
   else
     stabstr_S ("(anon)");
-- 
2.25.0


             reply	other threads:[~2020-12-02 12:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-02 12:24 CHIGOT, CLEMENT [this message]
2020-12-02 15:55 ` Ian Lance Taylor
2020-12-02 16:14   ` CHIGOT, CLEMENT
2020-12-08 13:15     ` CHIGOT, CLEMENT
2020-12-11  5:09       ` Ian Lance Taylor
2020-12-11 17:58         ` Ian Lance Taylor
2020-12-14 13:36           ` CHIGOT, CLEMENT

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=PR3PR02MB6380A2FBD200EB9078E038CDEAF30@PR3PR02MB6380.eurprd02.prod.outlook.com \
    --to=clement.chigot@atos.net \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=iant@golang.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).