From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb] Fix build breaker with gcc 4.8
Date: Wed, 19 Jun 2019 11:04:00 -0000 [thread overview]
Message-ID: <20190619110410.GA14131@delia> (raw)
Hi,
When compiling with gcc 4.8, we run into:
...
/usr/include/c++/4.8/bits/unordered_map.h:100:18: required from \
âclass std::unordered_map<sect_offset, std::vector<sect_offset> >â
src/gdb/dwarf2read.h:260:5: required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:1070:12: error: invalid use of \
incomplete type âstruct std::hash<sect_offset>â
...
Fix this by adding std::hash<sect_offset>.
Build and reg-tested on x86_64-linux with gcc 4.8.
OK for trunk?
Thanks,
- Tom
[gdb] Fix build breaker with gcc 4.8
gdb/ChangeLog:
2019-06-19 Tom de Vries <tdevries@suse.de>
* dwarf2read.h (std::hash<sect_offset>): New specialization.
---
gdb/dwarf2read.h | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index 776860e454..494dcb32c1 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -99,6 +99,26 @@ struct signatured_type;
struct die_info;
typedef struct die_info *die_info_ptr;
+/* An std::hash specialization, required for use of sect_offset in
+ std::unordered_map with gcc 4.8. */
+
+namespace std
+{
+ template<> struct hash<sect_offset>
+ {
+ typedef sect_offset argument_type;
+ typedef std::size_t result_type;
+ using underlying_type
+ = typename std::underlying_type<argument_type>::type;
+
+ result_type operator() (const argument_type &o) const noexcept
+ {
+ underlying_type u = static_cast<underlying_type> (o);
+ return std::hash<underlying_type> {} (u);
+ }
+ };
+};
+
/* Collection of data recorded per objfile.
This hangs off of dwarf2_objfile_data_key. */
next reply other threads:[~2019-06-19 11:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 11:04 Tom de Vries [this message]
2019-06-19 12:43 ` Pedro Alves
2019-06-19 14:35 ` Tom de Vries
2019-06-19 14:49 ` Pedro Alves
2019-06-19 14:56 ` Steve Ellcey
[not found] ` <0cedb79e-1423-90d8-0c61-1386f398ab20@suse.de>
2019-06-19 15:14 ` [EXT] " Steve Ellcey
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=20190619110410.GA14131@delia \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.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