randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.58k stars 565 forks source link

GCC ABI change warnings on ARM #1589

Closed mgierlings closed 1 year ago

mgierlings commented 6 years ago

When compiling botan with gcc 6.3 on ARM the compiler outputs quite some warnings about imminent ABI breakage. Here an example (there are more of these warnings)

g++ -fstack-protector -pthread -std=c++11 -D_REENTRANT -O3 -Wall -Wextra -Wpedantic -Wstrict-aliasing -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wzero-as-null-pointer-constant -Wnon-virtual-dtor  -Ibuild/include -Ibuild/include/external -c src/cli/tls_server.cpp -o build/obj/cli/tls_server.o
In file included from /usr/include/c++/6/algorithm:62:0,
                 from build/include/botan/secmem.h:14,
                 from build/include/botan/rng.h:11,
                 from src/cli/../tests/tests.h:12,
                 from src/cli/../tests/test_rng.h:11,
                 from src/cli/speed.cpp:9:
/usr/include/c++/6/bits/stl_algo.h: In function 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/6/bits/stl_algo.h:1837:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
     __insertion_sort(_RandomAccessIterator __first,
     ^~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/stl_algo.h:1837:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
In file included from /usr/include/c++/6/bits/stl_algo.h:61:0,
                 from /usr/include/c++/6/algorithm:62,
                 from build/include/botan/secmem.h:14,
                 from build/include/botan/rng.h:11,
                 from src/cli/../tests/tests.h:12,
                 from src/cli/../tests/test_rng.h:11,
                 from src/cli/speed.cpp:9:
/usr/include/c++/6/bits/stl_heap.h: In function 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >; _Distance = int; _Tp = Botan_CLI::{anonymous}::Timer; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/6/bits/stl_heap.h:209:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
     __adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/stl_heap.h: In function 'void std::__make_heap(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/6/bits/stl_heap.h:319:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
     __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~~~~~~~~
/usr/include/c++/6/bits/stl_heap.h:319:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
/usr/include/c++/6/bits/stl_heap.h: In function 'void std::__pop_heap(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/6/bits/stl_heap.h:237:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
     __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
     ^~~~~~~~~~
/usr/include/c++/6/bits/stl_heap.h:237:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
/usr/include/c++/6/bits/stl_heap.h:237:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
In file included from /usr/include/c++/6/algorithm:62:0,
                 from build/include/botan/secmem.h:14,
                 from build/include/botan/rng.h:11,
                 from src/cli/../tests/tests.h:12,
                 from src/cli/../tests/test_rng.h:11,
                 from src/cli/speed.cpp:9:
/usr/include/c++/6/bits/stl_algo.h: In function 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >; _Size = int; _Compare = __gnu_cxx::__ops::_Iter_less_iter]':
/usr/include/c++/6/bits/stl_algo.h:1937:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
     __introsort_loop(_RandomAccessIterator __first,
     ^~~~~~~~~~~~~~~~
/usr/include/c++/6/bits/stl_algo.h:1937:5: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
/usr/include/c++/6/bits/stl_algo.h:1669:7: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
       std::__make_heap(__first, __middle, __comp);
       ^~~
In file included from /usr/include/c++/6/bits/stl_algo.h:61:0,
                 from /usr/include/c++/6/algorithm:62,
                 from build/include/botan/secmem.h:14,
                 from build/include/botan/rng.h:11,
                 from src/cli/../tests/tests.h:12,
                 from src/cli/../tests/test_rng.h:11,
                 from src/cli/speed.cpp:9:
/usr/include/c++/6/bits/stl_heap.h:400:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
    std::__pop_heap(__first, __last, __last, __comp);
    ^~~
/usr/include/c++/6/bits/stl_heap.h:400:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
/usr/include/c++/6/bits/stl_heap.h:400:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
In file included from /usr/include/c++/6/algorithm:62:0,
                 from build/include/botan/secmem.h:14,
                 from build/include/botan/rng.h:11,
                 from src/cli/../tests/tests.h:12,
                 from src/cli/../tests/test_rng.h:11,
                 from src/cli/speed.cpp:9:
/usr/include/c++/6/bits/stl_algo.h:1951:4: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
    std::__introsort_loop(__cut, __last, __depth_limit, __comp);
    ^~~
/usr/include/c++/6/bits/stl_algo.h:1669:7: note: parameter passing for argument of type '__gnu_cxx::__normal_iterator<Botan_CLI::{anonymous}::Timer*, std::vector<Botan_CLI::{anonymous}::Timer> >' will change in GCC 7.1
       std::__make_heap(__first, __middle, __comp);
       ^~~
randombit commented 6 years ago

I'm not sure what if anything we should do about these. It seems like it is just notifying us that ABI is changing? Presumably due to this bug mentioned in https://gcc.gnu.org/gcc-7/changes.html

On ARM targets (arm--*), a bug introduced in GCC 5 that affects conformance to the procedure call standard (AAPCS) has been fixed. The bug affects some C++ code where class objects are passed by value to functions and could result in incorrect or inconsistent code being generated. This is an ABI change. If the option -Wpsabi is enabled (on by default) the compiler will emit a diagnostic note for code that might be affected.

mgierlings commented 6 years ago

Probably we can not do super much about this. However this is something to keep in mind. If someone compiles an application with gcc >= 7.1 against a version of botan that has been compiled with gcc < 7.1 things will blow up (the other way around as well).

I assume that most Linux distributions will compile everything with the same compiler version, however user ppa's could become a problem, as well as binary packages not maintained by the distribution. I'm posting this mainly for 2 reasons:

  1. For reference in case someone runs into related problems.
  2. We might want to put a note explaining the problem into the news.rst and/or put it on the mailing list. That way if this would be a problem for anyone at least they are warned and can take precautions.
randombit commented 1 year ago

Closing as not actionable, but we can always point someone at this discussion if the issue arises