diff options
author | Tom de Vries <tdevries@suse.de> | 2020-08-08 23:34:19 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2020-08-08 23:34:19 +0200 |
commit | 38f8aa06d9c422934e635779783107c0d3be419a (patch) | |
tree | d1fa5acfabf19f93827184c184f70ae214675c00 /gdb | |
parent | bc853409cc6887e9d9ea9279b0c2b7e4ccdf230e (diff) | |
download | gdb-38f8aa06d9c422934e635779783107c0d3be419a.zip gdb-38f8aa06d9c422934e635779783107c0d3be419a.tar.gz gdb-38f8aa06d9c422934e635779783107c0d3be419a.tar.bz2 |
[gdb/build] Fix missing implicit constructor call with gcc 4.8
When building gdb on x86_64-linux with --enable-targets riscv64-suse-linux, I
run into:
...
src/gdb/arch/riscv.c:112:45: required from here
/usr/include/c++/4.8/bits/hashtable_policy.h:195:39: error: no matching \
function for call to 'std::pair<const riscv_gdbarch_features, const \
std::unique_ptr<target_desc, target_desc_deleter> >::pair(const \
riscv_gdbarch_features&, target_desc*&)'
: _M_v(std::forward<_Args>(__args)...) { }
^
...
for this code in riscv_lookup_target_description:
...
/* Add to the cache. */
riscv_tdesc_cache.emplace (features, tdesc);
...
Work around this compiler problem (filed as PR gcc/96537), similar to how that
was done in commit 6d0cf4464e "Fix build with gcc-4.8.x":
...
- riscv_tdesc_cache.emplace (features, tdesc);
+ riscv_tdesc_cache.emplace (features, target_desc_up (tdesc));
...
That is, call the target_desc_up constructor explictly instead of implicitly.
Also, work around a similar issue in get_thread_arch_aspace_regcache.
Build on x86_64-linux with --enable-targets riscv64-suse-linux, and
reg-tested.
gdb/ChangeLog:
2020-08-08 Tom de Vries <tdevries@suse.de>
PR build/26344
* arch/riscv.c (riscv_lookup_target_description): Use an explicit
constructor.
* regcache.c (get_thread_arch_aspace_regcache): Same.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/arch/riscv.c | 5 | ||||
-rw-r--r-- | gdb/regcache.c | 4 |
3 files changed, 13 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b096fc..72bd044 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2020-08-08 Tom de Vries <tdevries@suse.de> + + PR build/26344 + * arch/riscv.c (riscv_lookup_target_description): Use an explicit + constructor. + * regcache.c (get_thread_arch_aspace_regcache): Same. + 2020-08-07 Tom Tromey <tromey@adacore.com> * ravenscar-thread.c diff --git a/gdb/arch/riscv.c b/gdb/arch/riscv.c index e43aafc..8f57090 100644 --- a/gdb/arch/riscv.c +++ b/gdb/arch/riscv.c @@ -108,8 +108,9 @@ riscv_lookup_target_description (const struct riscv_gdbarch_features features) target_desc *tdesc = riscv_create_target_description (features); - /* Add to the cache. */ - riscv_tdesc_cache.emplace (features, tdesc); + /* Add to the cache. Work around a problem with g++ 4.8 (PR96537): + Call the target_desc_up constructor explictly instead of implicitly. */ + riscv_tdesc_cache.emplace (features, target_desc_up (tdesc)); return tdesc; } diff --git a/gdb/regcache.c b/gdb/regcache.c index b8fcc52..cd54bc6 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -354,7 +354,9 @@ get_thread_arch_aspace_regcache (process_stratum_target *target, /* It does not exist, create it. */ regcache *new_regcache = new regcache (target, arch, aspace); new_regcache->set_ptid (ptid); - ptid_regc_map.insert (std::make_pair (ptid, new_regcache)); + /* Work around a problem with g++ 4.8 (PR96537): Call the regcache_up + constructor explictly instead of implicitly. */ + ptid_regc_map.insert (std::make_pair (ptid, regcache_up (new_regcache))); return new_regcache; } |