gnu: glog: Fix name demangling for GCC 5.

* gnu/packages/patches/glog-gcc-5-demangling.patch: New file.
* gnu/packages/logging.scm (glog)[sources]: Add it.
* gnu/local.mk (dist_patch_DATA): Add it.
This commit is contained in:
Ludovic Courtès 2017-04-04 13:44:23 +02:00
parent 6c17422eac
commit b7506f74df
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
3 changed files with 69 additions and 2 deletions

View File

@ -608,6 +608,7 @@ dist_patch_DATA = \
%D%/packages/patches/glibc-locales.patch \
%D%/packages/patches/glibc-o-largefile.patch \
%D%/packages/patches/glibc-versioned-locpath.patch \
%D%/packages/patches/glog-gcc-5-demangling.patch \
%D%/packages/patches/gmp-arm-asm-nothumb.patch \
%D%/packages/patches/gmp-faulty-test.patch \
%D%/packages/patches/gnome-tweak-tool-search-paths.patch \

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
;;; Copyright © 2016 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -24,6 +24,7 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages perl)
#:use-module (gnu packages autotools))
@ -62,7 +63,8 @@ staying as close to their API as is reasonable.")
(sha256
(base32
"0ym5g15m7c8kjfr2c3zq6bz08ghin2d1r1nb6v2vnkfh1vn945x1"))
(file-name (string-append name "-" version "-checkout"))))
(file-name (string-append name "-" version "-checkout"))
(patches (search-patches "glog-gcc-5-demangling.patch"))))
(build-system gnu-build-system)
(native-inputs
`(("perl" ,perl) ;for tests

View File

@ -0,0 +1,64 @@
Fix symbol demangling for GCC 5, as reported at:
https://github.com/google/glog/issues/14
Patch from:
https://github.com/google/glog/pull/50
From b1639e3014996fbc7635870e013559c54e7e3b2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20Mart=C3=ADnez=20Moreno?= <ender@debian.org>
Date: Thu, 13 Aug 2015 09:31:26 -0700
Subject: [PATCH] Fix ABI demangling for the GCC 5.x case.
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.
This patch makes the demangle unit test pass correctly.
---
src/demangle.cc | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/demangle.cc b/src/demangle.cc
index e858181..0f0c831 100644
--- a/src/demangle.cc
+++ b/src/demangle.cc
@@ -439,6 +439,7 @@ static bool ParseExprPrimary(State *state);
static bool ParseLocalName(State *state);
static bool ParseDiscriminator(State *state);
static bool ParseSubstitution(State *state);
+static bool ParseAbiTag(State *state);
// Implementation note: the following code is a straightforward
// translation of the Itanium C++ ABI defined in BNF with a couple of
@@ -567,6 +568,8 @@ static bool ParseNestedName(State *state) {
static bool ParsePrefix(State *state) {
bool has_something = false;
while (true) {
+ if (ParseAbiTag(state))
+ continue;
MaybeAppendSeparator(state);
if (ParseTemplateParam(state) ||
ParseSubstitution(state) ||
@@ -585,6 +588,22 @@ static bool ParsePrefix(State *state) {
return true;
}
+// <abi-tag> ::= B <source-name>
+static bool ParseAbiTag(State *state) {
+ State copy = *state;
+
+ Append(state, "[", 1);
+ if (ParseOneCharToken(state, 'B') &&
+ ParseSourceName(state))
+ {
+ Append(state, "]", 1);
+ return true;
+ }
+
+ *state = copy;
+ return false;
+}
+
// <unqualified-name> ::= <operator-name>
// ::= <ctor-dtor-name>
// ::= <source-name>