Skip to content

Conversation

@sipa
Copy link
Member

@sipa sipa commented Jul 6, 2021

The arm-linux-gnueabihf guix build output is littered with warnings like:

/gnu/store/7a96hdqdb2qi8a39f09n84xjy2hr23rs-gcc-cross-arm-linux-gnueabihf-8.4.0/include/c++/bits/stl_vector.h:1085:4: note: 
                 parameter passing for argument of type '__gnu_cxx::__normal_iterator<CRecipient*, std::vector<CRecipient> >' changed in GCC 7.1

These are irrelevant for us. Disable them using -Wno-psabi.

@dongcarl
Copy link
Contributor

dongcarl commented Jul 6, 2021

Huh... I don't know much about the GCC ABI, could you enlighten me as to why this doesn't apply to us?

@sipa
Copy link
Member Author

sipa commented Jul 6, 2021

My understanding is that this is just a warning not to link objects compiled with pre- and post-7.1 together.

EDIT: this seems to confirm that: https://stackoverflow.com/q/52020305/8342274

@hebasto
Copy link
Member

hebasto commented Jul 7, 2021

We use -Wno-psabi in CI, and I use it for my arm binaries.

@laanwj
Copy link
Member

laanwj commented Jul 7, 2021

My understanding is that this is just a warning not to link objects compiled with pre- and post-7.1 together.

Correct. It doesn't apply to us while building the distribution binaries because we use the same C and C++ compilers for everything including the dependencies.

ACK 1edddf5

@dongcarl
Copy link
Contributor

dongcarl commented Jul 7, 2021

Ah! In that case, ACK 5016091

@fanquake
Copy link
Member

fanquake commented Jul 8, 2021

It's a bit annoying that there doesn't seem to be a way to suppress these warnings with any sort of granularity, and the only option is disabling ABI warnings wholesale. Although I'm wondering if this is some buggy behaviour in GCC?

Ideally we could just tell GCC that we don't care about ABI related warnings for any ABI changes that happened before GCC 8.5 (i.e ABI version 13, from G++ 8.2), given that's what we are using to compile all code for the arm-linux-gnueabihf target.

I took a minified test case from the bug in question:

#include <stdarg.h>

template <int N> struct A { double p; };

A<0> v;

template <int N> struct B {
	typedef A<N> T;
	int i, j;
};

int fn1(int a, B<0> b) {
	return a + b.i;
}

int main() {
	return 0;
}

which produces the warning we're seeing:

# arm-linux-gnueabihf-g++ --version
# arm-linux-gnueabihf-g++ (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0

arm-linux-gnueabihf-g++ abi.cpp -std=c++17

