<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW " title="NEW --- - llvm-nm fails to build with gcc 5.1's libstdc++" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24115&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=8JBn1IAtMBc992VrZgbOHzaf3AM0qSDTdyOYynVbdgs&s=ZrSK4eG-xNO8X3fxhA_wNHB2paJh79LkJgojJtrSYVU&e=">24115</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm-nm fails to build with gcc 5.1's libstdc++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>tools
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>llvm-nm
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bero@linaro.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=14586" name="attach_14586" title="Patch">attachment 14586</a> <a href="attachment.cgi?id=14586&action=edit" title="Patch">[details]</a></span>
Patch

Current (svn rev. 242129) llvm-nm fails to build with gcc 5.1's STL -- looks
like gcc 5.1's std::sort is too picky about its arguments:


cd /home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/tools/llvm-nm &&
/usr/bin/clang++   -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS
-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Oz -gdwarf-4 -Wstrict-aliasing=2
-pipe -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4  -fPIC -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers
-pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -std=c++1y
-ffunction-sections -fdata-sections -Oz -gdwarf-4 -Wstrict-aliasing=2 -pipe
-Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fstack-protector
--param=ssp-buffer-size=4  -fPIC
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/tools/llvm-nm
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/build/include
-I/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include    -o
CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o -c
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp:19:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/IR/Function.h:23:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/IR/Argument.h:17:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/ADT/Twine.h:13:
In file included from
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/include/llvm/ADT/SmallVector.h:22:
In file included from
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/algorithm:61:
In file included from
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/stl_algobase.h:71:
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/predefined_ops.h:123:31:
error: indirection requires pointer operand ('(anonymous namespace)::NMSymbol'
invalid)
        { return bool(_M_comp(*__it1, *__it2)); }
                              ^~~~~~
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:1981:27:
note: in instantiation of function template specialization
'__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)>
<span class="quote">>::operator()<(anonymous namespace)::NMSymbol, (anonymous</span >
namespace)::NMSymbol>' requested here
        using _Invoke = decltype(__callable_functor(std::declval<_Functor&>())
                                 ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:1990:2:
note: in instantiation of template type alias '_Invoke' requested here
        using _Callable
        ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:2057:30:
note: in instantiation of template type alias '_Callable' requested here
               typename = _Requires<_Callable<_Functor>, void>>
                                    ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/functional:2058:2:
note: in instantiation of default argument for
'function<__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const
(anonymous namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >
<span class="quote">>' required here</span >
        function(_Functor);
        ^~~~~~~~
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/predefined_ops.h:130:14:
note: while substituting deduced template arguments into function template
'function' [with _Functor =
__gnu_cxx::__ops::_Iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >, $1 = (no
value)]
    { return _Iter_comp_iter<_Compare>(__comp); }
             ^
/usr/bin/../lib64/gcc/x86_64-mandriva-linux-gnu/5.1.1/../../../../include/c++/5.1.1/bits/stl_algo.h:4729:54:
note: in instantiation of function template specialization
'__gnu_cxx::__ops::__iter_comp_iter<std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >' requested
here
      std::__sort(__first, __last, __gnu_cxx::__ops::__iter_comp_iter(__comp));
                                                     ^
/home/bero/abf/llvm/BUILD/llvm-3.7.0.src/tools/llvm-nm/llvm-nm.cpp:499:10:
note: in instantiation of function template specialization
'std::sort<__gnu_cxx::__normal_iterator<(anonymous namespace)::NMSymbol *,
std::vector<(anonymous namespace)::NMSymbol, std::allocator<(anonymous
namespace)::NMSymbol> > >, std::function<bool (const (anonymous
namespace)::NMSymbol &, const (anonymous namespace)::NMSymbol &)> >' requested
here
    std::sort(SymbolList.begin(), SymbolList.end(), Cmp);
         ^
1 error generated.
tools/llvm-nm/CMakeFiles/llvm-nm.dir/build.make:65: recipe for target
'tools/llvm-nm/CMakeFiles/llvm-nm.dir/llvm-nm.cpp.o' failed


The patch I'm attaching solves the problem for me, at the cost of making the
code somewhat ugly.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>