Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code using atomics should link with -latomic #9055

Closed
atsampson opened this issue Jun 27, 2022 · 0 comments
Closed

Code using atomics should link with -latomic #9055

atsampson opened this issue Jun 27, 2022 · 0 comments
Labels

Comments

@atsampson
Copy link
Contributor

Building curl-7.84.0 for 64-bit RISC-V Linux using GCC 12.1.0 fails for me:

  CCLD     curl
ld: ../lib/.libs/libcurl.so: undefined reference to `__atomic_exchange_1'

This is because GCC 12 doesn't inline sub-word-sized atomic operations (although future versions may do), and the new code in easy_lock.h does an atomic exchange on a single-byte atomic_bool.

The proper fix would be to link with GCC's libatomic - maybe CURL_ATOMIC should check for this? Changing the type of curl_simple_lock to atomic_int also works as a workaround.

@bagder bagder added the build label Jun 27, 2022
bagder added a commit that referenced this issue Jun 28, 2022
To work with more compilers without requiring separate libs to
link. Like with gcc-12 for RISC-V on Linux.

Reported-by: Adam Sampson
Fixes #9055
@bagder bagder closed this as completed in 50efb08 Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants