Bug 25885 - GDB dwarf2/read.c no longer builds with libc++
Summary: GDB dwarf2/read.c no longer builds with libc++
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-28 09:19 UTC by Simon Cook
Modified: 2020-04-30 09:01 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Cook 2020-04-28 09:19:52 UTC
A recent change has resulted in GDB no longer being compilable using libc++ due to "implicit instantiation of undefined template 'std::__1::hash<sect_offset>'" when the C++ standard is set to gnu++11 (it does however build successfully if I use -std=gnu++14 in my CXXFLAGS).


Make output:
  CXX    dwarf2/read.o
In file included from ../../binutils-gdb/gdb/dwarf2/read.c:31:
In file included from ../../binutils-gdb/gdb/defs.h:28:
In file included from ../../binutils-gdb/gdb/../gdbsupport/common-defs.h:125:
In file included from ../../binutils-gdb/gdb/../gdbsupport/common-utils.h:23:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:504:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:175:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__string:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:640:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:1624:38: error: implicit instantiation of undefined template 'std::__1::hash<sect_offset>'      : public integral_constant<bool, __is_empty(_Tp)> {};
                                     ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:423:18: note: in instantiation of template class
      'std::__1::is_empty<std::__1::hash<sect_offset> >' requested here
          bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:858:13: note: in instantiation of default argument for
      '__unordered_map_hasher<sect_offset, std::__1::__hash_value_type<sect_offset, int>, std::__1::hash<sect_offset> >' required here
    typedef __unordered_map_hasher<key_type, __value_type, hasher>   __hasher;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../binutils-gdb/gdb/dwarf2/read.c:14615:18: note: in instantiation of template class 'std::__1::unordered_map<sect_offset, int, std::__1::hash<sect_offset>, std::__1::equal_to<sect_offset>,
      std::__1::allocator<std::__1::pair<const sect_offset, int> > >' requested here
  result.parts = create_variant_parts (obstack, offset_map, fi,
                 ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:428:50: note: template is declared here
template <class _Tp> struct _LIBCPP_TEMPLATE_VIS hash;
                                                 ^
In file included from ../../binutils-gdb/gdb/dwarf2/read.c:32:
In file included from ../../binutils-gdb/gdb/dwarf2/read.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:407:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:2487:21: error: called object type
      'std::__1::__hash_table<std::__1::__hash_value_type<sect_offset, int>, int, std::__1::__unordered_map_equal<sect_offset, std::__1::__hash_value_type<sect_offset, int>, std::__1::equal_to<sect_offset>,         true>, std::__1::allocator<std::__1::__hash_value_type<sect_offset, int> > >::hasher' (aka 'int') is not a function or function pointer
    size_t __hash = hash_function()(__k);
                    ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:1278:69: note: in instantiation of function template specialization
      'std::__1::__hash_table<std::__1::__hash_value_type<sect_offset, int>, int, std::__1::__unordered_map_equal<sect_offset, std::__1::__hash_value_type<sect_offset, int>, std::__1::equal_to<sect_offset>,         true>, std::__1::allocator<std::__1::__hash_value_type<sect_offset, int> > >::find<sect_offset>' requested here
    const_iterator find(const key_type& __k) const {return __table_.find(__k);}
                                                                    ^
../../binutils-gdb/gdb/dwarf2/read.c:14633:26: note: in instantiation of member function 'std::__1::unordered_map<sect_offset, int, std::__1::hash<sect_offset>, std::__1::equal_to<sect_offset>,
      std::__1::allocator<std::__1::pair<const sect_offset, int> > >::find' requested here
  auto iter = offset_map.find (builder.discriminant_offset);
                         ^
In file included from ../../binutils-gdb/gdb/dwarf2/read.c:32:
In file included from ../../binutils-gdb/gdb/dwarf2/read.h:24:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:407:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__hash_table:2103:21: error: called object type
      'std::__1::__hash_table<std::__1::__hash_value_type<sect_offset, int>, int, std::__1::__unordered_map_equal<sect_offset, std::__1::__hash_value_type<sect_offset, int>, std::__1::equal_to<sect_offset>,         true>, std::__1::allocator<std::__1::__hash_value_type<sect_offset, int> > >::hasher' (aka 'int') is not a function or function pointer
    size_t __hash = hash_function()(__k);
                    ^~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:1560:21: note: in instantiation of function template specialization
      'std::__1::__hash_table<std::__1::__hash_value_type<sect_offset, int>, int, std::__1::__unordered_map_equal<sect_offset, std::__1::__hash_value_type<sect_offset, int>, std::__1::equal_to<sect_offset>,         true>, std::__1::allocator<std::__1::__hash_value_type<sect_offset, int> > >::__emplace_unique_key_args<sect_offset, const std::__1::piecewise_construct_t &, std::__1::tuple<const sect_offset &>,              std::__1::tuple<> >' requested here
    return __table_.__emplace_unique_key_args(__k,
                    ^
../../binutils-gdb/gdb/dwarf2/read.c:14693:15: note: in instantiation of member function 'std::__1::unordered_map<sect_offset, int, std::__1::hash<sect_offset>, std::__1::equal_to<sect_offset>,
      std::__1::allocator<std::__1::pair<const sect_offset, int> > >::operator[]' requested here
    offset_map[fip->fields[i].offset] = i;
              ^
3 errors generated.
make[1]: *** [dwarf2/read.o] Error 1
Comment 1 Simon Cook 2020-04-30 09:01:43 UTC
This was fixed by 1b95cdb76caca1b7a9ecf9324acf23139f11f7d1 (fix for PR 25881)