abi.cpp: In function ‘int fn1(int, B<0>)’:
abi.cpp:12:5: note: parameter passing for argument of type ‘B<0>’ changed in GCC 7.1
   12 | int fn1(int a, B<0> b) {
      |     ^~~

I assumed with some combination of the -Wabi=X or -fabi-(compat)-version=X options you'd be able to suppress the warning output, but I can't find a combination that works.

Note that if you compile with -Wabi (these warnings are emitted regardless), GCC tells you that it wont warn about anything, unless you've set a -fabi-version= to something other than the default (0 or 13 in our case), but still warns:

arm-linux-gnueabihf-g++ abi.cpp -std=c++17 -Wabi
cc1plus: warning: ‘-Wabi’ won’t warn about anything [-Wabi]
cc1plus: note: ‘-Wabi’ warns about differences from the most up-to-date ABI, which is also used by default
cc1plus: note: use e.g. ‘-Wabi=11’ to warn about changes from GCC 7
abi.cpp: In function ‘int fn1(int, B<0>)’:
abi.cpp:12:5: note: parameter passing for argument of type ‘B<0>’ changed in GCC 7.1
   12 | int fn1(int a, B<0> b) {
      |     ^~~

If you set -fabi-verison=12 (G++ 8.0), GCC no longer tells you that it won't warn, but it still emits the warnings about changes in GCC 7.1:

arm-linux-gnueabihf-g++ abi.cpp -std=c++17 -fabi-version=12
abi.cpp: In function ‘int fn1(int, B<0>)’:
abi.cpp:12:5: note: parameter passing for argument of type ‘B<0>’ changed in GCC 7.1
   12 | int fn1(int a, B<0> b) {
      |     ^~~

If you set -Wabi=12, same deal:

arm-linux-gnueabihf-g++ abi.cpp -std=c++17 -Wabi=12
abi.cpp: In function ‘int fn1(int, B<0>)’:
abi.cpp:12:5: note: parameter passing for argument of type ‘B<0>’ changed in GCC 7.1
   12 | int fn1(int a, B<0> b) {
      |     ^~~

🤷

@sipa
Copy link
Member Author

sipa commented Jul 8, 2021

Is it possible that ABI and psABI are two independent settings, and that psABI doesn't have this kind of granular versioning?

@fanquake
Copy link
Member

fanquake commented Jul 8, 2021

Is it possible that ABI and psABI are two independent settings, and that psABI doesn't have this kind of granular versioning?

Yea that may be the case. Also, as of GCC 11.1, the -Wpsabi remain undocumented:

g++-11 --help=warnings | grep -i abi
  -Wabi                       Warn about things that will change when compiling with an ABI-compliant compiler.
  -Wabi-tag                   Warn if a subobject has an abi_tag attribute that the complete object type does not have.
  -Wabi=                      Warn about things that change between the current -fabi-version and the specified version.
  -Wpsabi                     This option lacks documentation.

Could be good to add one line explaining that this is disabled to suppress uncontrollable warning output, but should be ok to do based on us consistently using GCC 8.5 for the Guix build.

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 9, 2021

Guix builds

File commit 4129134
(master)
commit 8b8a1c1a631dd61ac730c429ee2c6325d4828667
(master and this pull)
SHA256SUMS.part c5cf1c6985c1c430... 10c7ffa6a8d02b2c...
SKIPATTEST.TAG e3b0c44298fc1c14... e3b0c44298fc1c14...
*-aarch64-linux-gnu-debug.tar.gz d564c8ce3c2132bb... ae58d84633dfd83f...
*-aarch64-linux-gnu.tar.gz 8c2cc0b1046d6518... 5cd07216104ede82...
*-arm-linux-gnueabihf-debug.tar.gz 9b2d147ec30ecd15... 4e04f5ab064e6400...
*-arm-linux-gnueabihf.tar.gz bd8da7121fdf38b2... b257ac7d332cdcb4...
*-osx-unsigned.dmg 4dd21a03916bd42e... 7927bca8c961befd...
*-osx-unsigned.tar.gz ff3602163bce9934... 527823a21670b092...
*-osx64.tar.gz 50b1b0f6f8b8eb16... cf0167df8084409d...
*-powerpc64-linux-gnu-debug.tar.gz aad00c9521d46187... 4b3f2a1334f43f03...
*-powerpc64-linux-gnu.tar.gz 1a326af20ced546f... 924b9e8177399e54...
*-powerpc64le-linux-gnu-debug.tar.gz 237b9ee0ddb60e47... 1a9195d951ec5500...
*-powerpc64le-linux-gnu.tar.gz 98de1dec19a8b6f9... 8bf7c8b4ee4c562f...
*-riscv64-linux-gnu-debug.tar.gz 6e0e781bbd611ad7... aeb86308d26aac0e...
*-riscv64-linux-gnu.tar.gz 96cff3df87b6f625... aa2eb36c0de9b259...
*-win-unsigned.tar.gz 59721ac4abcebb51... 8fdd06eac5ed69ef...
*-win64-debug.zip d6f919dd523c407d... 71dd7202b6d6368d...
*-win64-setup-unsigned.exe 96dc1c8f917b086c... 995b3872a2a04e22...
*-win64.zip e0e5925b0a898b9c... e01f0e011bf6759d...
*-x86_64-linux-gnu-debug.tar.gz 3912bb99acf83778... f713fa0afd305d07...
*-x86_64-linux-gnu.tar.gz eb0edfa33b57ecb7... ed73d0d8325a2c5b...
*.tar.gz 5b1ee87a8833130e... 125cd3ed40b833f3...
guix_build.log cc1551ca0837126d... 6930f99ceed8d6c5...
guix_build.log.diff b6b21359bcbd7c10...

@sipa
Copy link
Member Author

sipa commented Jul 9, 2021

@fanquake Actually, is there a reason for us to even care about the ABI/psABI at all (in guix builds, at least)? We control the entire build environment, so whatever is used, it will be consistent for everything in the build?

Copy link
Member

@hebasto hebasto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 1edddf5, after thorough reading related materials, I agree this change can be merged. As I mentioned above, I have been compiling my arm-32bit binaries with -Wno-psabi flag for two years, and no related flaws were observed.

@fanquake fanquake merged commit 4371e63 into bitcoin:master Jul 18, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Jul 23, 2021
1edddf5 Avoid GCC 7.1 ABI change warning in guix build (Pieter Wuille)

Pull request description:

  The arm-linux-gnueabihf guix build output is littered with warnings like:

  ```
  /gnu/store/7a96hdqdb2qi8a39f09n84xjy2hr23rs-gcc-cross-arm-linux-gnueabihf-8.4.0/include/c++/bits/stl_vector.h:1085:4: note:
                   parameter passing for argument of type '__gnu_cxx::__normal_iterator<CRecipient*, std::vector<CRecipient> >' changed in GCC 7.1
  ```

  These are irrelevant for us. Disable them using `-Wno-psabi`.

ACKs for top commit:
  laanwj:
    ACK 1edddf5
  hebasto:
    ACK 1edddf5, after thorough reading related materials, I agree this change can be merged. As I mentioned above, I have been compiling my arm-32bit binaries with `-Wno-psabi` flag for two years, and no related flaws were observed.

Tree-SHA512: 485c7500547ac5da567ad23847341c18ff832607f5a1002676404cc647e437cf3445b6894ecff5b52929ca52bea946c06bd90eace1997c895e56204e787065e4
gwillen pushed a commit to ElementsProject/elements that referenced this pull request Jun 1, 2022
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants