Add configure check for -latomic#8563
Conversation
|
Concept ACK |
|
Concept ACK, but I wonder if we should try to link with -latomic first, in case linking without it merely fails at runtime (or worse, works without providing the atomic guarantees). |
|
Hm, you have a point @luke-jr but I also like the approach of trying
That would be really messed-up. Linking a library or not should not affect program behavior in itself (that's determined during compile time), and missing symbols give an error at link time. |
|
utACK 878faac |
|
I agree, it would indeed be messed-up, but wasn't that almost exactly what happened in CVE-2012-1910? |
|
Assuming we're only doing link tests, is an AC_SEARCH_LIBS not enough here? |
IIRC there the problem was linking the wrong library, not forgetting to link a library. |
I think the problem is that it is unspecified which symbols are exported. The requirement is that the atomic library is linked when c++11 atomics are used. How these relate to ELF-level symbols is probably an implementation detail that may change over time. |
|
|
|
I mean these symbols exported by atomic library: Would be easy enough to check for one of them using AC_SEARCH_LIBS, but I think the test in this pull is fine and less dependent on implementation details. |
|
ACK 878faac, reproduced with a |
878faac Add configure check for -latomic (Anthony Towns)
Github-Pull: bitcoin#8563 Rebased-From: 878faac
|
Ugh, this m4 code is GPL licensed at best... checking with upstream if we can get MIT license on it. |
|
Looks like @luke-jr was successful; https://svn.filezilla-project.org/filezilla/FileZilla3/trunk/m4/check_atomic.m4?r1=7216&r2=7788 |
|
This was backported in #8772, removing tag |
878faac Add configure check for -latomic (Anthony Towns)
Github-Pull: bitcoin#8563 Rebased-From: 878faac
Build system improvements Includes commits cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6978 - Only the first commit (second is for QT) - bitcoin/bitcoin#7059 - bitcoin/bitcoin#7603 - Only the first commit (the rest are for QT) - bitcoin/bitcoin#7954 - bitcoin/bitcoin#8314 - Only the second commit (first is for QT) - bitcoin/bitcoin#8504 - Only the first commit (second was undoing something we didn't have) - bitcoin/bitcoin#8520 - bitcoin/bitcoin#8563 - bitcoin/bitcoin#8249 - bitcoin/bitcoin#9156 - bitcoin/bitcoin#9831 - bitcoin/bitcoin#9789 - bitcoin/bitcoin#10766 Part of #2074.
Build system improvements Includes commits cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6978 - Only the first commit (second is for QT) - bitcoin/bitcoin#7059 - bitcoin/bitcoin#7603 - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT) - bitcoin/bitcoin#7954 - bitcoin/bitcoin#8314 - Only the second commit (first is for QT) - bitcoin/bitcoin#8504 - Only the first commit (second was undoing something we didn't have) - bitcoin/bitcoin#8520 - bitcoin/bitcoin#8563 - bitcoin/bitcoin#8249 - bitcoin/bitcoin#9156 - bitcoin/bitcoin#9831 - bitcoin/bitcoin#9789 - bitcoin/bitcoin#10766 Part of #2074.
878faac Add configure check for -latomic (Anthony Towns)
878faac Add configure check for -latomic (Anthony Towns)
Build system improvements Includes commits cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6978 - Only the first commit (second is for QT) - bitcoin/bitcoin#7059 - bitcoin/bitcoin#7603 - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT) - bitcoin/bitcoin#7954 - bitcoin/bitcoin#8314 - Only the second commit (first is for QT) - bitcoin/bitcoin#8504 - Only the first commit (second was undoing something we didn't have) - bitcoin/bitcoin#8520 - bitcoin/bitcoin#8563 - bitcoin/bitcoin#8249 - bitcoin/bitcoin#9156 - bitcoin/bitcoin#9831 - bitcoin/bitcoin#9789 - bitcoin/bitcoin#10766 Part of #2074.
Build system improvements Includes commits cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6978 - Only the first commit (second is for QT) - bitcoin/bitcoin#7059 - bitcoin/bitcoin#7603 - Only the first commit (without the `BITCOIN_QT_BIN` variable; the rest are for QT) - bitcoin/bitcoin#7954 - bitcoin/bitcoin#8314 - Only the second commit (first is for QT) - bitcoin/bitcoin#8504 - Only the first commit (second was undoing something we didn't have) - bitcoin/bitcoin#8520 - bitcoin/bitcoin#8563 - bitcoin/bitcoin#8249 - bitcoin/bitcoin#9156 - bitcoin/bitcoin#9831 - bitcoin/bitcoin#9789 - bitcoin/bitcoin#10766 Part of #2074. # Conflicts: # configure.ac # src/Makefile.am # src/Makefile.gtest.include # src/Makefile.test.include # zcutil/build.sh
Add a configure check to use libatomic for std::atomic operations if needed.
Per https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_concurrency.html "Some uses of std::atomic also require linking to libatomic." This has been observed to be necessary when building with gcc on Debian's mips and mipsel architectures.