1 Fix symbol demangling for GCC 5, as reported at:
3 https://github.com/google/glog/issues/14
7 https://github.com/google/glog/pull/50
9 From b1639e3014996fbc7635870e013559c54e7e3b2f Mon Sep 17 00:00:00 2001
10 From: =?UTF-8?q?David=20Mart=C3=ADnez=20Moreno?= <ender@debian.org>
11 Date: Thu, 13 Aug 2015 09:31:26 -0700
12 Subject: [PATCH] Fix ABI demangling for the GCC 5.x case.
14 When glog is compiled with gcc-5.2 in cxx11 ABI mode, it barfs about unmangled symbols. This patches it getting inspiration from binutils and demangle.cc itself, although it may be totally wrong or maybe have to use ParseAbiTag in more places. I haven't read the spec for the symbols, though.
16 This patch makes the demangle unit test pass correctly.
18 src/demangle.cc | 19 +++++++++++++++++++
19 1 file changed, 19 insertions(+)
21 diff --git a/src/demangle.cc b/src/demangle.cc
22 index e858181..0f0c831 100644
25 @@ -439,6 +439,7 @@ static bool ParseExprPrimary(State *state);
26 static bool ParseLocalName(State *state);
27 static bool ParseDiscriminator(State *state);
28 static bool ParseSubstitution(State *state);
29 +static bool ParseAbiTag(State *state);
31 // Implementation note: the following code is a straightforward
32 // translation of the Itanium C++ ABI defined in BNF with a couple of
33 @@ -567,6 +568,8 @@ static bool ParseNestedName(State *state) {
34 static bool ParsePrefix(State *state) {
35 bool has_something = false;
37 + if (ParseAbiTag(state))
39 MaybeAppendSeparator(state);
40 if (ParseTemplateParam(state) ||
41 ParseSubstitution(state) ||
42 @@ -585,6 +588,22 @@ static bool ParsePrefix(State *state) {
46 +// <abi-tag> ::= B <source-name>
47 +static bool ParseAbiTag(State *state) {
48 + State copy = *state;
50 + Append(state, "[", 1);
51 + if (ParseOneCharToken(state, 'B') &&
52 + ParseSourceName(state))
54 + Append(state, "]", 1);
62 // <unqualified-name> ::= <operator-name>
63 // ::= <ctor-dtor-name>