[PATCH] D24650: [ELF] - Linkerscript: PR30387 - cannot handle EXCLUDE_FILE in the middle of a input section description.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 16 10:35:32 PDT 2016


grimar added a comment.

I am observing bot failures on next two bots:
http://lab.llvm.org:8011/builders/lld-x86_64-freebsd/builds/21301/steps/build_Lld/logs/stdio
http://lab.llvm.org:8011/builders/lld-x86_64-darwin13/builds/27508/steps/build_Lld/logs/stdio

Compile issue does not appear on windows and llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast,
and according to error message it is just something broken in stl implementation.
I was able to reproduce it on FreeBSD VM I have and found it 
does not like to have a pairs in a vector where at least one element of pair
has movable constructor and deleted copy constructor, like Regex has.
It tries to call copy constructor instead and errors out.

Next simple testcase demonstrates the issue.
class Test {
public:

  Test() {};
  Test(const Test &) = delete;
  Test(Test &&) {}

};

...

std::vector<std::pair<Test, int>> XXX;
 X.resize(1);

...

  /usr/include/c++/v1/utility:283:11: error: call to deleted constructor of 'Test'
          : first(__p.first),
            ^     ~~~~~~~~~
  /usr/include/c++/v1/memory:1645:31: note: in instantiation of member function 'std::__1::pair<Test, int>::pair' requested here
              ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
                                ^
  /usr/include/c++/v1/memory:1572:18: note: in instantiation of function template specialization 'std::__1::allocator<std::__1::pair<Test, int> >::construct<std::__1::pair<Test, int>, const std::__1::pair<Test, int> &>' requested here
              {__a.construct(__p, _VSTD::forward<_Args>(__args)...);}
                   ^
  /usr/include/c++/v1/memory:1453:14: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<Test, int> > >::__construct<std::__1::pair<Test, int>, const std::__1::pair<Test, int> &>' requested here
              {__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
               ^
  /usr/include/c++/v1/memory:1535:17: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<Test, int> > >::construct<std::__1::pair<Test, int>, const std::__1::pair<Test, int> &>' requested here
                  construct(__a, _VSTD::__to_raw_pointer(__end2-1), _VSTD::move_if_noexcept(*--__end1));
                  ^
  /usr/include/c++/v1/vector:897:21: note: in instantiation of function template specialization 'std::__1::allocator_traits<std::__1::allocator<std::__1::pair<Test, int> > >::__construct_backward<std::__1::pair<Test, int> *>' requested here
      __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
                      ^
  /usr/include/c++/v1/vector:1051:9: note: in instantiation of member function 'std::__1::vector<std::__1::pair<Test, int>, std::__1::allocator<std::__1::pair<Test, int> > >::__swap_out_circular_buffer' requested here
          __swap_out_circular_buffer(__v);
          ^
  /usr/include/c++/v1/vector:1999:15: note: in instantiation of member function 'std::__1::vector<std::__1::pair<Test, int>, std::__1::allocator<std::__1::pair<Test, int> > >::__append' requested here
          this->__append(__sz - __cs);
                ^
  /root/LLVM/llvm/tools/lld/ELF/LinkerScript.cpp:1037:6: note: in instantiation of member function 'std::__1::vector<std::__1::pair<Test, int>, std::__1::allocator<std::__1::pair<Test, int> > >::resize' requested here
   XXX.resize(1);
       ^
  /root/LLVM/llvm/tools/lld/ELF/LinkerScript.cpp:1022:3: note: function has been explicitly marked deleted here
    Test(const Test &) = delete;

Workaround I found is just use stl::list instead std::vector. Since it is almost always container of 1 elements for this case, it should work the same good and I going to recommit it with this fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D24650





More information about the llvm-commits mailing list