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

Add pthread link annotations in lib bindings #12013

Merged
merged 2 commits into from
Apr 21, 2022

Conversation

straight-shoota
Copy link
Member

In older versions of glibc (< 2.34), pthread is a separate library and needs to be explicitly added as linker argument.

This implicitly works with programs that use the garbage collector, because a link annotation is added there to ensure proper link order:

crystal/src/gc/boehm.cr

Lines 16 to 17 in ef05e26

# OTHERS: On other systems, we add the linker annotation here to make sure libpthread is loaded
# before libgc which looks up symbols from libpthread.

But when using -Dgc_none we were missing link annotations for pthread since the cleanup in #11563

This patch adds the missing annotation to the glibc bindings for pthread symbols. Other platforms might be affected as well (BSDs?), but it's only confirmed to be an issue for GNU so far.

Resolves #11986

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:runtime platform:linux-gnu labels Apr 20, 2022
@straight-shoota straight-shoota added this to the 1.4.1 milestone Apr 20, 2022
@straight-shoota straight-shoota merged commit 67a6cd3 into crystal-lang:master Apr 21, 2022
@straight-shoota straight-shoota deleted the fix/pthread-link branch April 21, 2022 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:linux-gnu topic:stdlib:runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't compile with -Dgc_none since v1.4
2 participants